Add phone bottom navigation bar

Replace the narrow-layout floating destination pill with a full-width Material 3 NavigationBar. Reuse the shell destination model and badge wiring while preserving re-selection callbacks and hiding the bar for keyboard/detail states.
This commit is contained in:
2026-11-12 02:51:01 +00:00
parent 9bb87e5118
commit aabd22b5ad
12 changed files with 467 additions and 126 deletions
+12 -12
View File
@@ -46,9 +46,9 @@ void main() {
return provider;
}
int selectedTab(WidgetTester tester) => tester
.widget<FloatingDestinationBar>(find.byType(FloatingDestinationBar))
.currentIndex;
// The phone's bar marks the destination shown: Settings while it is open.
int selectedTab(WidgetTester tester) =>
tester.widget<NavigationBar>(find.byType(NavigationBar)).selectedIndex;
// A phone's Pipelines bar keeps the gear; a wide window's rail offers
// Settings instead (see the wide test below).
@@ -60,17 +60,17 @@ void main() {
location: '/pipelines',
size: size,
);
// Four tabs; Settings is none of them.
// Four tabs and Settings as the bar's last destination.
expect(
tester
.widget<FloatingDestinationBar>(find.byType(FloatingDestinationBar))
.items
.map((item) => item.label),
['Pipelines', 'Runs', 'Chat', 'Search'],
.widget<NavigationBar>(find.byType(NavigationBar))
.destinations
.map((item) => (item as NavigationDestination).label),
['Pipelines', 'Runs', 'Chat', 'Search', 'Settings'],
);
expect(
find.byKey(const ValueKey('shell.destination.settings')),
findsNothing,
findsOneWidget,
);
expect(find.byKey(const ValueKey('shell.back')), findsNothing);
@@ -86,10 +86,10 @@ void main() {
expect(find.text('Quick switch animation'), findsOneWidget);
await selectSettingsTopic(tester, 'Connection');
expect(find.text('Server URL'), findsOneWidget);
// A page of Pipelines: Back in its bar, Pipelines still selected.
// A page of Pipelines: Back in its bar, Settings selected in the bar.
expect(find.byKey(const ValueKey('shell.back')), findsOneWidget);
expect(find.byKey(const ValueKey('shell.search')), findsNothing);
expect(selectedTab(tester), 0);
expect(selectedTab(tester), 4);
expect(tester.takeException(), isNull);
await tester.tap(find.byKey(const ValueKey('shell.back')));
@@ -164,7 +164,7 @@ void main() {
await tester.pump();
expect(find.byType(SettingsScreen), findsOneWidget);
expect(find.byKey(const ValueKey('shell.back')), findsOneWidget);
expect(selectedTab(tester), 0);
expect(selectedTab(tester), 4);
final handled = await tester.binding.handlePopRoute();
expect(handled, isTrue, reason: 'Back closes the page, not the app');