merge(app): land chat composer icons

This commit is contained in:
2026-10-23 15:40:34 +01:00
7 changed files with 32 additions and 33 deletions
@@ -777,26 +777,38 @@ class _ChatComposerBarState extends State<ChatComposerBar> {
} }
} }
final label = Text(stop ? chatStopLabel : chatSendLabel); // One icon control, named Send or Stop for assistive technology: a send
// arrow, or a stop square in the error colour while a turn runs.
final label = stop ? chatStopLabel : chatSendLabel;
if (cupertino) { if (cupertino) {
return CupertinoButton( return Semantics(
key: const Key('chat-composer-primary'), button: true,
color: stop ? CupertinoColors.systemRed.resolveFrom(context) : null, label: label,
onPressed: enabled ? press : null, excludeSemantics: true,
child: label, child: CupertinoButton.filled(
key: const Key('chat-composer-primary'),
sizeStyle: CupertinoButtonSize.small,
color: stop ? CupertinoColors.systemRed.resolveFrom(context) : null,
onPressed: enabled ? press : null,
child: Icon(
stop ? CupertinoIcons.stop_fill : CupertinoIcons.arrow_up,
size: 18,
),
),
); );
} }
final scheme = Theme.of(context).colorScheme; final scheme = Theme.of(context).colorScheme;
return FilledButton( return IconButton.filled(
key: const Key('chat-composer-primary'), key: const Key('chat-composer-primary'),
tooltip: label,
style: stop style: stop
? FilledButton.styleFrom( ? IconButton.styleFrom(
backgroundColor: scheme.error, backgroundColor: scheme.error,
foregroundColor: scheme.onError, foregroundColor: scheme.onError,
) )
: null, : null,
onPressed: enabled ? press : null, onPressed: enabled ? press : null,
child: label, icon: Icon(stop ? Icons.stop : Icons.send),
); );
} }
@@ -586,10 +586,6 @@ class _ChatThreadViewState extends State<ChatThreadView> {
permissionErrorFor: _controller.permissionErrorFor, permissionErrorFor: _controller.permissionErrorFor,
formErrorFor: _controller.questionErrorFor, formErrorFor: _controller.questionErrorFor,
); );
// A pending approval/question means the turn is waiting on the operator,
// not generating, so the transcript indicator and its live region stand
// down; the composer's Stop control still follows `running`.
final awaiting = cards.any(chatCardAwaitingOperator);
final allRows = transcriptRows(messages, trailing: cards); final allRows = transcriptRows(messages, trailing: cards);
// A transcript held from before a socket gap may still say a compaction is // A transcript held from before a socket gap may still say a compaction is
// running even when the repair's read is refused. That running state is // running even when the repair's read is refused. That running state is
@@ -804,15 +800,6 @@ class _ChatThreadViewState extends State<ChatThreadView> {
notice: notice, notice: notice,
onDismiss: _dismiss, onDismiss: _dismiss,
), ),
if (_controller.running && !awaiting)
Padding(
key: const Key('chat-running'),
padding: const EdgeInsets.all(16),
child: Semantics(
liveRegion: true,
child: const Text('Assistant is responding…'),
),
),
], ],
), ),
if (showJump) if (showJump)
@@ -335,7 +335,7 @@ void main() {
await tester.tap(find.byKey(const Key('chat-composer-primary'))); await tester.tap(find.byKey(const Key('chat-composer-primary')));
await tester.pump(); await tester.pump();
FilledButton primary() => tester.widget<FilledButton>( IconButton primary() => tester.widget<IconButton>(
find.byKey(const Key('chat-composer-primary')), find.byKey(const Key('chat-composer-primary')),
); );
IconButton attach() => tester.widget<IconButton>( IconButton attach() => tester.widget<IconButton>(
@@ -25,15 +25,15 @@ void main() {
composerThread(gateway, newOperationId: nextOperation), composerThread(gateway, newOperationId: nextOperation),
); );
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text(chatSendLabel), findsOneWidget); expect(find.byTooltip(chatSendLabel), findsOneWidget);
gateway.emitEvent(chatStepFrame('running')); gateway.emitEvent(chatStepFrame('running'));
await tester.pump(); await tester.pump();
await tester.pump(); await tester.pump();
expect(find.text(chatSendLabel), findsNothing); expect(find.byTooltip(chatSendLabel), findsNothing);
expect(find.text(chatStopLabel), findsOneWidget); expect(find.byTooltip(chatStopLabel), findsOneWidget);
final button = tester.widget<FilledButton>( final button = tester.widget<IconButton>(
find.byKey(const Key('chat-composer-primary')), find.byKey(const Key('chat-composer-primary')),
); );
final scheme = Theme.of( final scheme = Theme.of(
@@ -150,7 +150,7 @@ void main() {
); );
await tester.pumpAndSettle(); await tester.pumpAndSettle();
FilledButton primary() => tester.widget<FilledButton>( IconButton primary() => tester.widget<IconButton>(
find.byKey(const Key('chat-composer-primary')), find.byKey(const Key('chat-composer-primary')),
); );
@@ -362,8 +362,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('Approve bash'), findsOneWidget); expect(find.text('Approve bash'), findsOneWidget);
expect(find.text('Assistant is responding…'), findsNothing); expect(find.byTooltip('Stop'), findsOneWidget);
expect(find.text('Stop'), findsOneWidget);
gateway.emitRaw({ gateway.emitRaw({
'type': 'chat_permission', 'type': 'chat_permission',
@@ -371,8 +370,9 @@ void main() {
}); });
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('Assistant is responding…'), findsOneWidget); // No filler line while the turn runs; Stop is the running signal.
expect(find.text('Stop'), findsOneWidget); expect(find.byKey(const Key('chat-running')), findsNothing);
expect(find.byTooltip('Stop'), findsOneWidget);
}); });
testWidgets('consecutive Material cards stay separate surfaces', ( testWidgets('consecutive Material cards stay separate surfaces', (
@@ -422,7 +422,7 @@ void main() {
expect(find.text('live code'), findsOneWidget); expect(find.text('live code'), findsOneWidget);
expect(find.textContaining('### Live answer'), findsNothing); expect(find.textContaining('### Live answer'), findsNothing);
expect(find.textContaining('`live code`'), findsNothing); expect(find.textContaining('`live code`'), findsNothing);
expect(find.text('Assistant is responding…'), findsOneWidget); expect(find.byKey(const Key('chat-running')), findsNothing);
}); });
testWidgets('formatted assistant output fits 320px at 2x in dark Cupertino', ( testWidgets('formatted assistant output fits 320px at 2x in dark Cupertino', (