Aidra Driver 1.3.5+68
Aidra Driver - Your path to green energy
Loading...
Searching...
No Matches
router.dart
Go to the documentation of this file.
1import 'package:go_router/go_router.dart';
2import 'package:flutter/material.dart';
3import 'package:posthog_flutter/posthog_flutter.dart';
4import '../ui/widgets/nav_bar.dart';
5import 'auth_notifier.dart';
6import 'auth_guard.dart';
7import 'custom_posthog_observer.dart';
8import 'routes.dart';
9
10final rootNavigatorKey = GlobalKey<NavigatorState>();
11final _sectionNavigatorKey = GlobalKey<NavigatorState>();
12
13RouterConfig<Object> router(AuthNotifier authNotifier) => GoRouter(
14 observers: [
15 PosthogObserver(),
16 CustomPosthogObserver(),
17 ],
18 refreshListenable: authNotifier,
19 navigatorKey: rootNavigatorKey,
20 initialLocation: Routes.splashScreen.route,
21 redirect: AuthGuard.instance.redirect,
22 routes: <RouteBase>[
23 Routes.splashScreen.build,
24 Routes.signInScreen.build,
25 Routes.checkInScreen.build,
26 Routes.collectionRequestSuccessScreen.build,
27 Routes.driverRequestsScreen.build,
28 StatefulShellRoute.indexedStack(
29 builder: (context, state, navigationShell) {
30 return NavBar(
31 navigationShell,
32 );
33 },
34 branches: [
35 StatefulShellBranch(
36 routes: [
37 Routes.dashboardScreen.build,
38 ],
39 ),
40 StatefulShellBranch(
41 routes: <RouteBase>[
42 Routes.elearning.build,
43 Routes.courseDetailsScreen.build,
44 Routes.pdfViewerScreen.build,
45 ],
46 ),
47 StatefulShellBranch(
48 routes: <RouteBase>[
49 Routes.homeScreen.build,
50 Routes.startLocationChooserScreen.build,
51 Routes.weeklyCollectionsScreen.build,
52 Routes.endLocationChooserScreen.build,
53 Routes.scheduleConfirmationScreen.build,
54 Routes.todayScheduleScreen.build,
55 Routes.collectionDetailsScreen.build,
56 Routes.transactionsHistoryScreen.build,
57 Routes.collectionRequestInformationScreen.build,
58 Routes.collectionRequestConfirmationScreen.build,
59 Routes.collectionRequestPaymentScreen.build,
60 Routes.wallet.build,
61 Routes.unloadingScreen.build,
62 ],
63 ),
64 StatefulShellBranch(
65 routes: <RouteBase>[
66 Routes.notificationsScreen.build,
67 ],
68 ),
69 StatefulShellBranch(
70 navigatorKey: _sectionNavigatorKey,
71 routes: <RouteBase>[
72 Routes.settingsScreen.build,
73 Routes.vehicleDocumentsScreen.build,
74 Routes.documentsScreen.build,
75 ],
76 ),
77 ],
78 ),
79 ],
80);
override FutureOr< String?> redirect(BuildContext context, GoRouterState state) async
final _sectionNavigatorKey
Definition router.dart:11
RouterConfig< Object > router(AuthNotifier authNotifier)
final rootNavigatorKey
Definition router.dart:10
Routes
Definition routes.dart:30