Skip to content

Commit

Permalink
Use NoTransitionPage everywhere, tweak redirect logic
Browse files Browse the repository at this point in the history
  • Loading branch information
bizz84 committed Mar 18, 2024
1 parent 3870eea commit d2eba85
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/src/routing/app_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,14 @@ GoRouter goRouter(GoRouterRef ref) {
}
final isLoggedIn = authRepository.currentUser != null;
if (isLoggedIn) {
if (path.startsWith('/signIn')) {
if (path.startsWith('/signIn') || path.startsWith('/startup')) {
return '/jobs';
}
} else {
if (path.startsWith('/jobs') ||
path.startsWith('/entries') ||
path.startsWith('/account')) {
path.startsWith('/account') ||
path.startsWith('/startup')) {
return '/signIn';
}
}
Expand Down Expand Up @@ -108,9 +109,9 @@ GoRouter goRouter(GoRouterRef ref) {
// Stateful navigation based on:
// https://github.com/flutter/packages/blob/main/packages/go_router/example/lib/stateful_shell_route.dart
StatefulShellRoute.indexedStack(
builder: (context, state, navigationShell) {
return ScaffoldWithNestedNavigation(navigationShell: navigationShell);
},
pageBuilder: (context, state, navigationShell) => NoTransitionPage(
child: ScaffoldWithNestedNavigation(navigationShell: navigationShell),
),
branches: [
StatefulShellBranch(
navigatorKey: _jobsNavigatorKey,
Expand Down Expand Up @@ -218,6 +219,8 @@ GoRouter goRouter(GoRouterRef ref) {
],
),
],
errorBuilder: (context, state) => const NotFoundScreen(),
errorPageBuilder: (context, state) => const NoTransitionPage(
child: NotFoundScreen(),
),
);
}

0 comments on commit d2eba85

Please sign in to comment.