50 lines
1.7 KiB
Dart
50 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import '../scaffold/adaptive_home_scaffold.dart';
|
|
import '../../features/auth/presentation/screens/login_screen.dart';
|
|
import '../../features/medication/presentation/screens/medication_screen.dart';
|
|
import '../../features/nutrition/presentation/screens/nutrition_screen.dart';
|
|
import '../../features/meal_planner/presentation/screens/meal_planner_screen.dart';
|
|
import '../../features/pantry/presentation/screens/pantry_screen.dart';
|
|
|
|
final _rootNavigatorKey = GlobalKey<NavigatorState>();
|
|
final _shellNavigatorKey = GlobalKey<NavigatorState>();
|
|
|
|
final routerProvider = Provider<GoRouter>((ref) {
|
|
return GoRouter(
|
|
navigatorKey: _rootNavigatorKey,
|
|
initialLocation: '/medication',
|
|
routes: [
|
|
GoRoute(
|
|
path: '/login',
|
|
builder: (context, state) => const LoginScreen(),
|
|
),
|
|
ShellRoute(
|
|
navigatorKey: _shellNavigatorKey,
|
|
builder: (context, state, child) {
|
|
return AdaptiveHomeScaffold(child: child);
|
|
},
|
|
routes: [
|
|
GoRoute(
|
|
path: '/medication',
|
|
builder: (context, state) => const MedicationScreen(),
|
|
),
|
|
GoRoute(
|
|
path: '/nutrition',
|
|
builder: (context, state) => const NutritionScreen(),
|
|
),
|
|
GoRoute(
|
|
path: '/meal-planner',
|
|
builder: (context, state) => const MealPlannerScreen(),
|
|
),
|
|
GoRoute(
|
|
path: '/pantry',
|
|
builder: (context, state) => const PantryScreen(),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
);
|
|
});
|