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 4405f35
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/src/routing/app_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,15 @@ GoRouter goRouter(GoRouterRef ref) {
}
final isLoggedIn = authRepository.currentUser != null;
if (isLoggedIn) {
if (path.startsWith('/signIn')) {
if (path.startsWith('/startup') ||
path.startsWith('/onboarding') ||
path.startsWith('/signIn')) {
return '/jobs';
}
} else {
if (path.startsWith('/jobs') ||
if (path.startsWith('/startup') ||
path.startsWith('/onboarding') ||
path.startsWith('/jobs') ||
path.startsWith('/entries') ||
path.startsWith('/account')) {
return '/signIn';
Expand Down Expand Up @@ -108,9 +112,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 +222,8 @@ GoRouter goRouter(GoRouterRef ref) {
],
),
],
errorBuilder: (context, state) => const NotFoundScreen(),
errorPageBuilder: (context, state) => const NoTransitionPage(
child: NotFoundScreen(),
),
);
}

0 comments on commit 4405f35

Please sign in to comment.