From 3e066622d86a6fc8592ce0d9c5a7674a54ba6217 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Thu, 3 Dec 2026 22:04:02 +0000 Subject: [PATCH] Send button: fixed size in every design and a clear 3px gap to its usage ring Co-Authored-By: Claude Opus 5.5 --- .../chat/conversation/chat_composer_bar.dart | 10 +++--- .../conversation/chat_send_usage_ring.dart | 31 +++++++++++++------ .../chat_composer_focus_ring_test.dart | 6 +++- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/app/lib/features/chat/conversation/chat_composer_bar.dart b/app/lib/features/chat/conversation/chat_composer_bar.dart index 863ea02d..415dc12c 100644 --- a/app/lib/features/chat/conversation/chat_composer_bar.dart +++ b/app/lib/features/chat/conversation/chat_composer_bar.dart @@ -1394,12 +1394,10 @@ class _ChatComposerBarState extends State { child: IconButton.filled( onLongPress: open, key: const Key('chat-composer-primary'), - style: tinted == null - ? null - : IconButton.styleFrom( - backgroundColor: tinted.primary, - foregroundColor: tinted.onPrimary, - ), + style: chatSendButtonStyle( + background: tinted?.primary, + foreground: tinted?.onPrimary, + ), onPressed: enabled ? press : null, icon: const Icon(Icons.arrow_upward), ), diff --git a/app/lib/features/chat/conversation/chat_send_usage_ring.dart b/app/lib/features/chat/conversation/chat_send_usage_ring.dart index 27f7e7f9..b190dcf2 100644 --- a/app/lib/features/chat/conversation/chat_send_usage_ring.dart +++ b/app/lib/features/chat/conversation/chat_send_usage_ring.dart @@ -132,15 +132,23 @@ class _ChatSendUsageRingState extends State { } } -/// The filled send button's visible circle: a Material 3 icon button's 40 -/// logical pixels adjusted by its visual density, inside a target that may -/// be padded beyond it. -double chatSendButtonDiameter(BuildContext context) { - final density = - IconButtonTheme.of(context).style?.visualDensity ?? - Theme.of(context).visualDensity; - return 40 + density.baseSizeAdjustment.dx; -} +/// The send button's visible size in every design: the composer pins it +/// ([chatSendButtonStyle]), so the ring's gap is the same everywhere. +const double chatSendButtonSize = 40; + +/// The send button's fixed size, whatever the design's density. +ButtonStyle chatSendButtonStyle({Color? background, Color? foreground}) => + IconButton.styleFrom( + backgroundColor: background, + foregroundColor: foreground, + fixedSize: const Size.square(chatSendButtonSize), + minimumSize: const Size.square(chatSendButtonSize), + maximumSize: const Size.square(chatSendButtonSize), + padding: EdgeInsets.zero, + ); + +/// The filled send button's visible size. +double chatSendButtonDiameter(BuildContext context) => chatSendButtonSize; /// The ring: a faint full track and the used arc clockwise from the top, a /// hairline gap outside the button's circle of diameter [circle], centred @@ -164,7 +172,10 @@ class ChatUsageRingPainter extends CustomPainter { final double? cornerRadius; static const double stroke = 2; - static const double gap = 1; + + /// A clear gap between the button and the ring, so the ring reads as its + /// own feature. + static const double gap = 3; /// The ring's centre-line radius. double get radius => circle / 2 + gap + stroke / 2; diff --git a/app/test/features/chat/conversation/chat_composer_focus_ring_test.dart b/app/test/features/chat/conversation/chat_composer_focus_ring_test.dart index aa8f772b..ab70b1f2 100644 --- a/app/test/features/chat/conversation/chat_composer_focus_ring_test.dart +++ b/app/test/features/chat/conversation/chat_composer_focus_ring_test.dart @@ -103,7 +103,11 @@ void main() { await tester.pumpWidget(composerThread(gateway)); await tester.pumpAndSettle(); final send = find.byKey(const Key('chat-composer-primary')); - expect(tester.widget(send).style, isNull); + // Only the fixed size is set: no colours, so the host's filled colours + // apply. + final style = tester.widget(send).style!; + expect(style.backgroundColor, isNull); + expect(style.foregroundColor, isNull); expect(chatSchemeOf(tester.element(send), null), isNull); });