Add desktop navigation rail with Settings
Replace wide-layout floating destination controls with a full-height Material navigation rail, keeping badges and existing navigation behavior. Pin Settings to the rail and preserve the phone layout and pane/window clearance.
This commit is contained in:
@@ -50,7 +50,7 @@ Future<void> _pumpShell(WidgetTester tester, Size size) async {
|
||||
|
||||
void main() {
|
||||
for (final size in [const Size(1280, 800), const Size(800, 830)]) {
|
||||
testWidgets('a wide window keeps the tab bar and list beside the open chat '
|
||||
testWidgets('a wide window keeps the rail and list beside the open chat '
|
||||
'at $size', (tester) async {
|
||||
await _pumpShell(tester, size);
|
||||
expect(
|
||||
@@ -68,8 +68,10 @@ void main() {
|
||||
find.byType(Navigator).first,
|
||||
);
|
||||
expect(navigator.canPop(), isFalse, reason: 'No page covers the shell');
|
||||
expect(find.byType(NavigationRail), findsNothing);
|
||||
expect(find.byType(FloatingDestinationBar), findsOneWidget);
|
||||
// Both sizes are wide enough for the rail (the shell's own bar and list
|
||||
// beside the open chat sit to its right).
|
||||
expect(find.byType(NavigationRail), findsOneWidget);
|
||||
expect(find.byType(FloatingDestinationBar), findsNothing);
|
||||
expect(find.byKey(const ValueKey('chat-thread-a')), findsOneWidget);
|
||||
expect(find.text('Second chat'), findsOneWidget);
|
||||
expect(
|
||||
|
||||
@@ -11,7 +11,7 @@ void main() {
|
||||
testWidgets('chat list stays above labeled navigation ($scale)', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(1200, 900);
|
||||
tester.view.physicalSize = const Size(640, 900);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
tester.platformDispatcher.textScaleFactorTestValue = scale;
|
||||
addTearDown(tester.view.reset);
|
||||
@@ -87,7 +87,13 @@ void main() {
|
||||
),
|
||||
same(scrollable),
|
||||
);
|
||||
expect(scrollable.position.pixels, closeTo(retainedOffset, .5));
|
||||
// The list is narrower at 640 (no rail) than beside the rail, so its
|
||||
// rows re-wrap into a shorter scroll extent: the offset is kept up to
|
||||
// that extent, and no further.
|
||||
final kept = retainedOffset < scrollable.position.maxScrollExtent
|
||||
? retainedOffset
|
||||
: scrollable.position.maxScrollExtent;
|
||||
expect(scrollable.position.pixels, closeTo(kept, .5));
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -106,7 +106,16 @@ void main() {
|
||||
expect(find.text('Menu'), findsOneWidget);
|
||||
await tester.tap(find.text('Menu'));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Runs'));
|
||||
// The menu's own row: the rail labels Runs too, so take the text that
|
||||
// is not in the rail.
|
||||
await tester.tap(
|
||||
find.byElementPredicate(
|
||||
(element) =>
|
||||
element.widget is Text &&
|
||||
(element.widget as Text).data == 'Runs' &&
|
||||
element.findAncestorWidgetOfExactType<NavigationRail>() == null,
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Runs destination'), findsOneWidget);
|
||||
await tester.tap(find.byTooltip('Chat'));
|
||||
|
||||
Reference in New Issue
Block a user