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:
@@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/shell/adaptive_shell.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
|
||||
|
||||
/// The Runs tab keeps running work visible without an error counter.
|
||||
void main() {
|
||||
@@ -23,9 +22,9 @@ void main() {
|
||||
|
||||
for (final width in [390.0, 1000.0]) {
|
||||
final mount = width < 600 ? 'bottom bar' : 'rail';
|
||||
// The rail (wide) or the floating bar (phone) carries the same counts.
|
||||
// The rail (wide) or the phone's navigation bar carries the same counts.
|
||||
final navigation = width < 600
|
||||
? find.byType(FloatingDestinationBar)
|
||||
? find.byType(NavigationBar)
|
||||
: find.byType(NavigationRail);
|
||||
|
||||
testWidgets('$mount shows the count on the Runs tab', (tester) async {
|
||||
|
||||
@@ -3,13 +3,14 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/shell/list_detail_policy.dart';
|
||||
import 'package:pipelines_app/shell/adaptive_shell.dart';
|
||||
import 'package:pipelines_app/shell/destination.dart';
|
||||
import 'package:pipelines_app/shell/shell_navigation_bar.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/floating_destination_labels.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/floating_bar_layout.dart';
|
||||
|
||||
/// Main navigation keeps visible captions and full-size targets, floating at
|
||||
/// the trailing edge on a phone and the leading edge under the list on a wide
|
||||
/// window.
|
||||
/// Main navigation keeps visible captions and full-size targets: a full-width
|
||||
/// navigation bar on a phone, and on a wide window a floating bar at the
|
||||
/// leading edge under the list.
|
||||
void main() {
|
||||
Finder pill() => find.descendant(
|
||||
of: find.byType(FloatingDestinationBar),
|
||||
@@ -87,19 +88,18 @@ void main() {
|
||||
return MaterialApp(home: app);
|
||||
}
|
||||
|
||||
testWidgets('phone bar hugs its tabs at the bottom right too, and '
|
||||
'taps beside it reach the content', (tester) async {
|
||||
testWidgets('a phone shows a full-width navigation bar, and taps above it '
|
||||
'reach the content', (tester) async {
|
||||
taps = 0;
|
||||
await setSize(tester, const Size(390, 844));
|
||||
await tester.pumpWidget(shell());
|
||||
final rect = tester.getRect(pill());
|
||||
await expectLabeledTargets(tester, rect);
|
||||
await expectNoSharedBackdrop(tester);
|
||||
expect(rect.width, lessThanOrEqualTo(390 - 2 * 16));
|
||||
expect(rect.right, 390 - 16);
|
||||
expect(rect.bottom, 844 - 16);
|
||||
await tester.pumpAndSettle();
|
||||
final bar = tester.getRect(find.byType(NavigationBar));
|
||||
expect(bar.left, 0);
|
||||
expect(bar.right, 390);
|
||||
expect(find.byType(FloatingDestinationBar), findsNothing);
|
||||
expect(find.byType(NavigationRail), findsNothing);
|
||||
await tester.tapAt(Offset(rect.left - 40, rect.center.dy));
|
||||
await tester.tapAt(Offset(195, bar.top - 40));
|
||||
await tester.pump();
|
||||
expect(taps, 1);
|
||||
await tester.tap(find.byKey(const ValueKey('shell.destination.chat')));
|
||||
@@ -146,7 +146,9 @@ void main() {
|
||||
await setSize(tester, size);
|
||||
await tester.pumpWidget(shell());
|
||||
await tester.pump();
|
||||
final rect = tester.getRect(pill());
|
||||
final rect = size.width < 600
|
||||
? tester.getRect(find.byType(NavigationBar))
|
||||
: tester.getRect(pill());
|
||||
// The content's bottom padding clears the whole bar and its margin.
|
||||
expect(
|
||||
contentBottomPadding,
|
||||
@@ -169,6 +171,7 @@ void main() {
|
||||
|
||||
tester.view.physicalSize = const Size(640, 800);
|
||||
await tester.pump();
|
||||
expect(find.byType(NavigationBar), findsNothing);
|
||||
expect(
|
||||
tester.getRect(pill()).left,
|
||||
moreOrLessEquals(kFloatingBarMargin, epsilon: 0.5),
|
||||
@@ -178,17 +181,21 @@ void main() {
|
||||
|
||||
tester.view.physicalSize = const Size(390, 844);
|
||||
await tester.pump();
|
||||
await expectLabeledTargets(tester, tester.getRect(pill()));
|
||||
expect(tester.getRect(pill()).width, lessThanOrEqualTo(390 - 2 * 16));
|
||||
expect(tester.getRect(pill()).right, 390 - 16);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(FloatingDestinationBar), findsNothing);
|
||||
expect(tester.getRect(find.byType(NavigationBar)).width, 390);
|
||||
expect(tester.state(find.byType(StatefulBuilder)), same(state));
|
||||
});
|
||||
|
||||
testWidgets('the bar respects the bottom safe area', (tester) async {
|
||||
testWidgets('the navigation bar respects the bottom safe area', (
|
||||
tester,
|
||||
) async {
|
||||
await setSize(tester, const Size(390, 844));
|
||||
tester.view.padding = const FakeViewPadding(bottom: 34);
|
||||
await tester.pumpWidget(shell());
|
||||
expect(tester.getRect(pill()).bottom, 844 - 34);
|
||||
await tester.pumpAndSettle();
|
||||
// The bar sits above the gesture inset, its own surface ending there.
|
||||
expect(tester.getRect(find.byType(NavigationBar)).bottom, 844 - 34);
|
||||
});
|
||||
|
||||
testWidgets('the selected tab is marked selected for assistive '
|
||||
@@ -218,23 +225,25 @@ void main() {
|
||||
await tester.pumpWidget(shell());
|
||||
await tester.pumpAndSettle();
|
||||
expect(tester.takeException(), isNull);
|
||||
// Large captions wrap rather than shrinking the tap targets.
|
||||
final bounds = tester.getRect(pill());
|
||||
await expectLabeledTargets(tester, bounds);
|
||||
expect(bounds.width, lessThanOrEqualTo(320 - 2 * 16));
|
||||
for (final destination in shellTabDestinations) {
|
||||
final caption = find.descendant(
|
||||
of: find.byType(FloatingDestinationBar),
|
||||
matching: find.text(destinationDetails(destination).label),
|
||||
final bar = find.byType(NavigationBar);
|
||||
expect(tester.getRect(bar).width, 320);
|
||||
// Every destination keeps its label and a full-size target at 2x text.
|
||||
for (final destination in shellBarDestinations) {
|
||||
final label = destinationDetails(destination).label;
|
||||
final caption = find.descendant(of: bar, matching: find.text(label));
|
||||
expect(caption, findsOneWidget);
|
||||
expect(
|
||||
tester.getRect(caption).overlaps(tester.getRect(bar)),
|
||||
isTrue,
|
||||
reason: label,
|
||||
);
|
||||
final text = tester.widget<Text>(caption);
|
||||
final size = text.style!.fontSize!;
|
||||
expect(tester.getSize(caption).height, greaterThanOrEqualTo(size * 2));
|
||||
final target = tester.getSize(
|
||||
find.byType(NavigationDestination).at(
|
||||
shellBarDestinations.indexOf(destination),
|
||||
),
|
||||
);
|
||||
expect(target.width, greaterThanOrEqualTo(44), reason: label);
|
||||
expect(target.height, greaterThanOrEqualTo(44), reason: label);
|
||||
}
|
||||
expect(
|
||||
bounds.height,
|
||||
greaterThan(FloatingDestinationBar.selectedButtonSize()),
|
||||
);
|
||||
expect(tester.getRect(pill()).right, 320 - 16);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -175,23 +175,27 @@ void main() {
|
||||
expect(body.left, greaterThan(list.right));
|
||||
});
|
||||
|
||||
testWidgets('phone and narrow windows keep the floating bar and no rail', (
|
||||
testWidgets('a phone shows the navigation bar with Settings and no rail', (
|
||||
tester,
|
||||
) async {
|
||||
for (final width in [390.0, 640.0]) {
|
||||
await pumpShell(tester, width: width);
|
||||
expect(rail(), findsNothing, reason: '$width');
|
||||
expect(
|
||||
find.byKey(const ValueKey('shell.destination.settings')),
|
||||
findsNothing,
|
||||
reason: '$width',
|
||||
);
|
||||
expect(
|
||||
find.byType(FloatingDestinationBar),
|
||||
findsOneWidget,
|
||||
reason: '$width',
|
||||
);
|
||||
}
|
||||
await pumpShell(tester, width: 390);
|
||||
expect(rail(), findsNothing);
|
||||
expect(find.byType(NavigationBar), findsOneWidget);
|
||||
expect(
|
||||
find.byKey(const ValueKey('shell.destination.settings')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.byType(FloatingDestinationBar), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('a narrow window below the rail keeps the floating bar, no rail '
|
||||
'and no navigation bar', (tester) async {
|
||||
// 640 is wide enough for the list beside its open item, which keeps the
|
||||
// floating bar under the list column.
|
||||
await pumpShell(tester, width: 640);
|
||||
expect(rail(), findsNothing);
|
||||
expect(find.byType(NavigationBar), findsNothing);
|
||||
expect(find.byType(FloatingDestinationBar), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('floating windows keep to the right of the rail on a wide '
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/shell/adaptive_shell.dart';
|
||||
import 'package:pipelines_app/shell/destination.dart';
|
||||
import 'package:pipelines_app/shell/shell_bar.dart';
|
||||
import 'package:pipelines_app/shell/shell_navigation_bar.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
|
||||
|
||||
Widget _app({required bool open, VoidCallback? back}) {
|
||||
@@ -45,7 +46,7 @@ void main() {
|
||||
expect(find.byKey(const Key('run-more')), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('Search is the fourth tab; Settings is not a tab', (
|
||||
testWidgets('Search is the fourth tab; Settings is the bar\'s last item', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(390, 844);
|
||||
@@ -65,50 +66,47 @@ void main() {
|
||||
);
|
||||
expect(
|
||||
find.byKey(const ValueKey('shell.destination.settings')),
|
||||
findsNothing,
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.byKey(const ValueKey('shell.search')), findsNothing);
|
||||
expect(find.byType(FloatingDestinationBar), findsOneWidget);
|
||||
expect(find.byType(NavigationBar), findsOneWidget);
|
||||
expect(find.byType(FloatingDestinationBar), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('floating tabs stay inset and select destinations', (
|
||||
tester,
|
||||
) async {
|
||||
testWidgets('the phone bar is a full-width navigation bar that selects '
|
||||
'destinations', (tester) async {
|
||||
tester.view.physicalSize = const Size(390, 844);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
await tester.pumpWidget(_app(open: false));
|
||||
|
||||
final destinationPill = find.descendant(
|
||||
of: find.byType(FloatingDestinationBar),
|
||||
matching: find.byKey(FloatingDestinationBar.rowKey),
|
||||
);
|
||||
// Visible captions determine the width while full-size targets stay inset.
|
||||
final rect = tester.getRect(destinationPill);
|
||||
expect(rect.width, lessThanOrEqualTo(390 - 2 * 16));
|
||||
final bar = find.byType(NavigationBar);
|
||||
final rect = tester.getRect(bar);
|
||||
expect(rect.left, 0);
|
||||
expect(rect.right, 390);
|
||||
expect(rect.bottom, 844);
|
||||
expect(
|
||||
tester
|
||||
.widget<FloatingDestinationBar>(find.byType(FloatingDestinationBar))
|
||||
.showLabels,
|
||||
isTrue,
|
||||
tester.widget<NavigationBar>(bar).destinations,
|
||||
hasLength(shellBarDestinations.length),
|
||||
);
|
||||
for (final destination in shellTabDestinations) {
|
||||
final caption = find.descendant(
|
||||
of: find.byType(FloatingDestinationBar),
|
||||
matching: find.text(destinationDetails(destination).label),
|
||||
expect(tester.widget<NavigationBar>(bar).selectedIndex, 1);
|
||||
for (var index = 0; index < shellBarDestinations.length; index++) {
|
||||
final label = destinationDetails(shellBarDestinations[index]).label;
|
||||
expect(
|
||||
find.descendant(of: bar, matching: find.text(label)),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(caption, findsOneWidget);
|
||||
expect(rect.contains(tester.getRect(caption).center), isTrue);
|
||||
// Each destination's whole slot is its target, not just the icon.
|
||||
final target = tester.getSize(
|
||||
find.byKey(ValueKey('shell.destination.${destination.name}')),
|
||||
find.byType(NavigationDestination).at(index),
|
||||
);
|
||||
expect(target.width, greaterThanOrEqualTo(44));
|
||||
expect(target.height, greaterThanOrEqualTo(44));
|
||||
expect(target.width, greaterThanOrEqualTo(44), reason: label);
|
||||
expect(target.height, greaterThanOrEqualTo(44), reason: label);
|
||||
}
|
||||
expect(tester.getRect(destinationPill).right, 390 - 16);
|
||||
await tester.tap(find.byKey(const ValueKey('shell.destination.chat')));
|
||||
await tester.pump();
|
||||
expect(find.text('Chat — Not implemented'), findsOneWidget);
|
||||
expect(tester.widget<NavigationBar>(bar).selectedIndex, 2);
|
||||
});
|
||||
|
||||
testWidgets('tabs show the running and unread counts their screens publish', (
|
||||
@@ -163,7 +161,7 @@ void main() {
|
||||
),
|
||||
);
|
||||
await tester.pumpWidget(shell());
|
||||
expect(find.byType(FloatingDestinationBar), findsOneWidget);
|
||||
expect(find.byType(NavigationBar), findsOneWidget);
|
||||
final navigator = tester.state<NavigatorState>(find.byType(Navigator));
|
||||
navigator.push(
|
||||
MaterialPageRoute<void>(
|
||||
@@ -171,16 +169,13 @@ void main() {
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(FloatingDestinationBar), findsNothing);
|
||||
expect(
|
||||
find.byType(FloatingDestinationBar, skipOffstage: false),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.byType(NavigationBar), findsNothing);
|
||||
expect(find.byType(NavigationBar, skipOffstage: false), findsOneWidget);
|
||||
await navigator.maybePop();
|
||||
await tester.pump(const Duration(milliseconds: 16));
|
||||
expect(find.byType(FloatingDestinationBar), findsOneWidget);
|
||||
expect(find.byType(NavigationBar), findsOneWidget);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(FloatingDestinationBar), findsOneWidget);
|
||||
expect(find.byType(NavigationBar), findsOneWidget);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/shell/adaptive_shell.dart';
|
||||
import 'package:pipelines_app/shell/destination.dart';
|
||||
import 'package:pipelines_app/shell/shell_bar.dart';
|
||||
|
||||
/// On a phone the destinations sit in a full-width Material NavigationBar at
|
||||
/// the bottom: the four tabs and Settings, each with its icon and label, the
|
||||
/// current one marked, and the badges the rail shows.
|
||||
void main() {
|
||||
Future<void> pumpPhone(
|
||||
WidgetTester tester, {
|
||||
AppDestination destination = AppDestination.pipelines,
|
||||
Map<AppDestination, WidgetBuilder> bodies = const {},
|
||||
int runningRunCount = 0,
|
||||
ValueChanged<AppDestination>? onDestinationSelected,
|
||||
}) async {
|
||||
tester.view.physicalSize = const Size(390, 844);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: AdaptiveShell(
|
||||
destination: destination,
|
||||
runningRunCount: runningRunCount,
|
||||
onDestinationSelected: onDestinationSelected,
|
||||
destinationBodies: bodies,
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
Finder bar() => find.byType(NavigationBar);
|
||||
|
||||
Finder inBar(Finder finder) => find.descendant(of: bar(), matching: finder);
|
||||
|
||||
testWidgets('the bar offers the tabs and Settings, in order, with an icon and '
|
||||
'a label each', (tester) async {
|
||||
await pumpPhone(tester);
|
||||
|
||||
expect(bar(), findsOneWidget);
|
||||
final labels = tester
|
||||
.widget<NavigationBar>(bar())
|
||||
.destinations
|
||||
.map((item) => (item as NavigationDestination).label);
|
||||
expect(labels, ['Pipelines', 'Runs', 'Chat', 'Search', 'Settings']);
|
||||
for (final destination in AppDestination.values) {
|
||||
expect(
|
||||
inBar(
|
||||
find.byKey(ValueKey('shell.destination.${destination.name}')),
|
||||
),
|
||||
findsOneWidget,
|
||||
reason: destination.name,
|
||||
);
|
||||
expect(
|
||||
inBar(find.byIcon(destinationDetails(destination).icon)),
|
||||
findsOneWidget,
|
||||
reason: destination.name,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
testWidgets('the selected indicator follows the shown destination, Settings '
|
||||
'included', (tester) async {
|
||||
await pumpPhone(tester, destination: AppDestination.runs);
|
||||
expect(tester.widget<NavigationBar>(bar()).selectedIndex, 1);
|
||||
|
||||
await pumpPhone(tester, destination: AppDestination.settings);
|
||||
expect(tester.widget<NavigationBar>(bar()).selectedIndex, 4);
|
||||
});
|
||||
|
||||
testWidgets('a tap shows its destination, and a re-tap of the shown one '
|
||||
'still reports it to the shell', (tester) async {
|
||||
final selected = <AppDestination>[];
|
||||
await pumpPhone(
|
||||
tester,
|
||||
destination: AppDestination.runs,
|
||||
bodies: {
|
||||
AppDestination.runs: (_) => const Text('runs body'),
|
||||
AppDestination.pipelines: (_) => const Text('pipelines body'),
|
||||
},
|
||||
onDestinationSelected: selected.add,
|
||||
);
|
||||
|
||||
await tester.tap(find.byKey(const ValueKey('shell.destination.runs')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(selected, [AppDestination.runs]);
|
||||
|
||||
await tester.tap(find.byKey(const ValueKey('shell.destination.pipelines')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(selected, [AppDestination.runs, AppDestination.pipelines]);
|
||||
});
|
||||
|
||||
testWidgets('without a parent route a tap shows the destination itself', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpPhone(
|
||||
tester,
|
||||
bodies: {
|
||||
AppDestination.pipelines: (_) => const Text('pipelines body'),
|
||||
AppDestination.search: (_) => const Text('search body'),
|
||||
},
|
||||
);
|
||||
expect(find.text('pipelines body'), findsOneWidget);
|
||||
|
||||
await tester.tap(find.byKey(const ValueKey('shell.destination.search')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('search body'), findsOneWidget);
|
||||
expect(tester.widget<NavigationBar>(bar()).selectedIndex, 3);
|
||||
});
|
||||
|
||||
testWidgets('the running count sits on Runs and the unread count on Chat in '
|
||||
'the bar', (tester) async {
|
||||
await pumpPhone(
|
||||
tester,
|
||||
destination: AppDestination.chat,
|
||||
runningRunCount: 3,
|
||||
bodies: {
|
||||
AppDestination.chat: (_) => const ShellBadge(
|
||||
kind: ShellBadgeKind.unread,
|
||||
count: 2,
|
||||
child: Text('chat body'),
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
final running = find.byKey(const ValueKey('shell.badge.runs.running'));
|
||||
expect(
|
||||
find.descendant(of: running, matching: find.text('3')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const ValueKey('shell.destination.runs')),
|
||||
matching: running,
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
final unread = find.byKey(const ValueKey('shell.badge.chat.unread'));
|
||||
expect(
|
||||
find.descendant(of: unread, matching: find.text('2')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const ValueKey('shell.destination.chat')),
|
||||
matching: unread,
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('the bar leaves while the keyboard is open and returns after it', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpPhone(tester);
|
||||
expect(bar(), findsOneWidget);
|
||||
|
||||
tester.view.viewInsets = const FakeViewPadding(bottom: 300);
|
||||
await tester.pump();
|
||||
expect(bar(), findsNothing);
|
||||
|
||||
tester.view.resetViewInsets();
|
||||
await tester.pumpAndSettle();
|
||||
expect(bar(), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a screen that hides navigation takes the bar away and gives it '
|
||||
'back when it closes', (tester) async {
|
||||
var open = true;
|
||||
late StateSetter setOuter;
|
||||
await pumpPhone(
|
||||
tester,
|
||||
destination: AppDestination.runs,
|
||||
bodies: {
|
||||
AppDestination.runs: (_) => StatefulBuilder(
|
||||
builder: (context, setState) {
|
||||
setOuter = setState;
|
||||
return open
|
||||
? const ShellBar(
|
||||
hideNavigation: true,
|
||||
child: Text('workspace'),
|
||||
)
|
||||
: const Text('list');
|
||||
},
|
||||
),
|
||||
},
|
||||
);
|
||||
expect(bar(), findsNothing);
|
||||
|
||||
setOuter(() => open = false);
|
||||
await tester.pumpAndSettle();
|
||||
expect(bar(), findsOneWidget);
|
||||
});
|
||||
}
|
||||
@@ -258,24 +258,26 @@ void main() {
|
||||
expect(pill.width, lessThan(640 * 0.6));
|
||||
});
|
||||
|
||||
testWidgets('390: the bar hugs its tabs at the phone\'s bottom '
|
||||
'right', (tester) async {
|
||||
testWidgets('390: a phone shows the full-width navigation bar at the bottom, '
|
||||
'with no floating pill', (tester) async {
|
||||
await setSize(tester, const Size(390, 844));
|
||||
await tester.pumpWidget(shell(split: false));
|
||||
await tester.pump();
|
||||
final pill = destinationPill(tester);
|
||||
expect(pill.width, lessThanOrEqualTo(390 - 2 * kFloatingBarMargin));
|
||||
final bar = find.byType(NavigationBar);
|
||||
final rect = tester.getRect(bar);
|
||||
expect(rect.left, 0);
|
||||
expect(rect.right, 390);
|
||||
expect(rect.bottom, 844);
|
||||
expect(find.byType(FloatingDestinationBar), findsNothing);
|
||||
for (final destination in shellTabDestinations) {
|
||||
expect(
|
||||
find.byKey(
|
||||
ValueKey(
|
||||
'destination-label-${destinationDetails(destination).label}',
|
||||
),
|
||||
find.descendant(
|
||||
of: bar,
|
||||
matching: find.text(destinationDetails(destination).label),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
}
|
||||
expect(pill.right, closeTo(390 - kFloatingBarMargin, 0.5));
|
||||
});
|
||||
|
||||
for (final width in [600.0, 640.0]) {
|
||||
|
||||
Reference in New Issue
Block a user