From b2e67dbfa2fa7554554f5df89f69174513649982 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Fri, 13 Nov 2026 13:34:36 +0000 Subject: [PATCH] Center lone segmented More action Wrap the generated More control in the same pill used by separate action islands so a narrow chat header keeps symmetric insets and consistent height. Add regression coverage and document the focused checks. --- app/lib/ui/adaptive/segmented_bar.dart | 7 ++- app/notes/segmented-more-island.md | 17 +++++++ .../adaptive/segmented_bar_overflow_test.dart | 49 +++++++++++++++++++ 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 app/notes/segmented-more-island.md diff --git a/app/lib/ui/adaptive/segmented_bar.dart b/app/lib/ui/adaptive/segmented_bar.dart index 7ffca933..82742723 100644 --- a/app/lib/ui/adaptive/segmented_bar.dart +++ b/app/lib/ui/adaptive/segmented_bar.dart @@ -306,7 +306,12 @@ class _SegmentedBarState extends State { excluding: entries.isEmpty, child: SegmentedPress( tint: widget.foregroundColor, - child: SegmentedMoreButton(entries: entries), + child: widget.separateActionIslands + ? SegmentedPill( + fill: widget.pillColor, + child: SegmentedMoreButton(entries: entries), + ) + : SegmentedMoreButton(entries: entries), ), ), actions: [ diff --git a/app/notes/segmented-more-island.md b/app/notes/segmented-more-island.md new file mode 100644 index 00000000..009a3190 --- /dev/null +++ b/app/notes/segmented-more-island.md @@ -0,0 +1,17 @@ +# Narrow chat More island + +The generated overflow `More` control now uses `SegmentedPill` when action +islands are separate, matching the height and symmetric insets of the other +action islands. This covers desktop menu anchors and phone action-sheet +buttons because both are hosted by the same pill. + +## Checks + +- `tool/memwatch/full.sh 'test/ui/adaptive/segmented_bar_overflow_test.dart'` + — 10 passed. +- `tool/analyze.sh` — clean. + +The regression test covers a narrow, all-overflowed action row and checks equal +left/right and top/bottom insets for the More button, plus height parity with a +multi-action island. Browser before/after captures were not run in this +implementation stage. diff --git a/app/test/ui/adaptive/segmented_bar_overflow_test.dart b/app/test/ui/adaptive/segmented_bar_overflow_test.dart index 16e623d8..02740b7c 100644 --- a/app/test/ui/adaptive/segmented_bar_overflow_test.dart +++ b/app/test/ui/adaptive/segmented_bar_overflow_test.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/ui/adaptive/segmented_bar.dart'; +import 'package:pipelines_app/ui/adaptive/segmented_bar_pieces.dart'; void _size(WidgetTester tester, double width) { tester.view.physicalSize = Size(width, 700); @@ -142,6 +143,54 @@ void main() { expect(find.bySemanticsLabel('More actions'), findsNothing); }); + testWidgets('$host: a lone More action is centred in its separate island', ( + tester, + ) async { + _size(tester, 180); + await _pump( + tester, + _app( + SegmentedBar( + title: 'Runs', + separateActionIslands: true, + actions: [ + for (final name in ['Filter', 'Sort', 'Select', 'Usage', 'View']) + SegmentedOverflowAction( + overflowEntry: SegmentedOverflowEntry( + label: name, + icon: Icons.filter_list, + ), + child: _icon(name, () {}), + ), + ], + ), + ), + ); + + final more = find.byKey(segmentedMoreKey).hitTestable(); + expect(more, findsOneWidget); + final pill = tester.getRect(find.byType(SegmentedPill).last); + final button = tester.getRect(more); + expect(pill.height, segmentedPieceHeight()); + expect(button.left - pill.left, closeTo(pill.right - button.right, 0.1)); + expect(button.top - pill.top, closeTo(pill.bottom - button.bottom, 0.1)); + + await tester.pumpWidget( + _app( + SegmentedBar( + title: 'Runs', + separateActionIslands: true, + actions: [_icon('Needs you', () {}), _icon('Usage', () {})], + ), + ), + ); + await tester.pump(); + expect( + tester.getRect(find.byType(SegmentedPill).last).height, + pill.height, + ); + }); + testWidgets('$host: a longer title keeps a readable share at 240px', ( tester, ) async {