diff --git a/ios/Podfile.lock b/ios/Podfile.lock index f8f120bd6..3a810430d 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -252,4 +252,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: ae71bdf0eb731a1ffc399c122f6aa4dea0cb5f6f -COCOAPODS: 1.11.2 +COCOAPODS: 1.11.3 diff --git a/lib/src/screens/auth/auth_page.dart b/lib/src/screens/auth/auth_page.dart index 0b3b8511a..7a1bd8420 100644 --- a/lib/src/screens/auth/auth_page.dart +++ b/lib/src/screens/auth/auth_page.dart @@ -106,22 +106,22 @@ class AuthPageState extends State { _progressBar = null; } - Future close({String? route}) async { + Future close({String? route, dynamic arguments}) async { if (_key.currentContext == null) { throw Exception('Key context is null. Should be not happened'); } - WidgetsBinding.instance.addPostFrameCallback((_) { - dismissFlushBar(_authBar); - dismissFlushBar(_progressBar); - WidgetsBinding.instance.addPostFrameCallback((_) { - if (route != null) { - Navigator.of(_key.currentContext!).pushReplacementNamed(route); - } else { - Navigator.of(_key.currentContext!).pop(); - } - }); - }); + /// not the best scenario, but WidgetsBinding is not behaving correctly on Android + await Future.delayed(Duration(milliseconds: 50)); + await _authBar?.dismiss(); + await Future.delayed(Duration(milliseconds: 50)); + await _progressBar?.dismiss(); + await Future.delayed(Duration(milliseconds: 50)); + if (route != null) { + Navigator.of(_key.currentContext!).pushReplacementNamed(route, arguments: arguments); + } else { + Navigator.of(_key.currentContext!).pop(); + } } @override diff --git a/lib/view_model/settings/settings_view_model.dart b/lib/view_model/settings/settings_view_model.dart index 96b2e7bdd..aabe51ef1 100644 --- a/lib/view_model/settings/settings_view_model.dart +++ b/lib/view_model/settings/settings_view_model.dart @@ -156,13 +156,13 @@ abstract class SettingsViewModelBase with Store { handler: (BuildContext context) { Navigator.of(context).pushNamed(Routes.auth, arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) { - auth.close(); - if (isAuthenticatedSuccessfully) { - Navigator.of(context).pushNamed(Routes.setupPin, arguments: - (PinCodeState setupPinContext, String _) { + auth.close( + route: isAuthenticatedSuccessfully ? Routes.setupPin : null, + arguments: (PinCodeState setupPinContext, + String _) { setupPinContext.close(); - }); - } + }, + ); }); }), PickerListItem(