72 lines
2.0 KiB
Dart
72 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import '../features/dashboard/dashboard_screen.dart';
|
|
import '../features/map/map_screen.dart';
|
|
import '../features/history/history_screen.dart';
|
|
import '../features/records/records_screen.dart';
|
|
import '../features/settings/settings_screen.dart';
|
|
import '../features/settings/diagnostics_screen.dart';
|
|
import 'widgets/main_layout.dart';
|
|
|
|
final _rootNavigatorKey = GlobalKey<NavigatorState>();
|
|
|
|
final appRouter = GoRouter(
|
|
navigatorKey: _rootNavigatorKey,
|
|
initialLocation: '/',
|
|
routes: [
|
|
StatefulShellRoute.indexedStack(
|
|
builder: (context, state, navigationShell) {
|
|
return MainLayout(navigationShell: navigationShell);
|
|
},
|
|
branches: [
|
|
StatefulShellBranch(
|
|
routes: [
|
|
GoRoute(
|
|
path: '/',
|
|
builder: (context, state) => const DashboardScreen(),
|
|
),
|
|
],
|
|
),
|
|
StatefulShellBranch(
|
|
routes: [
|
|
GoRoute(
|
|
path: '/map',
|
|
builder: (context, state) => const MapScreen(),
|
|
),
|
|
],
|
|
),
|
|
StatefulShellBranch(
|
|
routes: [
|
|
GoRoute(
|
|
path: '/history',
|
|
builder: (context, state) => const HistoryScreen(),
|
|
),
|
|
],
|
|
),
|
|
StatefulShellBranch(
|
|
routes: [
|
|
GoRoute(
|
|
path: '/records',
|
|
builder: (context, state) => const RecordsScreen(),
|
|
),
|
|
],
|
|
),
|
|
StatefulShellBranch(
|
|
routes: [
|
|
GoRoute(
|
|
path: '/settings',
|
|
builder: (context, state) => const SettingsScreen(),
|
|
routes: [
|
|
GoRoute(
|
|
path: 'diagnostics',
|
|
builder: (context, state) => const DiagnosticsScreen(),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
],
|
|
);
|