appRouter top-level property
final
Implementation
final appRouter = GoRouter(
initialLocation: AppRoutes.home,
routes: [
GoRoute(
path: AppRoutes.intro,
builder: (context, state) => const IntroScreen(),
),
GoRoute(
path: AppRoutes.login,
builder: (context, state) => const LoginScreen(),
),
StatefulShellRoute(
builder: (context, state, navigationShell) =>
HomeScreen(navigationShell: navigationShell),
navigatorContainerBuilder: (context, navigationShell, children) {
return AnimatedShellContainer(
currentIndex: navigationShell.currentIndex,
children: children,
);
},
branches: [
StatefulShellBranch(
routes: [
GoRoute(
path: AppRoutes.home,
pageBuilder: (context, state) =>
const NoTransitionPage(child: CourseTableScreen()),
),
],
),
StatefulShellBranch(
routes: [
GoRoute(
path: AppRoutes.score,
pageBuilder: (context, state) =>
const NoTransitionPage(child: ScoreScreen()),
),
],
),
StatefulShellBranch(
routes: [
GoRoute(
path: AppRoutes.profile,
pageBuilder: (context, state) =>
const NoTransitionPage(child: ProfileScreen()),
),
],
),
],
),
],
);