fix(nav): inventory is a spoke off the home hub — back arrow, no duplicate drawer
The inventory screen carried its own const AppDrawer() (no marketEnabled), so opening the menu from inventory greyed out market/chat/profile — the recurring 'phase 1' look. It was also reached via go() (route replace), which is why it showed a hamburger instead of a back arrow like the market. Make it coherent with the market: reach inventory via push() (from the home card and the drawer), and drop its drawer so the AppBar shows a back arrow returning to the home hub. The drawer now lives only on the home screen, which always passes marketEnabled — the wrong-drawer bug class is gone. Update the home_screen test to assert the spoke has a back arrow and no hamburger.
This commit is contained in:
parent
2e2265c0c1
commit
e852b569ce
4 changed files with 8 additions and 10 deletions
|
|
@ -31,7 +31,7 @@ class AppDrawer extends StatelessWidget {
|
||||||
label: t.menu.inventory,
|
label: t.menu.inventory,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.go('/inventory');
|
context.push('/inventory');
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
_DrawerItem(
|
_DrawerItem(
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ class HomeScreen extends StatelessWidget {
|
||||||
icon: Icons.inventory_2_outlined,
|
icon: Icons.inventory_2_outlined,
|
||||||
label: t.home.yourInventory,
|
label: t.home.yourInventory,
|
||||||
subtitle: t.home.yourInventorySubtitle,
|
subtitle: t.home.yourInventorySubtitle,
|
||||||
onTap: () => context.go('/inventory'),
|
onTap: () => context.push('/inventory'),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
_OutlinedMenuCard(
|
_OutlinedMenuCard(
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import '../domain/seed_viability.dart';
|
||||||
import '../i18n/strings.g.dart';
|
import '../i18n/strings.g.dart';
|
||||||
import '../services/share_catalog_service.dart';
|
import '../services/share_catalog_service.dart';
|
||||||
import '../state/inventory_cubit.dart';
|
import '../state/inventory_cubit.dart';
|
||||||
import 'app_drawer.dart';
|
|
||||||
import 'draft_triage.dart';
|
import 'draft_triage.dart';
|
||||||
import 'quantity_kind_l10n.dart';
|
import 'quantity_kind_l10n.dart';
|
||||||
import 'quantity_picker.dart';
|
import 'quantity_picker.dart';
|
||||||
|
|
@ -50,7 +49,6 @@ class InventoryListScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
drawer: const AppDrawer(),
|
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
key: const Key('inventory.addFab'),
|
key: const Key('inventory.addFab'),
|
||||||
tooltip: t.quickAdd.title,
|
tooltip: t.quickAdd.title,
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,8 @@ void main() {
|
||||||
await disposeTree(tester);
|
await disposeTree(tester);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('drawer header returns to home', (tester) async {
|
testWidgets('inventory is a spoke: back arrow, no drawer, returns to home',
|
||||||
|
(tester) async {
|
||||||
LocaleSettings.setLocaleSync(AppLocale.en);
|
LocaleSettings.setLocaleSync(AppLocale.en);
|
||||||
final db = newTestDatabase();
|
final db = newTestDatabase();
|
||||||
addTearDown(db.close);
|
addTearDown(db.close);
|
||||||
|
|
@ -67,15 +68,14 @@ void main() {
|
||||||
await tester.pumpWidget(app(db));
|
await tester.pumpWidget(app(db));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
// Navigate away from home first.
|
// Push into inventory off the home hub.
|
||||||
await tester.tap(find.byKey(const Key('home.inventory')));
|
await tester.tap(find.byKey(const Key('home.inventory')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(find.text('No seeds yet. Tap + to add your first.'), findsOneWidget);
|
expect(find.text('No seeds yet. Tap + to add your first.'), findsOneWidget);
|
||||||
|
|
||||||
// Open the drawer and tap the Tanemaki brand header.
|
// The spoke shows a back arrow, not a hamburger — coherent with the market.
|
||||||
await tester.tap(find.byIcon(Icons.menu));
|
expect(find.byIcon(Icons.menu), findsNothing);
|
||||||
await tester.pumpAndSettle();
|
await tester.tap(find.byType(BackButton));
|
||||||
await tester.tap(find.text('Tanemaki'));
|
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
// Back on the home menu.
|
// Back on the home menu.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue