Align wide desktop tabs to leading edge

This commit is contained in:
2026-11-07 22:14:42 +00:00
parent 6a3daccd6d
commit 4e2b9800e8
5 changed files with 45 additions and 41 deletions
+7 -14
View File
@@ -6,9 +6,11 @@ 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';
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 centered under the list on a wide window.
/// the trailing edge on a phone and the leading edge under the list on a wide
/// window.
void main() {
Finder pill() => find.descendant(
of: find.byType(FloatingDestinationBar),
@@ -110,7 +112,7 @@ void main() {
expect(find.text('Chat — Not implemented'), findsOneWidget);
});
testWidgets('$host: wide bar hugs its tabs under the list column, content '
testWidgets('$host: wide leading bar under the list, content '
'keeps the width and taps beside the bar reach it', (tester) async {
taps = 0;
await setSize(tester, const Size(1200, 800));
@@ -118,13 +120,7 @@ void main() {
final rect = tester.getRect(pill());
// 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.left, moreOrLessEquals(kFloatingBarMargin, epsilon: 0.5));
expect(rect.bottom, 800 - 16);
expect(rect.width, lessThan(1200 * 0.6));
// Captions participate in the bar's content-driven width.
@@ -179,11 +175,8 @@ void main() {
tester.view.physicalSize = const Size(1200, 800);
await tester.pump();
expect(
tester.getRect(pill()).center.dx,
moreOrLessEquals(
listDetailListWidth(1200, 1200, null) / 2,
epsilon: 0.5,
),
tester.getRect(pill()).left,
moreOrLessEquals(kFloatingBarMargin, epsilon: 0.5),
);
expect(tester.getRect(pill()).width, lessThan(1200 * 0.6));
expect(tester.state(find.byType(StatefulBuilder)), same(state));
+23 -19
View File
@@ -9,8 +9,8 @@ import 'package:pipelines_app/ui/adaptive/floating_bar_layout.dart';
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
/// While a tab shows its list beside an open item, the shell's destination
/// bar moves to the bottom of the list pane, centred in the list's (dragged)
/// width. The list clears the bar; the item keeps its whole height, its own
/// bar moves to the leading edge at the bottom of the list pane, including
/// after the list's width is dragged. The list clears the bar; the item keeps its whole height, its own
/// bottom control (its tabs, or a composer) at its bottom edge.
void main() {
Future<void> setSize(WidgetTester tester, Size size) async {
@@ -128,8 +128,8 @@ void main() {
find.byKey(const ValueKey('list-detail-body')),
);
final pill = destinationPill(tester);
// Centred at the bottom of the list pane, never over the detail.
expect(pill.center.dx, closeTo(list.center.dx, 0.5));
// Leading at the bottom of the list pane, never over the detail.
expect(pill.left, closeTo(list.left + kFloatingBarMargin, 0.5));
expect(pill.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
expect(pill.right, lessThanOrEqualTo(list.right));
expect(pill.overlaps(body), isFalse, reason: 'never over the detail');
@@ -227,17 +227,24 @@ void main() {
tester,
) async {
await setSize(tester, const Size(1200, 800));
final store = MemoryListPaneWidthStore({'chat': 300});
await tester.pumpWidget(shell(cupertino: cupertino, store: store));
await tester.pumpAndSettle();
final list = tester.getRect(
find.byKey(const ValueKey('list-detail-list')),
);
expect(list.width, closeTo(300, 0.5));
final pill = destinationPill(tester);
expect(pill.center.dx, closeTo(list.center.dx, 0.5));
expect(pill.left, greaterThanOrEqualTo(kFloatingBarMargin - 0.5));
expect(pill.right, lessThanOrEqualTo(list.right - kFloatingBarMargin));
for (final width in [300.0, 520.0]) {
final store = MemoryListPaneWidthStore({'chat': width});
await tester.pumpWidget(
KeyedSubtree(
key: ValueKey(width),
child: shell(cupertino: cupertino, store: store),
),
);
await tester.pumpAndSettle();
final list = tester.getRect(
find.byKey(const ValueKey('list-detail-list')),
);
expect(list.width, closeTo(width, 0.5));
final pill = destinationPill(tester);
expect(pill.left, closeTo(list.left + kFloatingBarMargin, 0.5));
expect(pill.left, greaterThanOrEqualTo(kFloatingBarMargin - 0.5));
expect(pill.right, lessThanOrEqualTo(list.right - kFloatingBarMargin));
}
});
testWidgets('$host 1200 Settings: a page without a list keeps the bar '
@@ -260,10 +267,7 @@ void main() {
final pill = destinationPill(tester);
// 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.left, closeTo(kFloatingBarMargin, 0.5));
expect(pill.width, lessThan(1200 * 0.6));
});