- Flutter/Dart (iOS + Android), Riverpod, go_router, i18n via ARB (deutsch) - Feature-Struktur: today, plants, locations, household (V2-Platzhalter), settings - Intervall-Modell: Aufgaben werden aus lastWatered/lastFertilized + Intervall berechnet - In-Memory-Demo-Daten, Firebase-Anbindung folgt im nächsten Block - Doku: Architektur, Firebase-Einrichtung, Forgejo-Git-Hosting Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
65 lines
2.1 KiB
Dart
65 lines
2.1 KiB
Dart
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
import '../../features/household/presentation/household_screen.dart';
|
|
import '../../features/locations/presentation/locations_screen.dart';
|
|
import '../../features/plants/domain/plant.dart';
|
|
import '../../features/plants/presentation/plant_detail_screen.dart';
|
|
import '../../features/plants/presentation/plant_form_screen.dart';
|
|
import '../../features/plants/presentation/plants_screen.dart';
|
|
import '../../features/settings/presentation/settings_screen.dart';
|
|
import '../../features/today/presentation/today_screen.dart';
|
|
|
|
/// Zentrale Routen-Definition. Die Pfade werden auch vom Drawer genutzt,
|
|
/// deshalb hier als Konstanten.
|
|
abstract final class AppRoutes {
|
|
static const today = '/';
|
|
static const plants = '/plants';
|
|
static const plantAdd = '/plants/add';
|
|
static const plantEdit = '/plants/edit';
|
|
static const locations = '/locations';
|
|
static const household = '/household';
|
|
static const settings = '/settings';
|
|
}
|
|
|
|
final appRouterProvider = Provider<GoRouter>((ref) {
|
|
return GoRouter(
|
|
initialLocation: AppRoutes.today,
|
|
routes: [
|
|
GoRoute(
|
|
path: AppRoutes.today,
|
|
builder: (context, state) => const TodayScreen(),
|
|
),
|
|
GoRoute(
|
|
path: AppRoutes.plants,
|
|
builder: (context, state) => const PlantsScreen(),
|
|
),
|
|
GoRoute(
|
|
path: AppRoutes.plantAdd,
|
|
builder: (context, state) => const PlantFormScreen(),
|
|
),
|
|
GoRoute(
|
|
path: AppRoutes.plantEdit,
|
|
builder: (context, state) =>
|
|
PlantFormScreen(existing: state.extra as Plant?),
|
|
),
|
|
GoRoute(
|
|
path: '/plants/:id',
|
|
builder: (context, state) =>
|
|
PlantDetailScreen(plantId: state.pathParameters['id']!),
|
|
),
|
|
GoRoute(
|
|
path: AppRoutes.locations,
|
|
builder: (context, state) => const LocationsScreen(),
|
|
),
|
|
GoRoute(
|
|
path: AppRoutes.household,
|
|
builder: (context, state) => const HouseholdScreen(),
|
|
),
|
|
GoRoute(
|
|
path: AppRoutes.settings,
|
|
builder: (context, state) => const SettingsScreen(),
|
|
),
|
|
],
|
|
);
|
|
});
|