From cd034db77a868b79c39dac5e1c61927e7ef87fb2 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Sat, 7 Nov 2026 22:01:40 +0000 Subject: [PATCH 1/3] Remove shared backdrop from main tab labels --- .../ui/adaptive/floating_destination_bar.dart | 1 - .../adaptive/floating_destination_labels.dart | 76 ++++++++----------- app/notes/main-tab-label-backdrop.md | 8 ++ app/test/shell/floating_tab_bar_test.dart | 19 +++++ 4 files changed, 58 insertions(+), 46 deletions(-) create mode 100644 app/notes/main-tab-label-backdrop.md diff --git a/app/lib/ui/adaptive/floating_destination_bar.dart b/app/lib/ui/adaptive/floating_destination_bar.dart index a9bf07c4..8f7815ac 100644 --- a/app/lib/ui/adaptive/floating_destination_bar.dart +++ b/app/lib/ui/adaptive/floating_destination_bar.dart @@ -208,7 +208,6 @@ class _FloatingDestinationBarState extends State selected: currentIndex, buttonBuilder: (index) => _button(context, index), onTap: widget.onTap, - backdrop: _backdrop, ); } final gap = _gap(width); diff --git a/app/lib/ui/adaptive/floating_destination_labels.dart b/app/lib/ui/adaptive/floating_destination_labels.dart index 92caa3c4..7196927e 100644 --- a/app/lib/ui/adaptive/floating_destination_labels.dart +++ b/app/lib/ui/adaptive/floating_destination_labels.dart @@ -12,23 +12,18 @@ class FloatingDestinationLabels extends StatelessWidget { required this.selected, required this.buttonBuilder, required this.onTap, - required this.backdrop, }); final bool cupertino; final List labels; final int selected; final Widget Function(int) buttonBuilder; final ValueChanged onTap; - final BackdropKey backdrop; @override Widget build(BuildContext context) { final color = cupertino ? CupertinoColors.label.resolveFrom(context) : Theme.of(context).colorScheme.onSurface; - final surface = cupertino - ? CupertinoColors.secondarySystemBackground.resolveFrom(context) - : Theme.of(context).colorScheme.surfaceContainer; final style = cupertino ? CupertinoTheme.of(context).textTheme.tabLabelTextStyle : Theme.of(context).textTheme.labelSmall!; @@ -36,49 +31,40 @@ class FloatingDestinationLabels extends StatelessWidget { role: SemanticsRole.tabBar, container: true, explicitChildNodes: true, - child: DecoratedBox( - decoration: BoxDecoration( - color: surface, - borderRadius: BorderRadius.circular(16), - ), - child: Padding( - padding: const EdgeInsets.all(8), - child: BackdropGroup( - backdropKey: backdrop, - child: Wrap( - alignment: WrapAlignment.center, - crossAxisAlignment: WrapCrossAlignment.center, - spacing: 8, - runSpacing: 8, - children: [ - for (var index = 0; index < labels.length; index++) - GestureDetector( - key: ValueKey('destination-label-${labels[index]}'), - excludeFromSemantics: true, - onTap: () => onTap(index), - child: TextFieldTapRegion( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - buttonBuilder(index), - ExcludeSemantics( - child: Text( - labels[index], - style: style.copyWith( - color: color, - fontWeight: index == selected - ? FontWeight.w600 - : style.fontWeight, - ), - ), + child: Padding( + padding: const EdgeInsets.all(8), + child: Wrap( + alignment: WrapAlignment.center, + crossAxisAlignment: WrapCrossAlignment.center, + spacing: 8, + runSpacing: 8, + children: [ + for (var index = 0; index < labels.length; index++) + GestureDetector( + key: ValueKey('destination-label-${labels[index]}'), + excludeFromSemantics: true, + onTap: () => onTap(index), + child: TextFieldTapRegion( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + buttonBuilder(index), + ExcludeSemantics( + child: Text( + labels[index], + style: style.copyWith( + color: color, + fontWeight: index == selected + ? FontWeight.w600 + : style.fontWeight, ), - ], + ), ), - ), + ], ), - ], - ), - ), + ), + ), + ], ), ), ); diff --git a/app/notes/main-tab-label-backdrop.md b/app/notes/main-tab-label-backdrop.md new file mode 100644 index 00000000..cfee4bb0 --- /dev/null +++ b/app/notes/main-tab-label-backdrop.md @@ -0,0 +1,8 @@ +# Main tab captions without a shared backdrop + +Removed the shared rounded surface and backdrop group behind the main +navigation captions. The labels retain their content-driven padding, wrapping, +hit targets, text scaling, safe-area clearance, and existing per-tab selected +button decoration. Focused coverage checks phone and wide layouts on Material +and Cupertino hosts. Browser captures also covered 560px/1200px Material layouts +in light and dark themes; the four PNGs were inspected during review. diff --git a/app/test/shell/floating_tab_bar_test.dart b/app/test/shell/floating_tab_bar_test.dart index c930b66b..8ec010d4 100644 --- a/app/test/shell/floating_tab_bar_test.dart +++ b/app/test/shell/floating_tab_bar_test.dart @@ -5,6 +5,7 @@ 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'; +import 'package:pipelines_app/ui/adaptive/floating_destination_labels.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. @@ -39,6 +40,22 @@ void main() { expect(bounds.width - contentBounds!.width, inInclusiveRange(0, 32)); } + Future expectNoSharedBackdrop(WidgetTester tester) async { + expect( + find.descendant( + of: find.byType(FloatingDestinationLabels), + matching: find.byWidgetPredicate( + (widget) => + widget is DecoratedBox && + widget.decoration is BoxDecoration && + (widget.decoration as BoxDecoration).borderRadius == + BorderRadius.circular(16), + ), + ), + findsNothing, + ); + } + Future setSize(WidgetTester tester, Size size) async { tester.view.physicalSize = size; tester.view.devicePixelRatio = 1; @@ -80,6 +97,7 @@ void main() { await tester.pumpWidget(shell(cupertino: cupertino)); 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); @@ -111,6 +129,7 @@ void main() { expect(rect.width, lessThan(1200 * 0.6)); // Captions participate in the bar's content-driven width. await expectLabeledTargets(tester, rect); + await expectNoSharedBackdrop(tester); expect( rect.width, lessThanOrEqualTo(listDetailListWidth(1200, 1200, null) - 2 * 16), From 6a3daccd6ddeadc465902e974d1ffe2584083568 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Sat, 7 Nov 2026 22:09:45 +0000 Subject: [PATCH 2/3] Keep mobile chat selectors in header row --- .../chat/conversation/chat_mode_control.dart | 22 +++-- .../chat/conversation/chat_model_control.dart | 22 +++-- .../chat/conversation/chat_thread_header.dart | 61 +++----------- .../chat/conversation/chat_thread_view.dart | 2 - app/notes/mobile-chat-icon-controls.md | 13 +++ .../conversation/chat_thread_header_test.dart | 82 ++++++++++++------- 6 files changed, 106 insertions(+), 96 deletions(-) create mode 100644 app/notes/mobile-chat-icon-controls.md diff --git a/app/lib/features/chat/conversation/chat_mode_control.dart b/app/lib/features/chat/conversation/chat_mode_control.dart index 75bfa927..4fd35c06 100644 --- a/app/lib/features/chat/conversation/chat_mode_control.dart +++ b/app/lib/features/chat/conversation/chat_mode_control.dart @@ -133,13 +133,21 @@ class _ChatModeControlState extends State { ), ); } - return Tooltip( - message: 'Change mode (currently $label)', - child: TextButton( - key: key, - style: chatBarTextButtonStyle(context), - onPressed: _open, - child: content, + return Semantics( + container: true, + button: true, + label: 'Change mode, currently $label', + onTap: _open, + child: ExcludeSemantics( + child: Tooltip( + message: 'Change mode (currently $label)', + child: TextButton( + key: key, + style: chatBarTextButtonStyle(context), + onPressed: _open, + child: content, + ), + ), ), ); } diff --git a/app/lib/features/chat/conversation/chat_model_control.dart b/app/lib/features/chat/conversation/chat_model_control.dart index 48fe876b..ddd09936 100644 --- a/app/lib/features/chat/conversation/chat_model_control.dart +++ b/app/lib/features/chat/conversation/chat_model_control.dart @@ -146,13 +146,21 @@ class _ChatModelControlState extends State { ), ); } - return Tooltip( - message: 'Change model (currently $label)', - child: TextButton( - key: key, - style: chatBarTextButtonStyle(context), - onPressed: _open, - child: content, + return Semantics( + container: true, + button: true, + label: 'Change model, currently $label', + onTap: _open, + child: ExcludeSemantics( + child: Tooltip( + message: 'Change model (currently $label)', + child: TextButton( + key: key, + style: chatBarTextButtonStyle(context), + onPressed: _open, + child: content, + ), + ), ), ); } diff --git a/app/lib/features/chat/conversation/chat_thread_header.dart b/app/lib/features/chat/conversation/chat_thread_header.dart index f4e871af..b9270b74 100644 --- a/app/lib/features/chat/conversation/chat_thread_header.dart +++ b/app/lib/features/chat/conversation/chat_thread_header.dart @@ -12,8 +12,8 @@ import '../ui/sessions/chat_adaptive.dart'; /// pill with the conversation's title and folder that opens the chat's /// information, a selector island holding [controls] (model and mode), /// then the Files action and a native More menu in a separate island. -/// Narrow panes give readable model/mode values a separate row; exceptionally -/// short viewports can scroll the header to keep controls reachable. +/// Narrow panes keep the model/mode selectors as compact icons in the same row; +/// their semantic labels and native pickers continue to expose the values. class ChatThreadHeader extends StatelessWidget { const ChatThreadHeader({ super.key, @@ -53,8 +53,7 @@ class ChatThreadHeader extends StatelessWidget { return LayoutBuilder( builder: (context, constraints) { final textScale = MediaQuery.textScalerOf(context).scale(14) / 14; - final readableWidth = constraints.maxWidth / textScale; - final narrow = readableWidth < 800; + final compact = constraints.maxWidth / textScale < 800; final bar = SegmentedBar( cupertino: cupertino, automaticallyImplyLeading: false, @@ -77,7 +76,7 @@ class ChatThreadHeader extends StatelessWidget { titleKey: const Key('chat-info'), separateActionIslands: true, actions: [ - if (!narrow && controls.isNotEmpty) + if (controls.isNotEmpty) _ControlIsland( key: const Key('chat-model-permission-island'), children: controls, @@ -104,35 +103,14 @@ class ChatThreadHeader extends StatelessWidget { ], ), ], - bottomPadding: narrow ? 8 : 16, + bottomPadding: compact ? 8 : 16, backdrop: backdrop, ); return ColoredBox( color: cupertino ? CupertinoTheme.of(context).scaffoldBackgroundColor : Theme.of(context).colorScheme.surface, - child: SingleChildScrollView( - primary: false, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - bar, - if (narrow && controls.isNotEmpty) - Padding( - padding: const EdgeInsets.fromLTRB(12, 0, 12, 8), - child: SegmentedPill( - cupertino: cupertino, - child: _ControlIsland( - key: const Key('chat-model-permission-island'), - fill: true, - vertical: readableWidth < 340, - children: controls, - ), - ), - ), - ], - ), - ), + child: bar, ); }, ); @@ -142,27 +120,12 @@ class ChatThreadHeader extends StatelessWidget { /// Related selectors share the available width. Each remains a real control; /// they never migrate into the unrelated actions menu. class _ControlIsland extends StatelessWidget { - const _ControlIsland({ - super.key, - required this.children, - this.fill = false, - this.vertical = false, - }); + const _ControlIsland({super.key, required this.children}); final List children; - final bool fill; - final bool vertical; + @override - Widget build(BuildContext context) => vertical - ? Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: children, - ) - : Row( - mainAxisSize: fill ? MainAxisSize.max : MainAxisSize.min, - children: [ - for (final child in children) - if (fill) Expanded(child: child) else Flexible(child: child), - ], - ); + Widget build(BuildContext context) => Row( + mainAxisSize: MainAxisSize.min, + children: [for (final child in children) Flexible(child: child)], + ); } diff --git a/app/lib/features/chat/conversation/chat_thread_view.dart b/app/lib/features/chat/conversation/chat_thread_view.dart index f3fa7e54..5c7b6afd 100644 --- a/app/lib/features/chat/conversation/chat_thread_view.dart +++ b/app/lib/features/chat/conversation/chat_thread_view.dart @@ -1342,7 +1342,6 @@ class _ChatThreadViewState extends State { controls: [ if (hasModel) ChatModelControl( - showLabel: true, key: ValueKey('chat-model-${widget.sessionId}'), gateway: widget.gateway, sessionId: widget.sessionId, @@ -1358,7 +1357,6 @@ class _ChatThreadViewState extends State { /// The session's permission mode, keyed per session so another chat /// re-reads its own modes. Widget _modeControl() => ChatModeControl( - showLabel: true, key: ValueKey('chat-mode-${widget.sessionId}'), gateway: widget.gateway, sessionId: widget.sessionId, diff --git a/app/notes/mobile-chat-icon-controls.md b/app/notes/mobile-chat-icon-controls.md new file mode 100644 index 00000000..acf49696 --- /dev/null +++ b/app/notes/mobile-chat-icon-controls.md @@ -0,0 +1,13 @@ +# Mobile chat selector controls + +- Mobile chat headers keep model and permission-mode selectors in the single top row, together in their selector island before Files and More. +- Mobile uses the existing memory and shield icons; semantic labels/tooltips retain the current-value explanation and native pickers. +- Desktop keeps the existing readable selector labels and picker behavior. +- Focused checks: `tool/memwatch/full.sh 'test/features/chat/conversation/chat_thread_header_test.dart test/features/chat/conversation/chat_model_picker_test.dart'` — 28 passed. +- `tool/analyze.sh` — clean. +- Fixture-browser captures were inspected for Material/Cupertino mobile (560x1000) and desktop (1280x1000), light theme: + - `public/chat-material-mobile/01-mobile-material.png` + - `public/chat-cupertino-mobile/01-mobile-cupertino.png` + - `public/chat-material-desktop/01-desktop-material.png` + - `public/chat-cupertino-desktop/01-desktop-cupertino.png` +- No device installation or deployment was performed. diff --git a/app/test/features/chat/conversation/chat_thread_header_test.dart b/app/test/features/chat/conversation/chat_thread_header_test.dart index 8192bf50..65a45103 100644 --- a/app/test/features/chat/conversation/chat_thread_header_test.dart +++ b/app/test/features/chat/conversation/chat_thread_header_test.dart @@ -38,7 +38,7 @@ void _useNarrowText(WidgetTester tester) { } void main() { - testWidgets('short large-text header scrolls controls without overflow', ( + testWidgets('short large-text header keeps controls in its single row', ( tester, ) async { _useNarrowText(tester); @@ -55,15 +55,9 @@ void main() { onInfo: () {}, showBack: true, onBack: () {}, - controls: [ - TextButton( - onPressed: () {}, - child: const Text('Current model'), - ), - TextButton( - onPressed: () {}, - child: const Text('Ask for permission'), - ), + controls: const [ + IconButton(onPressed: null, icon: Icon(Icons.memory_outlined)), + IconButton(onPressed: null, icon: Icon(Icons.shield_outlined)), ], ), ), @@ -73,9 +67,10 @@ void main() { ); await tester.pumpAndSettle(); expect(tester.takeException(), isNull); - await tester.ensureVisible(find.text('Ask for permission')); - await tester.pumpAndSettle(); - expect(find.text('Ask for permission').hitTestable(), findsOneWidget); + expect( + find.byKey(const Key('chat-model-permission-island')), + findsOneWidget, + ); expect(tester.takeException(), isNull); }); @@ -83,7 +78,7 @@ void main() { final host = cupertino ? 'Cupertino' : 'Material'; testWidgets( - '$host narrow header keeps native back/title and readable model', + '$host narrow header keeps native back/title and compact model icon', (tester) async { _useNarrowText(tester); final semantics = tester.ensureSemantics(); @@ -124,19 +119,22 @@ void main() { // One floating row of separate pieces: the round Back, the title pill // (which is the information control and holds the title), then the - // model in the trailing pill. + // selector island in the trailing row. double centerY(Finder finder) => tester.getCenter(finder).dy; expect((centerY(back) - centerY(info)).abs(), lessThan(16)); - expect( - tester.getTopLeft(model).dy, - greaterThanOrEqualTo(tester.getBottomLeft(info).dy), - ); + expect((centerY(model) - centerY(info)).abs(), lessThan(16)); expect(find.descendant(of: info, matching: title), findsOneWidget); double right(Finder finder) => tester.getTopRight(finder).dx; expect(right(back), lessThanOrEqualTo(tester.getTopLeft(info).dx)); + expect(find.byIcon(Icons.memory_outlined), findsOneWidget); + if (!cupertino) { + final semantics = tester.getSemantics(model); + expect(semantics.label, contains('Change model')); + expect(semantics.label, contains('currently')); + } expect( find.textContaining('an-extremely-long-recorded-model-id'), - findsOneWidget, + findsNothing, ); await tester.tap(back); @@ -199,21 +197,43 @@ void main() { final actions = find.byKey(const Key('chat-actions-island')); expect(selectors, findsOneWidget); expect(actions, findsOneWidget); - if (width / 2 >= 800) { - expect( - tester.getTopRight(selectors).dx, - lessThan(tester.getTopLeft(actions).dx), - ); - } else { - expect( - tester.getTopLeft(selectors).dy, - greaterThanOrEqualTo(tester.getBottomLeft(actions).dy), - ); - } + expect( + (tester.getCenter(selectors).dy - tester.getCenter(actions).dy) + .abs(), + lessThan(16), + ); expect(find.byKey(const Key('chat-next')), findsNothing); expect(find.text('Next chat'), findsNothing); expect(find.byKey(const Key('chat-model')), findsOneWidget); expect(find.byKey(const Key('chat-mode')), findsOneWidget); + if (width < 600) { + expect(find.text('model-a'), findsNothing); + expect(find.text('Ask before making changes'), findsNothing); + expect(find.byIcon(Icons.memory_outlined), findsOneWidget); + expect( + find.byIcon( + cupertino + ? CupertinoIcons.shield_lefthalf_fill + : Icons.shield_outlined, + ), + findsOneWidget, + ); + if (!cupertino) { + expect( + tester.getSemantics(find.byKey(const Key('chat-model'))).label, + contains('Change model, currently'), + ); + expect( + tester.getSemantics(find.byKey(const Key('chat-mode'))).label, + contains('Change mode, currently'), + ); + } + expect( + (tester.getCenter(selectors).dy - tester.getCenter(actions).dy) + .abs(), + lessThan(16), + ); + } for (final key in ['chat-model', 'chat-mode']) { expect( tester.getSize(find.byKey(Key(key))).width, From 4e2b9800e8194a27eb0e26d6afef734bb4a9deac Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Sat, 7 Nov 2026 22:14:42 +0000 Subject: [PATCH 3/3] Align wide desktop tabs to leading edge --- app/lib/shell/adaptive_shell.dart | 4 +- .../ui/adaptive/floating_destination_bar.dart | 13 +++--- app/notes/desktop-tabs-leading.md | 6 +++ app/test/shell/floating_tab_bar_test.dart | 21 ++++------ .../shell/split_destination_bar_test.dart | 42 ++++++++++--------- 5 files changed, 45 insertions(+), 41 deletions(-) create mode 100644 app/notes/desktop-tabs-leading.md diff --git a/app/lib/shell/adaptive_shell.dart b/app/lib/shell/adaptive_shell.dart index 77fc27e6..fa08a590 100644 --- a/app/lib/shell/adaptive_shell.dart +++ b/app/lib/shell/adaptive_shell.dart @@ -173,7 +173,7 @@ class _AdaptiveShellState extends State { // remounts a destination. // // While the tab shows its list beside an open item the bar moves under - // the list pane, centred in the list's (dragged) width, so the open item + // the leading edge of the list pane, so the open item // keeps its whole height: the list clears the bar and the item clears // only the system inset (see ListDetailPanes). The bar keeps its place // in the tree, so a split never replays its entrance. @@ -198,7 +198,7 @@ class _AdaptiveShellState extends State { currentIndex: index, onTap: (value) => _select(shellTabDestinations[value]), items: _destinationItems(), - alignment: split ? Alignment.bottomCenter : null, + alignment: split ? AlignmentDirectional.bottomStart : null, ), ); }, diff --git a/app/lib/ui/adaptive/floating_destination_bar.dart b/app/lib/ui/adaptive/floating_destination_bar.dart index 8f7815ac..1f534470 100644 --- a/app/lib/ui/adaptive/floating_destination_bar.dart +++ b/app/lib/ui/adaptive/floating_destination_bar.dart @@ -13,10 +13,11 @@ import 'floating_destination_labels.dart'; /// frosted [GlassPill] buttons, one per tab, instead of a full-width system /// bar. Used for the app's destinations and for every page's own tabs. /// -/// The row is only as wide as its buttons and sits at the trailing (right, -/// in left-to-right text) edge, near the thumb, keeping [kFloatingBarMargin] -/// from the sides and above the bottom safe area. Only the buttons take -/// taps: the gaps between and beside them reach the content behind. A row +/// The row is only as wide as its buttons and, by default, sits at the trailing +/// (right, in left-to-right text) edge, near the thumb, keeping +/// [kFloatingBarMargin] from the sides and above the bottom safe area. Hosts +/// can request another alignment for a pane-specific layout. Only the buttons +/// take taps: the gaps between and beside them reach the content behind. A row /// squeezed below its natural width narrows its gaps, then scales down. /// /// The selected button is filled with the host's selection tint, which @@ -48,8 +49,8 @@ class FloatingDestinationBar extends StatefulWidget { final bool showLabels; /// Where the row sits in the width it is given, at [FloatingBarEdge.bottom]: - /// the trailing end by default. The shell centres its tabs under the list - /// pane while a list shows beside an open item. + /// the trailing end by default. The shell can align its main tabs to the + /// leading edge of a list pane while a list shows beside an open item. final AlignmentGeometry? alignment; /// The edge the bar floats at. At [FloatingBarEdge.top] (an open item's diff --git a/app/notes/desktop-tabs-leading.md b/app/notes/desktop-tabs-leading.md new file mode 100644 index 00000000..dc97520a --- /dev/null +++ b/app/notes/desktop-tabs-leading.md @@ -0,0 +1,6 @@ +# Desktop main tabs leading alignment + +Wide list-detail layouts now place the main destination tab row at the leading +edge of the list pane. Narrow layouts retain their trailing placement, and +page-specific tab bars remain unchanged. Focused shell tests cover Material and +Cupertino geometry, including stored pane widths. diff --git a/app/test/shell/floating_tab_bar_test.dart b/app/test/shell/floating_tab_bar_test.dart index 8ec010d4..d4ca75c1 100644 --- a/app/test/shell/floating_tab_bar_test.dart +++ b/app/test/shell/floating_tab_bar_test.dart @@ -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)); diff --git a/app/test/shell/split_destination_bar_test.dart b/app/test/shell/split_destination_bar_test.dart index 8a00093b..4f8f0374 100644 --- a/app/test/shell/split_destination_bar_test.dart +++ b/app/test/shell/split_destination_bar_test.dart @@ -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 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)); });