Skip to content

Commit 01512ce

Browse files
committed
fix(dashboard): route gear chips to /equipment instead of /gear
The dashboard gauge strip and urgent banner navigated to `/gear`, which is not a registered route (the gear/equipment section lives at `/equipment`). Tapping "Add gear", a gear service chip, or the urgent banner therefore threw `GoException: no routes for location: /gear` and showed the "Page Not Found" screen. - Add-gear chip now pushes `/equipment/new` (opens the add form directly, matching how gear is added elsewhere). - Gear service chips and the overdue-service urgent banner now go to the `/equipment` list. The widget tests defined their own stub `/gear` route, so they passed against a path the real app router never had. Updated the stubs and assertions to the real `/equipment` routes so they now guard against a regression.
1 parent a66edc5 commit 01512ce

5 files changed

Lines changed: 21 additions & 11 deletions

File tree

lib/features/dashboard/presentation/widgets/gauge_strip.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class GaugeStrip extends ConsumerWidget {
6565
icon: Icons.add,
6666
label: l10n.dashboard_gauges_addGear,
6767
tone: _Tone.neutral,
68-
onTap: () => context.go('/gear'),
68+
onTap: () => context.push('/equipment/new'),
6969
),
7070
);
7171
} else {
@@ -93,7 +93,7 @@ class GaugeStrip extends ConsumerWidget {
9393
icon: Icons.build_outlined,
9494
label: label,
9595
tone: tone,
96-
onTap: () => context.go('/gear'),
96+
onTap: () => context.go('/equipment'),
9797
),
9898
);
9999
}

lib/features/dashboard/presentation/widgets/urgent_banner.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class UrgentBanner extends ConsumerWidget {
4040
// Send the tap where the listed problem is fixed: gear service when
4141
// any clock is overdue, otherwise the insurance record.
4242
final destination = overdue.isNotEmpty
43-
? '/gear'
43+
? '/equipment'
4444
: '/settings/diver-profile/insurance';
4545
return Card(
4646
margin: EdgeInsets.zero,

test/features/dashboard/presentation/pages/dashboard_page_test.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ Future<void> pumpDashboard(
4848
routes: [
4949
GoRoute(path: '/', builder: (_, _) => const DashboardPage()),
5050
GoRoute(path: '/dives', builder: (_, _) => const Scaffold()),
51-
GoRoute(path: '/gear', builder: (_, _) => const Scaffold()),
51+
GoRoute(
52+
path: '/equipment',
53+
builder: (_, _) => const Scaffold(),
54+
routes: [GoRoute(path: 'new', builder: (_, _) => const Scaffold())],
55+
),
5256
],
5357
);
5458
await tester.pumpWidget(

test/features/dashboard/presentation/widgets/gauge_strip_test.dart

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ Future<NavSpy> pumpStrip(
5555
path: '/',
5656
builder: (_, _) => const Scaffold(body: GaugeStrip()),
5757
),
58-
GoRoute(path: '/gear', builder: (_, _) => stub('/gear')),
58+
GoRoute(
59+
path: '/equipment',
60+
builder: (_, _) => stub('/equipment'),
61+
routes: [
62+
GoRoute(path: 'new', builder: (_, _) => stub('/equipment/new')),
63+
],
64+
),
5965
GoRoute(
6066
path: '/certifications',
6167
builder: (_, _) => stub('/certifications'),
@@ -191,7 +197,7 @@ void main() {
191197
);
192198
expect(find.text('Add gear'), findsOneWidget);
193199
await tapChip(tester, 'Add gear');
194-
expect(spy.location, '/gear');
200+
expect(spy.location, '/equipment/new');
195201
});
196202

197203
testWidgets('overdue, due-soon and ok gear render their own labels', (
@@ -232,7 +238,7 @@ void main() {
232238
expect(find.text('Add gear'), findsNothing);
233239

234240
await tapChip(tester, 'Regulator overdue');
235-
expect(spy.location, '/gear');
241+
expect(spy.location, '/equipment');
236242
});
237243

238244
testWidgets('due-soon clock without a due date falls back to 0 days', (

test/features/dashboard/presentation/widgets/urgent_banner_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Future<NavSpy> pumpBanner(WidgetTester tester, DashboardAlerts alerts) async {
5959
path: '/',
6060
builder: (_, _) => const Scaffold(body: UrgentBanner()),
6161
),
62-
GoRoute(path: '/gear', builder: (_, _) => stub('/gear')),
62+
GoRoute(path: '/equipment', builder: (_, _) => stub('/equipment')),
6363
GoRoute(
6464
path: '/settings/diver-profile/insurance',
6565
builder: (_, _) => stub('/settings/diver-profile/insurance'),
@@ -130,7 +130,7 @@ void main() {
130130

131131
await tester.tap(find.byType(InkWell));
132132
await tester.pumpAndSettle();
133-
expect(spy.location, '/gear');
133+
expect(spy.location, '/equipment');
134134
});
135135

136136
testWidgets('caps overdue lines and shows a "+N more" overflow', (
@@ -157,7 +157,7 @@ void main() {
157157
// Tap still opens the gear list.
158158
await tester.tap(find.byType(InkWell));
159159
await tester.pumpAndSettle();
160-
expect(spy.location, '/gear');
160+
expect(spy.location, '/equipment');
161161
});
162162

163163
testWidgets('expired insurance alone navigates to the insurance record', (
@@ -197,6 +197,6 @@ void main() {
197197

198198
await tester.tap(find.byType(InkWell));
199199
await tester.pumpAndSettle();
200-
expect(spy.location, '/gear');
200+
expect(spy.location, '/equipment');
201201
});
202202
}

0 commit comments

Comments
 (0)