flutter_chips_input icon indicating copy to clipboard operation
flutter_chips_input copied to clipboard

Throws when too close to the bottom of the screen

Open K-Zawis opened this issue 4 years ago • 0 comments

I'm making a dynamic form builder and to test it I have been adding various forms of form fields to it. While adding the chips input field, I have noticed something.

If the choice chip is at the bottom of the form it will throw the following error message:

[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: This widget has been unmounted, so the State no longer has a context (and should be considered defunct). E/flutter (13406): Consider canceling any active work during "dispose" or using the "mounted" getter to determine if the State is still active. E/flutter (13406): #0 State.context.<anonymous closure> (package:flutter/src/widgets/framework.dart:909:9) E/flutter (13406): #1 State.context (package:flutter/src/widgets/framework.dart:915:6) E/flutter (13406): #2 ChipsInputState._scrollToVisible.<anonymous closure>.<anonymous closure> (package:flutter_chips_input/src/chips_input.dart:289:27) E/flutter (13406): #3 ChipsInputState._scrollToVisible.<anonymous closure>.<anonymous closure> (package:flutter_chips_input/src/chips_input.dart:288:53) E/flutter (13406): #4 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1145:15) E/flutter (13406): #5 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1090:9) E/flutter (13406): #6 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:996:5) E/flutter (13406): #7 _rootRun (dart:async/zone.dart:1426:13) E/flutter (13406): #8 _CustomZone.run (dart:async/zone.dart:1328:19) E/flutter (13406): #9 _CustomZone.runGuarded (dart:async/zone.dart:1236:7) E/flutter (13406): #10 _invoke (dart:ui/hooks.dart:150:10) E/flutter (13406): #11 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:270:5) E/flutter (13406): #12 _drawFrame (dart:ui/hooks.dart:114:31) E/flutter (13406):

If I add some padding and move the page up, it will work fine. But eventually, the closer it gets to the bottom (bellow a padding of 34 in a list view builder and fully scrolled down) the above error message throws and hides the keyboard, resetting any chips that may have been already added. So if you tap the field when it's visible, but not 34 pixels away from the bottom edge it throw the unmounted error, otherwise works as expected.

K-Zawis avatar Nov 30 '21 16:11 K-Zawis