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.
This commit is contained in:
@@ -306,7 +306,12 @@ class _SegmentedBarState extends State<SegmentedBar> {
|
||||
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: [
|
||||
|
||||
@@ -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.
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user