dudeofawesome / hn_flutter

Butterfly Reader for Hacker News, built with Flutter
GNU General Public License v3.0
16 stars 6 forks source link

Login dialog throws an error on close attempt #39

Open dudeofawesome opened 6 years ago

dudeofawesome commented 6 years ago
E/flutter (24130): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter (24130): Scaffold.of() called with a context that does not contain a Scaffold.
E/flutter (24130): No Scaffold ancestor could be found starting from the context that was passed to Scaffold.of(). This usually happens when the context provided is from the same StatefulWidget as that whose build function actually creates the Scaffold widget being sought.
E/flutter (24130): There are several ways to avoid this problem. The simplest is to use a Builder to get a context that is "under" the Scaffold. For an example of this, please see the documentation for Scaffold.of():
E/flutter (24130):   https://docs.flutter.io/flutter/material/Scaffold/of.html
E/flutter (24130): A more efficient solution is to split your build function into several widgets. This introduces a new context from which you can obtain the Scaffold. In this solution, you would have an outer widget that creates the Scaffold populated by instances of your new inner widgets, and then in these inner widgets you would use Scaffold.of().
E/flutter (24130): A less elegant but more expedient solution is assign a GlobalKey to the Scaffold, then use the key.currentState property to obtain the ScaffoldState rather than using the Scaffold.of() function.
E/flutter (24130): The context used was:
E/flutter (24130):   Builder
E/flutter (24130): #0      Scaffold.of (package:flutter/src/material/scaffold.dart:944:5)
E/flutter (24130): #1      _MainDrawerState._addAccount (package:hn_flutter/components/main_drawer.dart:464:16)
E/flutter (24130): <asynchronous suspension>
E/flutter (24130): #2      _MainDrawerState._showAddAccountDialog.<anonymous closure>.<anonymous closure> (package:hn_flutter/components/main_drawer.dart:418:32)
E/flutter (24130): <asynchronous suspension>
E/flutter (24130): #3      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:478:14)
E/flutter (24130): #4      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:530:30)
E/flutter (24130): #5      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
E/flutter (24130): #6      TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:161:9)
E/flutter (24130): #7      TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:94:7)
E/flutter (24130): #8      PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9)
E/flutter (24130): #9      PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12)
E/flutter (24130): #10     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11)
E/flutter (24130): #11     _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:143:19)
E/flutter (24130): #12     _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:121:22)
E/flutter (24130): #13     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:101:7)
E/flutter (24130): #14     _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:64:7)
E/flutter (24130): #15     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:48:7)
E/flutter (24130): #16     _invoke1 (dart:ui/hooks.dart:134:13)
E/flutter (24130): #17     _dispatchPointerDataPacket (dart:ui/hooks.dart:91:5)