Remove dead Cupertino chat paths

Keep the chat transcript and toolbar on their existing Material behavior while removing obsolete Cupertino-only helpers, arguments, and icon metadata. Preserve compatibility parameters where callers outside this lane still require them.
This commit is contained in:
2026-11-11 20:05:45 +00:00
parent 3f05421e8b
commit 87a568a7b4
11 changed files with 31 additions and 74 deletions
@@ -23,19 +23,3 @@ ButtonStyle chatBarTextButtonStyle(
/// Horizontal padding inside the bar's text buttons (model, mode). /// Horizontal padding inside the bar's text buttons (model, mode).
const EdgeInsets chatBarButtonPadding = EdgeInsets.symmetric(horizontal: 12); const EdgeInsets chatBarButtonPadding = EdgeInsets.symmetric(horizontal: 12);
/// Puts [content] (a button's child) in the bar's foreground colour: the
/// chat's tint if it has one, else `onSurfaceVariant`. Kept for existing
/// callers; the Material path colours buttons with [chatBarTextButtonStyle].
Widget chatBarCupertinoContent(BuildContext context, Widget content) {
final color =
ChatBarTintScope.foregroundOf(context) ??
Theme.of(context).colorScheme.onSurfaceVariant;
return IconTheme.merge(
data: IconThemeData(color: color),
child: DefaultTextStyle.merge(
style: TextStyle(color: color),
child: content,
),
);
}
@@ -3,10 +3,6 @@ import 'package:flutter/material.dart';
import '../domain/chat_task_metadata.dart'; import '../domain/chat_task_metadata.dart';
import '../../../ui/text/monospace.dart'; import '../../../ui/text/monospace.dart';
/// Always false: the app is Material-only. Kept so existing callers compile;
/// a later run removes it with its callers.
bool taskCupertino(BuildContext context) => false;
Color taskSecondary(BuildContext context) => Color taskSecondary(BuildContext context) =>
Theme.of(context).colorScheme.onSurfaceVariant; Theme.of(context).colorScheme.onSurfaceVariant;
@@ -2,7 +2,6 @@ import '../../../shell/windows/window_scope.dart';
import '../../terminal/terminal_open_action.dart'; import '../../terminal/terminal_open_action.dart';
import 'dart:async'; import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
@@ -1408,9 +1407,6 @@ class _ChatThreadViewState extends State<ChatThreadView> {
identifier: 'chat-files-toggle', identifier: 'chat-files-toggle',
onPressed: _toggleFiles, onPressed: _toggleFiles,
materialIcon: _filesVisible ? Icons.folder : Icons.folder_outlined, materialIcon: _filesVisible ? Icons.folder : Icons.folder_outlined,
cupertinoIcon: _filesVisible
? CupertinoIcons.folder_fill
: CupertinoIcons.folder,
), ),
], ],
moreActions: [ moreActions: [
@@ -1422,7 +1418,6 @@ class _ChatThreadViewState extends State<ChatThreadView> {
label: 'Chat details', label: 'Chat details',
onPressed: _openInfo, onPressed: _openInfo,
materialIcon: Icons.info_outline, materialIcon: Icons.info_outline,
cupertinoIcon: CupertinoIcons.info,
), ),
...widget.paneControls, ...widget.paneControls,
chatShellRunMenuAction(onPressed: _runShellFromMenu), chatShellRunMenuAction(onPressed: _runShellFromMenu),
@@ -15,7 +15,7 @@ class ChatBarAction extends StatelessWidget implements SegmentedOverflowable {
required this.label, required this.label,
required this.onPressed, required this.onPressed,
required this.materialIcon, required this.materialIcon,
required this.cupertinoIcon, this.cupertinoIcon,
this.identifier, this.identifier,
}); });
@@ -24,7 +24,7 @@ class ChatBarAction extends StatelessWidget implements SegmentedOverflowable {
final IconData materialIcon; final IconData materialIcon;
/// Kept for callers; the Material toolbar always draws [materialIcon]. /// Kept for callers; the Material toolbar always draws [materialIcon].
final IconData cupertinoIcon; final IconData? cupertinoIcon;
final String? identifier; final String? identifier;
/// A narrow bar moves it into its More menu, under the bar's host's icon. /// A narrow bar moves it into its More menu, under the bar's host's icon.
@@ -16,7 +16,7 @@ class ChatCodeHover {
Object token, Object token,
String text, String text,
Offset pointer, { Offset pointer, {
required bool cupertino, bool? cupertino,
}) { }) {
if (_disposed) return; if (_disposed) return;
hide(); hide();
@@ -64,11 +64,7 @@ class ChatCodeHover {
child: Material( child: Material(
elevation: 3, elevation: 3,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
child: ChatCopyButton( child: ChatCopyButton(text: text, showLabel: true),
text: text,
cupertino: false,
showLabel: true,
),
), ),
), ),
), ),
@@ -132,12 +128,12 @@ class ChatCodeCopyRegion extends StatefulWidget {
const ChatCodeCopyRegion({ const ChatCodeCopyRegion({
super.key, super.key,
required this.code, required this.code,
required this.cupertino, this.cupertino,
required this.label, required this.label,
required this.child, required this.child,
}); });
final String code; final String code;
final bool cupertino; final bool? cupertino;
final Widget label, child; final Widget label, child;
@override @override
State<ChatCodeCopyRegion> createState() => _ChatCodeCopyRegionState(); State<ChatCodeCopyRegion> createState() => _ChatCodeCopyRegionState();
@@ -170,7 +166,6 @@ class _ChatCodeCopyRegionState extends State<ChatCodeCopyRegion> {
child: SelectionContainer.disabled( child: SelectionContainer.disabled(
child: ChatCopyButton( child: ChatCopyButton(
text: widget.code, text: widget.code,
cupertino: widget.cupertino,
showLabel: true, showLabel: true,
), ),
), ),
@@ -12,15 +12,9 @@ const String chatCopiedLabel = 'Copied';
/// the clipboard. It shows a check for a moment after copying, so the operator /// the clipboard. It shows a check for a moment after copying, so the operator
/// sees the copy landed without a separate toast. /// sees the copy landed without a separate toast.
class ChatCopyButton extends StatefulWidget { class ChatCopyButton extends StatefulWidget {
const ChatCopyButton({ const ChatCopyButton({super.key, required this.text, this.showLabel = false});
super.key,
required this.text,
required this.cupertino,
this.showLabel = false,
});
final String text; final String text;
final bool cupertino;
final bool showLabel; final bool showLabel;
@override @override
@@ -202,7 +202,6 @@ class _ChatMarkdownViewState extends State<ChatMarkdownView> {
); );
return ChatCodeCopyRegion( return ChatCodeCopyRegion(
code: code, code: code,
cupertino: false,
label: Text(markdownCodeLabel(language), style: labelStyle), label: Text(markdownCodeLabel(language), style: labelStyle),
child: DecoratedBox( child: DecoratedBox(
decoration: BoxDecoration(color: _codeFill(context)), decoration: BoxDecoration(color: _codeFill(context)),
@@ -274,13 +273,7 @@ class _ChatMarkdownViewState extends State<ChatMarkdownView> {
), ),
onEnter: (event) { onEnter: (event) {
if (_route?.isCurrent != false) { if (_route?.isCurrent != false) {
_codeHover.show( _codeHover.show(context, token, text, event.position);
context,
token,
text,
event.position,
cupertino: false,
);
} }
}, },
onExit: (_) => _codeHover.scheduleHide(token), onExit: (_) => _codeHover.scheduleHide(token),
@@ -31,13 +31,8 @@ Color chatBubbleFill(BuildContext context, Color base) {
/// in the host's own surface roles. The agent's turn has no bubble at all; its /// in the host's own surface roles. The agent's turn has no bubble at all; its
/// text sits on the page, so only the operator's words are enclosed. /// text sits on the page, so only the operator's words are enclosed.
class ChatUserBubble extends StatelessWidget { class ChatUserBubble extends StatelessWidget {
const ChatUserBubble({ const ChatUserBubble({super.key, required this.child});
super.key,
required this.cupertino,
required this.child,
});
final bool cupertino;
final Widget child; final Widget child;
static const BorderRadius _radius = BorderRadius.all(Radius.circular(20)); static const BorderRadius _radius = BorderRadius.all(Radius.circular(20));
@@ -65,13 +60,8 @@ class ChatUserBubble extends StatelessWidget {
/// The agent's answer drawn straight on the page. Material keeps a transparent /// The agent's answer drawn straight on the page. Material keeps a transparent
/// surface so disclosure ListTiles still paint their ink. /// surface so disclosure ListTiles still paint their ink.
class ChatAgentSurface extends StatelessWidget { class ChatAgentSurface extends StatelessWidget {
const ChatAgentSurface({ const ChatAgentSurface({super.key, required this.child});
super.key,
required this.cupertino,
required this.child,
});
final bool cupertino;
final Widget child; final Widget child;
@override @override
@@ -81,7 +71,7 @@ class ChatAgentSurface extends StatelessWidget {
/// The transcript's reading text: the host's large body role, so answers read /// The transcript's reading text: the host's large body role, so answers read
/// at a comfortable size and still follow the operator's text scaling. /// at a comfortable size and still follow the operator's text scaling.
TextStyle? chatMessageTextStyle(BuildContext context, bool cupertino) => TextStyle? chatMessageTextStyle(BuildContext context, [bool? cupertino]) =>
Theme.of(context).textTheme.bodyLarge; Theme.of(context).textTheme.bodyLarge;
/// The empty-line gap between two paragraphs of a reply: about one line of /// The empty-line gap between two paragraphs of a reply: about one line of
@@ -87,7 +87,7 @@ class ChatMessageView extends StatelessWidget {
: _agentRow( : _agentRow(
context, context,
content, content,
ChatAgentSurface(cupertino: false, child: body), ChatAgentSurface(child: body),
gutter, gutter,
), ),
), ),
@@ -117,7 +117,7 @@ class ChatMessageView extends StatelessWidget {
); );
final hasTimestamp = chatMessageCreatedAt(_userMessage) != null; final hasTimestamp = chatMessageCreatedAt(_userMessage) != null;
if (thumbnails.isEmpty && footer.isEmpty && !hasTimestamp) { if (thumbnails.isEmpty && footer.isEmpty && !hasTimestamp) {
return ChatUserBubble(cupertino: false, child: body); return ChatUserBubble(child: body);
} }
return Column( return Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@@ -132,7 +132,7 @@ class ChatMessageView extends StatelessWidget {
if (thumbnails.isNotEmpty && content.isNotEmpty) if (thumbnails.isNotEmpty && content.isNotEmpty)
const SizedBox(height: 6), const SizedBox(height: 6),
if (content.isNotEmpty || thumbnails.isEmpty) if (content.isNotEmpty || thumbnails.isEmpty)
ChatUserBubble(cupertino: false, child: body), ChatUserBubble(child: body),
if (footer.isNotEmpty) ...[ if (footer.isNotEmpty) ...[
const SizedBox(height: 2), const SizedBox(height: 2),
Wrap( Wrap(
@@ -181,9 +181,7 @@ class ChatMessageView extends StatelessWidget {
double gutter, double gutter,
) { ) {
final copyText = row['streaming'] == true ? '' : _answerText(_partsOf(row)); final copyText = row['streaming'] == true ? '' : _answerText(_partsOf(row));
final copy = copyText.isEmpty final copy = copyText.isEmpty ? null : ChatCopyButton(text: copyText);
? null
: ChatCopyButton(text: copyText, cupertino: false);
if (gutter <= 0) return _agentTurn(context, content, answer, copy); if (gutter <= 0) return _agentTurn(context, content, answer, copy);
return ChatCopyGutterRow( return ChatCopyGutterRow(
width: gutter, width: gutter,
@@ -0,0 +1,14 @@
# Material chat Cupertino cleanup
- Removed dead Material-only conversation helpers and the unused Cupertino icon
metadata from the thread header; `ChatBarAction.cupertinoIcon` remains an
optional ignored compatibility parameter for callers in other chat lanes.
- Removed unused `cupertino` arguments from transcript bubbles and copy-button
construction while preserving the existing Material widgets and behavior.
- Focused UI states covered: transcript bubble color rendering, message layout,
and chat thread view/header behavior.
- Checks: `tool/memwatch/full.sh 'test/features/chat/ui/transcript/chat_bubble_color_test.dart test/features/chat/ui/transcript/chat_message_view_test.dart test/features/chat/conversation/chat_thread_view_test.dart'`
— PASS (24 passed); `tool/analyze.sh` — clean.
- No visual redesign or browser/device capture was needed: the edits remove
unused parameters and alternate icon metadata without changing rendered
Material controls, layout, focus, scrolling, or navigation behavior.
@@ -10,7 +10,7 @@ void main() {
}) async { }) async {
final bubble = ChatBubbleColor( final bubble = ChatBubbleColor(
name: color, name: color,
child: const ChatUserBubble(cupertino: false, child: Text('Hello')), child: const ChatUserBubble(child: Text('Hello')),
); );
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
@@ -68,9 +68,7 @@ void main() {
testWidgets('a bubble with no colour scope stays neutral', (tester) async { testWidgets('a bubble with no colour scope stays neutral', (tester) async {
await tester.pumpWidget( await tester.pumpWidget(
const MaterialApp( const MaterialApp(
home: Scaffold( home: Scaffold(body: ChatUserBubble(child: Text('Hello'))),
body: ChatUserBubble(cupertino: false, child: Text('Hello')),
),
), ),
); );
final context = tester.element(find.byType(ChatUserBubble)); final context = tester.element(find.byType(ChatUserBubble));