Fix Navigation issue where popping 2 routes at the same time (#584)

Omar Hatem committed Nov 2, 2022 at 19:11 UTC e8b3a0648a9aa1f18c4cf40235a73f25dc289605
1 file changed +10 -9
lib/src/screens/auth/auth_page.dart
+10 -9
@@ -111,15 +111,16 @@ class AuthPageState extends State<AuthPage> {
111 throw Exception('Key context is null. Should be not happened');
112 }
113
114 - WidgetsBinding.instance.addPostFrameCallback((_) async {
115 - await _authBar?.dismiss();
116 - await _progressBar?.dismiss();
117 -
118 - if (route != null) {
119 - Navigator.of(_key.currentContext!).pushReplacementNamed(route);
120 - } else {
121 - Navigator.of(_key.currentContext!).pop();
122 - }
114 + WidgetsBinding.instance.addPostFrameCallback((_) {
115 + dismissFlushBar(_authBar);
116 + dismissFlushBar(_progressBar);
117 + WidgetsBinding.instance.addPostFrameCallback((_) {
118 + if (route != null) {
119 + Navigator.of(_key.currentContext!).pushReplacementNamed(route);
120 + } else {
121 + Navigator.of(_key.currentContext!).pop();
122 + }
123 + });
124 });
125 }
126