mirror of
https://github.com/immich-app/immich.git
synced 2025-01-04 02:46:47 +01:00
fixes #310 back button navigation
This commit is contained in:
parent
c271f0c224
commit
a3ca5307a5
3 changed files with 13 additions and 6 deletions
|
@ -228,7 +228,7 @@ class LoginButton extends ConsumerWidget {
|
||||||
AutoRouter.of(context).push(const ChangePasswordRoute());
|
AutoRouter.of(context).push(const ChangePasswordRoute());
|
||||||
} else {
|
} else {
|
||||||
ref.watch(backupProvider.notifier).resumeBackup();
|
ref.watch(backupProvider.notifier).resumeBackup();
|
||||||
AutoRouter.of(context).pushNamed("/tab-controller-page");
|
AutoRouter.of(context).replace(const TabControllerRoute());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ImmichToast.show(
|
ImmichToast.show(
|
||||||
|
|
|
@ -29,9 +29,9 @@ class SplashScreenPage extends HookConsumerWidget {
|
||||||
if (isAuthenticated) {
|
if (isAuthenticated) {
|
||||||
// Resume backup (if enable) then navigate
|
// Resume backup (if enable) then navigate
|
||||||
ref.watch(backupProvider.notifier).resumeBackup();
|
ref.watch(backupProvider.notifier).resumeBackup();
|
||||||
AutoRouter.of(context).pushNamed("/tab-controller-page");
|
AutoRouter.of(context).replace(const TabControllerRoute());
|
||||||
} else {
|
} else {
|
||||||
AutoRouter.of(context).push(const LoginRoute());
|
AutoRouter.of(context).replace(const LoginRoute());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class SplashScreenPage extends HookConsumerWidget {
|
||||||
if (loginInfo?.isSaveLogin == true) {
|
if (loginInfo?.isSaveLogin == true) {
|
||||||
performLoggingIn();
|
performLoggingIn();
|
||||||
} else {
|
} else {
|
||||||
AutoRouter.of(context).push(const LoginRoute());
|
AutoRouter.of(context).replace(const LoginRoute());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
|
@ -12,7 +12,6 @@ class TabControllerPage extends ConsumerWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final multiselectEnabled = ref.watch(multiselectProvider);
|
final multiselectEnabled = ref.watch(multiselectProvider);
|
||||||
|
|
||||||
return AutoTabsRouter(
|
return AutoTabsRouter(
|
||||||
routes: [
|
routes: [
|
||||||
const HomeRoute(),
|
const HomeRoute(),
|
||||||
|
@ -22,9 +21,17 @@ class TabControllerPage extends ConsumerWidget {
|
||||||
],
|
],
|
||||||
builder: (context, child, animation) {
|
builder: (context, child, animation) {
|
||||||
final tabsRouter = AutoTabsRouter.of(context);
|
final tabsRouter = AutoTabsRouter.of(context);
|
||||||
|
final appRouter = AutoRouter.of(context);
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () async {
|
onWillPop: () async {
|
||||||
tabsRouter.setActiveIndex(0);
|
if (tabsRouter.activeIndex == 0) {
|
||||||
|
if (!appRouter.canNavigateBack) {
|
||||||
|
appRouter.navigateBack();
|
||||||
|
}
|
||||||
|
return appRouter.canNavigateBack;
|
||||||
|
} else {
|
||||||
|
tabsRouter.setActiveIndex(0);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
|
|
Loading…
Reference in a new issue