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));