fixes(mobile) back navigation issue on android (#841)

This commit is contained in:
Zeeshan Khan 2022-10-21 13:05:44 -05:00 committed by GitHub
parent 95d8f60389
commit 0309b47515
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,15 +24,13 @@ class TabControllerPage extends ConsumerWidget {
final appRouter = AutoRouter.of(context); final appRouter = AutoRouter.of(context);
return WillPopScope( return WillPopScope(
onWillPop: () async { onWillPop: () async {
if (tabsRouter.activeIndex == 0) { bool atHomeTab = tabsRouter.activeIndex == 0;
if (!appRouter.canNavigateBack) { if (!atHomeTab) {
appRouter.navigateBack();
}
return appRouter.canNavigateBack;
} else {
tabsRouter.setActiveIndex(0); tabsRouter.setActiveIndex(0);
} else {
appRouter.navigateBack();
} }
return false; return atHomeTab;
}, },
child: Scaffold( child: Scaffold(
body: FadeTransition( body: FadeTransition(