Shell: on wide windows the tabs stay under the list column even with no item open

This commit is contained in:
2026-11-03 14:04:08 +00:00
parent 251cc4f274
commit 4149c57d70
3 changed files with 30 additions and 8 deletions
+3 -1
View File
@@ -166,7 +166,9 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
final bar = ListenableBuilder(
listenable: Listenable.merge([_bar.badges, _bar.bar, _paneWidths]),
builder: (context, _) {
final split = _bar.split(_selected);
// On a wide window the bar stays under the list column even when no
// item is open (Search, a list alone), so it never jumps sides.
final split = _bar.split(_selected) || showsListBesideDetail(context);
return ListPaneWidth(
split: split,
preferredWidth: _paneWidths.widthFor(_selected.name),
+20 -5
View File
@@ -1,12 +1,13 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
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/ui/adaptive/floating_destination_bar.dart';
/// The shell's one floating glass tab bar: full width on a phone, sized to its
/// tabs at the right edge on a wide window, with content behind it.
/// tabs at the right edge on a phone and under the list column on a wide window, with content behind it.
void main() {
Finder pill() => find.descendant(
of: find.byType(FloatingDestinationBar),
@@ -68,13 +69,21 @@ void main() {
expect(find.text('Chat — Not implemented'), findsOneWidget);
});
testWidgets('$host: wide bar hugs its tabs at the right edge, content '
testWidgets('$host: wide bar hugs its tabs under the list column, content '
'keeps the width and taps beside the bar reach it', (tester) async {
taps = 0;
await setSize(tester, const Size(1200, 800));
await tester.pumpWidget(shell(cupertino: cupertino));
final rect = tester.getRect(pill());
expect(rect.right, 1200 - 16);
// With no item open the bar still sits under the list column, where it
// sits beside an open item, so it never jumps sides.
expect(
rect.center.dx,
moreOrLessEquals(
listDetailListWidth(1200, 1200, null) / 2,
epsilon: 0.5,
),
);
expect(rect.bottom, 800 - 16);
expect(rect.width, lessThan(1200 * 0.6));
// Four icon-only tabs, with the wider neighbour gaps derived by the bar.
@@ -87,7 +96,7 @@ void main() {
expect(find.byType(CupertinoListTile), findsNothing);
expect(tester.getRect(find.byKey(const Key('content'))).left, 0);
// Beside the bar, at the bar's height, the content takes the tap.
await tester.tapAt(Offset(rect.left - 40, rect.center.dy));
await tester.tapAt(Offset(rect.right + 40, rect.center.dy));
await tester.pump();
expect(taps, 1);
// On the bar, the tab takes it.
@@ -126,7 +135,13 @@ void main() {
tester.view.physicalSize = const Size(1200, 800);
await tester.pump();
expect(tester.getRect(pill()).right, 1200 - 16);
expect(
tester.getRect(pill()).center.dx,
moreOrLessEquals(
listDetailListWidth(1200, 1200, null) / 2,
epsilon: 0.5,
),
);
expect(tester.getRect(pill()).width, lessThan(1200 * 0.6));
expect(tester.state(find.byType(StatefulBuilder)), same(state));
@@ -211,14 +211,19 @@ void main() {
expect(pill.right, lessThanOrEqualTo(list.right - kFloatingBarMargin));
});
testWidgets('$host 1200 unsplit: the bar is compact at the right edge', (
testWidgets('$host 1200 unsplit: the bar stays under the list column', (
tester,
) async {
await setSize(tester, const Size(1200, 800));
await tester.pumpWidget(shell(cupertino: cupertino, split: false));
await tester.pump();
final pill = destinationPill(tester);
expect(pill.right, closeTo(1200 - kFloatingBarMargin, 0.5));
// Same place as beside an open item (Search has no split), so opening
// or closing an item never moves the bar across the window.
expect(
pill.center.dx,
closeTo(listDetailListWidth(1200, 1200, null) / 2, 0.5),
);
expect(pill.width, lessThan(1200 * 0.6));
});