feat(01-02): create router, navigation shell, screens, and app shell test

- 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>
This commit is contained in:
2026-03-15 20:04:59 +01:00
parent cd1ce21f3f
commit f2dd737e9e
6 changed files with 342 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:household_keeper/l10n/app_localizations.dart';
class HomeScreen extends StatelessWidget {
const HomeScreen({super.key});
@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context);
final theme = Theme.of(context);
return Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 32),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.checklist_rounded,
size: 80,
color: theme.colorScheme.onSurface.withValues(alpha: 0.4),
),
const SizedBox(height: 24),
Text(
l10n.homeEmptyTitle,
style: theme.textTheme.headlineSmall,
textAlign: TextAlign.center,
),
const SizedBox(height: 8),
Text(
l10n.homeEmptyMessage,
style: theme.textTheme.bodyLarge?.copyWith(
color: theme.colorScheme.onSurface.withValues(alpha: 0.6),
),
textAlign: TextAlign.center,
),
const SizedBox(height: 24),
FilledButton.tonal(
onPressed: () => context.go('/rooms'),
child: Text(l10n.homeEmptyAction),
),
],
),
),
);
}
}

View File

@@ -0,0 +1,50 @@
import 'package:flutter/material.dart';
import 'package:household_keeper/l10n/app_localizations.dart';
class RoomsScreen extends StatelessWidget {
const RoomsScreen({super.key});
@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context);
final theme = Theme.of(context);
return Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 32),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.door_front_door_rounded,
size: 80,
color: theme.colorScheme.onSurface.withValues(alpha: 0.4),
),
const SizedBox(height: 24),
Text(
l10n.roomsEmptyTitle,
style: theme.textTheme.headlineSmall,
textAlign: TextAlign.center,
),
const SizedBox(height: 8),
Text(
l10n.roomsEmptyMessage,
style: theme.textTheme.bodyLarge?.copyWith(
color: theme.colorScheme.onSurface.withValues(alpha: 0.6),
),
textAlign: TextAlign.center,
),
const SizedBox(height: 24),
FilledButton.tonal(
onPressed: () {
// Room creation will be implemented in Phase 2
},
child: Text(l10n.roomsEmptyAction),
),
],
),
),
);
}
}

View File

@@ -0,0 +1,83 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:household_keeper/core/theme/theme_provider.dart';
import 'package:household_keeper/l10n/app_localizations.dart';
class SettingsScreen extends ConsumerWidget {
const SettingsScreen({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final l10n = AppLocalizations.of(context);
final theme = Theme.of(context);
final currentThemeMode = ref.watch(themeProvider);
return ListView(
children: [
// Section 1: Appearance (Darstellung)
Padding(
padding: const EdgeInsets.fromLTRB(16, 24, 16, 8),
child: Text(
l10n.settingsSectionAppearance,
style: theme.textTheme.titleMedium?.copyWith(
color: theme.colorScheme.primary,
),
),
),
ListTile(
title: Text(l10n.settingsThemeLabel),
subtitle: Padding(
padding: const EdgeInsets.only(top: 8),
child: SegmentedButton<ThemeMode>(
segments: [
ButtonSegment<ThemeMode>(
value: ThemeMode.system,
label: Text(l10n.themeSystem),
icon: const Icon(Icons.settings_suggest_outlined),
),
ButtonSegment<ThemeMode>(
value: ThemeMode.light,
label: Text(l10n.themeLight),
icon: const Icon(Icons.light_mode_outlined),
),
ButtonSegment<ThemeMode>(
value: ThemeMode.dark,
label: Text(l10n.themeDark),
icon: const Icon(Icons.dark_mode_outlined),
),
],
selected: {currentThemeMode},
onSelectionChanged: (selection) {
ref
.read(themeProvider.notifier)
.setThemeMode(selection.first);
},
),
),
),
const Divider(indent: 16, endIndent: 16, height: 32),
// Section 2: About (Ueber)
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 8),
child: Text(
l10n.settingsSectionAbout,
style: theme.textTheme.titleMedium?.copyWith(
color: theme.colorScheme.primary,
),
),
),
ListTile(
title: Text(l10n.aboutAppName),
subtitle: Text(l10n.aboutTagline),
),
ListTile(
title: const Text('Version'),
subtitle: Text(l10n.aboutVersion('0.1.0')),
),
],
);
}
}