Initial (redacted) commit.
This commit is contained in:
commit
655f8a036a
368 changed files with 20949 additions and 0 deletions
57
app/lib/infrastructure/routing.dart
Normal file
57
app/lib/infrastructure/routing.dart
Normal file
|
@ -0,0 +1,57 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'package:habitrack_app/infrastructure/bottom_navigation.dart';
|
||||
import 'package:habitrack_app/pages/dashboard_page.dart';
|
||||
import 'package:habitrack_app/pages/widget_page.dart';
|
||||
|
||||
// navigators, root and each destination of bottom navigation bar
|
||||
final _rootNavigatorKey = GlobalKey<NavigatorState>();
|
||||
|
||||
final _shellNavigatorWidgetWallKey =
|
||||
GlobalKey<NavigatorState>(debugLabel: 'widgetWall');
|
||||
|
||||
final _shellNavigatorDashboardKey =
|
||||
GlobalKey<NavigatorState>(debugLabel: 'dashboard');
|
||||
|
||||
const String _widgetWallPath = '/widgetWall';
|
||||
const String _dashboardPath = '/dashboard';
|
||||
|
||||
final goRouter = GoRouter(
|
||||
initialLocation: _widgetWallPath,
|
||||
navigatorKey: _rootNavigatorKey,
|
||||
debugLogDiagnostics: true,
|
||||
routes: [
|
||||
StatefulShellRoute.indexedStack(
|
||||
builder: (context, state, navigationShell) {
|
||||
return ScaffoldWithBottomNavigationBar(
|
||||
navigationShell: navigationShell,
|
||||
);
|
||||
},
|
||||
branches: [
|
||||
StatefulShellBranch(
|
||||
navigatorKey: _shellNavigatorWidgetWallKey,
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: _widgetWallPath,
|
||||
pageBuilder: (context, state) => const NoTransitionPage(
|
||||
child: WidgetPage(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
StatefulShellBranch(
|
||||
navigatorKey: _shellNavigatorDashboardKey,
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: _dashboardPath,
|
||||
pageBuilder: (context, state) => const NoTransitionPage(
|
||||
child: DashboardPage(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue