From 1dc992bc2707ed292ba3e793dd3113f474b1afe7 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Thu, 3 Dec 2026 17:11:42 +0000 Subject: [PATCH] Terminal design: no composer prompt glyph; usage ring follows the square send button Co-Authored-By: Claude Opus 5.5 --- .../chat/conversation/chat_composer_bar.dart | 24 ---------- .../conversation/chat_send_usage_ring.dart | 48 +++++++++++++++++++ 2 files changed, 48 insertions(+), 24 deletions(-) diff --git a/app/lib/features/chat/conversation/chat_composer_bar.dart b/app/lib/features/chat/conversation/chat_composer_bar.dart index d51edc2d..acca0ace 100644 --- a/app/lib/features/chat/conversation/chat_composer_bar.dart +++ b/app/lib/features/chat/conversation/chat_composer_bar.dart @@ -1314,10 +1314,6 @@ class _ChatComposerBarState extends State { // Let a long folder name wrap when the attach and primary controls // leave little horizontal room. hintMaxLines: 2, - // A terminal design's prompt glyph leads the field, as a CLI's - // input line does. - prefixIcon: _promptGlyph(context), - prefixIconConstraints: const BoxConstraints(), // The pill draws the field's surface; the field adds no border. border: InputBorder.none, isDense: true, @@ -1326,26 +1322,6 @@ class _ChatComposerBarState extends State { ); } - /// The prompt glyph before the field under a terminal design; null under - /// the Default design. - Widget? _promptGlyph(BuildContext context) { - final tokens = AppDesignTokens.of(context); - if (!tokens.terminal) return null; - return ExcludeSemantics( - child: Padding( - padding: const EdgeInsetsDirectional.only(start: 4, end: 10), - child: Text( - tokens.promptGlyph, - key: const Key('chat-composer-prompt-glyph'), - style: TextStyle( - color: chatFocusRingColor(context, widget.chatColor), - fontWeight: FontWeight.w700, - ), - ), - ), - ); - } - /// The single primary control: Send (or Run command for a `!` draft). A /// prompt sent while a turn runs takes the server's queued-prompt path; the /// running turn is stopped by Escape twice, `/stop`, or the More menu. 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 9e8f7a5f..27f7e7f9 100644 --- a/app/lib/features/chat/conversation/chat_send_usage_ring.dart +++ b/app/lib/features/chat/conversation/chat_send_usage_ring.dart @@ -3,6 +3,7 @@ import 'dart:math' as math; import 'package:flutter/material.dart'; +import '../../../ui/theme/app_design_tokens.dart'; import '../domain/chat_account_usage.dart'; import '../domain/chat_usage_ring.dart'; @@ -125,6 +126,8 @@ class _ChatSendUsageRingState extends State { }, track: scheme.outlineVariant.withValues(alpha: .35), circle: chatSendButtonDiameter(context), + // A design with square-ish corners frames its square send button. + cornerRadius: AppDesignTokens.of(context).radius, ); } } @@ -148,6 +151,7 @@ class ChatUsageRingPainter extends CustomPainter { required this.color, required this.track, required this.circle, + this.cornerRadius, }); final double fraction; @@ -155,6 +159,10 @@ class ChatUsageRingPainter extends CustomPainter { final Color track; final double circle; + /// The button's corner radius under a design that squares it; null for the + /// round button. The ring then follows a rounded square instead. + final double? cornerRadius; + static const double stroke = 2; static const double gap = 1; @@ -171,6 +179,11 @@ class ChatUsageRingPainter extends CustomPainter { ..style = PaintingStyle.stroke ..strokeWidth = stroke ..isAntiAlias = true; + final corner = cornerRadius; + if (corner != null) { + _paintSquare(canvas, size, corner, paint); + return; + } canvas.drawCircle(rect.center, radius, paint..color = track); if (fraction <= 0) return; canvas.drawArc( @@ -184,8 +197,43 @@ class ChatUsageRingPainter extends CustomPainter { ); } + /// The rounded-square ring: the track all round and the used part + /// clockwise from the top centre. + void _paintSquare(Canvas canvas, Size size, double corner, Paint paint) { + final half = radius; + final rect = Rect.fromCenter( + center: size.center(Offset.zero), + width: half * 2, + height: half * 2, + ); + final r = Radius.circular(corner + gap + stroke / 2); + final c = rect.center; + // Built clockwise from the top centre, so the used length starts there. + final path = Path() + ..moveTo(c.dx, rect.top) + ..lineTo(rect.right - r.x, rect.top) + ..arcToPoint(Offset(rect.right, rect.top + r.y), radius: r) + ..lineTo(rect.right, rect.bottom - r.y) + ..arcToPoint(Offset(rect.right - r.x, rect.bottom), radius: r) + ..lineTo(rect.left + r.x, rect.bottom) + ..arcToPoint(Offset(rect.left, rect.bottom - r.y), radius: r) + ..lineTo(rect.left, rect.top + r.y) + ..arcToPoint(Offset(rect.left + r.x, rect.top), radius: r) + ..close(); + canvas.drawPath(path, paint..color = track); + if (fraction <= 0) return; + final metric = path.computeMetrics().first; + canvas.drawPath( + metric.extractPath(0, metric.length * fraction.clamp(0, 1)), + paint + ..color = color + ..strokeCap = fraction >= 1 ? StrokeCap.butt : StrokeCap.square, + ); + } + @override bool shouldRepaint(ChatUsageRingPainter old) => + old.cornerRadius != cornerRadius || old.fraction != fraction || old.color != color || old.track != track ||