- GoRouter with StatefulShellRoute.indexedStack and 3 branches (Home, Rooms, Settings) - AppShell with NavigationBar using localized labels and thematic icons - HomeScreen with empty state and cross-navigation to Rooms tab - RoomsScreen with empty state and placeholder action button - SettingsScreen with SegmentedButton theme switcher and About section - Widget test verifying 3 navigation destinations with correct German labels Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
49 lines
1.3 KiB
Dart
49 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
import 'package:household_keeper/l10n/app_localizations.dart';
|
|
|
|
class AppShell extends StatelessWidget {
|
|
const AppShell({
|
|
required this.navigationShell,
|
|
super.key,
|
|
});
|
|
|
|
final StatefulNavigationShell navigationShell;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final l10n = AppLocalizations.of(context);
|
|
|
|
return Scaffold(
|
|
body: navigationShell,
|
|
bottomNavigationBar: NavigationBar(
|
|
selectedIndex: navigationShell.currentIndex,
|
|
onDestinationSelected: (index) {
|
|
navigationShell.goBranch(
|
|
index,
|
|
initialLocation: index == navigationShell.currentIndex,
|
|
);
|
|
},
|
|
destinations: [
|
|
NavigationDestination(
|
|
icon: const Icon(Icons.checklist_outlined),
|
|
selectedIcon: const Icon(Icons.checklist),
|
|
label: l10n.tabHome,
|
|
),
|
|
NavigationDestination(
|
|
icon: const Icon(Icons.door_front_door_outlined),
|
|
selectedIcon: const Icon(Icons.door_front_door),
|
|
label: l10n.tabRooms,
|
|
),
|
|
NavigationDestination(
|
|
icon: const Icon(Icons.tune_outlined),
|
|
selectedIcon: const Icon(Icons.tune),
|
|
label: l10n.tabSettings,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|