Evenly space chat action bar controls

Add a uniform desktop gap between header control groups and remove duplicated horizontal padding from model and mode controls. Preserve compact-layout touch targets and add Material/Cupertino regression coverage.
This commit is contained in:
2026-11-10 16:38:55 +00:00
parent c6ab716ecb
commit 123c864397
6 changed files with 104 additions and 28 deletions
@@ -38,6 +38,59 @@ void _useNarrowText(WidgetTester tester) {
}
void main() {
for (final cupertino in [false, true]) {
testWidgets(
'${cupertino ? 'Cupertino' : 'Material'} wide header uses one explicit control gap',
(tester) async {
tester.view.physicalSize = const Size(1440, 900);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
Widget control(String key) =>
SizedBox(key: Key(key), width: 48, height: 48);
await tester.pumpWidget(
_host(
ChatThreadHeader(
title: 'Chat',
folder: 'demo',
onInfo: () {},
controls: [
control('header-control-1'),
control('header-control-2'),
],
actions: [control('header-action-1'), control('header-action-2')],
moreActions: [
ChatBarAction(
label: 'More action',
onPressed: () {},
materialIcon: Icons.more_horiz,
cupertinoIcon: CupertinoIcons.ellipsis,
),
],
),
cupertino: cupertino,
),
);
await tester.pumpAndSettle();
double gap(String left, String right) =>
tester.getTopLeft(find.byKey(Key(right))).dx -
tester.getTopRight(find.byKey(Key(left))).dx;
expect(gap('header-control-1', 'header-control-2'), 8);
expect(gap('header-control-2', 'header-action-1'), 8);
expect(gap('header-action-1', 'header-action-2'), 8);
expect(
tester.getTopLeft(find.byKey(segmentedMoreKey).first).dx -
tester.getTopRight(find.byKey(const Key('header-action-2'))).dx,
8,
);
},
);
}
testWidgets('short large-text header keeps controls in its single row', (
tester,
) async {