From e8b3a0648a9aa1f18c4cf40235a73f25dc289605 Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Wed, 2 Nov 2022 19:11:53 +0200 Subject: [PATCH] Fix Navigation issue where popping 2 routes at the same time (#584) --- lib/src/screens/auth/auth_page.dart | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/src/screens/auth/auth_page.dart b/lib/src/screens/auth/auth_page.dart index db5e3cd4a..0b3b8511a 100644 --- a/lib/src/screens/auth/auth_page.dart +++ b/lib/src/screens/auth/auth_page.dart @@ -111,15 +111,16 @@ class AuthPageState extends State { throw Exception('Key context is null. Should be not happened'); } - WidgetsBinding.instance.addPostFrameCallback((_) async { - await _authBar?.dismiss(); - await _progressBar?.dismiss(); - - if (route != null) { - Navigator.of(_key.currentContext!).pushReplacementNamed(route); - } else { - Navigator.of(_key.currentContext!).pop(); - } + 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(); + } + }); }); }