diff --git a/lib/main.dart b/lib/main.dart index ce05ae4a..4e8a6d19 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -206,24 +206,25 @@ class _AppState extends State with WidgetsBindingObserver { print('email: $email, token: $token'); final bool isNotEmpty = email.isNotEmpty && token.isNotEmpty; if (isNotEmpty) { - final BuildContext context = StorageHelper().context!; final FlutterFlowTheme theme = FlutterFlowTheme.of(context); final Widget screen = ForgotPasswordScreen(email: email, token: token); builder(context) => screen; print('showModalBottomSheet'); - await showModalBottomSheet( - context: context, - builder: (context) => Padding(padding: MediaQuery.viewInsetsOf(context), child: builder(context)), - isScrollControlled: true, - // barrierColor: theme.primaryBackground.withOpacity(0.2), - backgroundColor: theme.primaryBackground, - showDragHandle: true, - useSafeArea: true, - enableDrag: true, - // isDismissible: true, - ).whenComplete(() { - StorageHelper().isRecovered = false; - print('showModalBottomSheet completed'); + WidgetsBinding.instance.addPostFrameCallback((_) async { + await showModalBottomSheet( + context: StorageHelper().context!, + builder: (context) => Padding(padding: MediaQuery.viewInsetsOf(context), child: builder(context)), + isScrollControlled: true, + // barrierColor: theme.primaryBackground.withOpacity(0.2), + backgroundColor: theme.primaryBackground, + showDragHandle: true, + useSafeArea: true, + enableDrag: true, + // isDismissible: true, + ).whenComplete(() { + StorageHelper().isRecovered = false; + print('showModalBottomSheet completed'); + }); }); } } @@ -276,7 +277,9 @@ class _AppState extends State with WidgetsBindingObserver { _appStateNotifier = AppStateNotifier.instance; _router = createRouter(_appStateNotifier); Future.delayed( - const Duration(milliseconds: 1000), () => setState(() => _appStateNotifier.stopShowingSplashImage())); + const Duration(milliseconds: 1000), + () => setState(() => _appStateNotifier.stopShowingSplashImage()), + ); _setupFirebaseMessaging(); initDeepLinks();