feat(02-02): build rooms screen with reorderable card grid and room card
- Replace placeholder RoomsScreen with ConsumerWidget watching roomWithStatsProvider - Create RoomCard with icon, name, due count badge, cleanliness progress bar - 2-column ReorderableBuilder grid with drag-and-drop reorder - Empty state, loading, error states with retry - Long-press menu for edit/delete with confirmation dialog - FAB for room creation navigation - Update app_shell_test with provider override for rooms stream Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
// ignore_for_file: scoped_providers_should_specify_dependencies
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import 'package:household_keeper/core/router/router.dart';
|
||||
import 'package:household_keeper/features/rooms/presentation/room_providers.dart';
|
||||
import 'package:household_keeper/l10n/app_localizations.dart';
|
||||
|
||||
void main() {
|
||||
@@ -12,18 +14,29 @@ void main() {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
});
|
||||
|
||||
testWidgets('renders 3 navigation destinations with correct German labels',
|
||||
(tester) async {
|
||||
await tester.pumpWidget(
|
||||
ProviderScope(
|
||||
child: MaterialApp.router(
|
||||
routerConfig: router,
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: const [Locale('de')],
|
||||
locale: const Locale('de'),
|
||||
/// Helper to build the app with room provider overridden to empty list.
|
||||
Widget buildApp() {
|
||||
return ProviderScope(
|
||||
overrides: [
|
||||
// Override the stream provider to return an empty list immediately
|
||||
// so that the rooms screen shows the empty state without needing a DB.
|
||||
// ignore: scoped_providers_should_specify_dependencies
|
||||
roomWithStatsListProvider.overrideWith(
|
||||
(ref) => Stream.value([]),
|
||||
),
|
||||
],
|
||||
child: MaterialApp.router(
|
||||
routerConfig: router,
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: const [Locale('de')],
|
||||
locale: const Locale('de'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders 3 navigation destinations with correct German labels',
|
||||
(tester) async {
|
||||
await tester.pumpWidget(buildApp());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Verify 3 NavigationDestination widgets are rendered
|
||||
@@ -37,16 +50,7 @@ void main() {
|
||||
|
||||
testWidgets('tapping a destination changes the selected tab',
|
||||
(tester) async {
|
||||
await tester.pumpWidget(
|
||||
ProviderScope(
|
||||
child: MaterialApp.router(
|
||||
routerConfig: router,
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: const [Locale('de')],
|
||||
locale: const Locale('de'),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpWidget(buildApp());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Initially on Home tab (index 0) -- verify home empty state is shown
|
||||
@@ -56,7 +60,7 @@ void main() {
|
||||
await tester.tap(find.text('R\u00e4ume'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Verify we see Rooms content now
|
||||
// Verify we see Rooms content now (empty state)
|
||||
expect(find.text('Hier ist noch alles leer!'), findsOneWidget);
|
||||
|
||||
// Tap the Settings tab (third destination)
|
||||
|
||||
Reference in New Issue
Block a user