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:
@@ -23,19 +23,3 @@ ButtonStyle chatBarTextButtonStyle(
|
||||
|
||||
/// Horizontal padding inside the bar's text buttons (model, mode).
|
||||
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 '../../../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) =>
|
||||
Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ import '../../../shell/windows/window_scope.dart';
|
||||
import '../../terminal/terminal_open_action.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
|
||||
@@ -1408,9 +1407,6 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
||||
identifier: 'chat-files-toggle',
|
||||
onPressed: _toggleFiles,
|
||||
materialIcon: _filesVisible ? Icons.folder : Icons.folder_outlined,
|
||||
cupertinoIcon: _filesVisible
|
||||
? CupertinoIcons.folder_fill
|
||||
: CupertinoIcons.folder,
|
||||
),
|
||||
],
|
||||
moreActions: [
|
||||
@@ -1422,7 +1418,6 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
||||
label: 'Chat details',
|
||||
onPressed: _openInfo,
|
||||
materialIcon: Icons.info_outline,
|
||||
cupertinoIcon: CupertinoIcons.info,
|
||||
),
|
||||
...widget.paneControls,
|
||||
chatShellRunMenuAction(onPressed: _runShellFromMenu),
|
||||
|
||||
@@ -15,7 +15,7 @@ class ChatBarAction extends StatelessWidget implements SegmentedOverflowable {
|
||||
required this.label,
|
||||
required this.onPressed,
|
||||
required this.materialIcon,
|
||||
required this.cupertinoIcon,
|
||||
this.cupertinoIcon,
|
||||
this.identifier,
|
||||
});
|
||||
|
||||
@@ -24,7 +24,7 @@ class ChatBarAction extends StatelessWidget implements SegmentedOverflowable {
|
||||
final IconData materialIcon;
|
||||
|
||||
/// Kept for callers; the Material toolbar always draws [materialIcon].
|
||||
final IconData cupertinoIcon;
|
||||
final IconData? cupertinoIcon;
|
||||
final String? identifier;
|
||||
|
||||
/// A narrow bar moves it into its More menu, under the bar's host's icon.
|
||||
|
||||
@@ -16,7 +16,7 @@ class ChatCodeHover {
|
||||
Object token,
|
||||
String text,
|
||||
Offset pointer, {
|
||||
required bool cupertino,
|
||||
bool? cupertino,
|
||||
}) {
|
||||
if (_disposed) return;
|
||||
hide();
|
||||
@@ -64,11 +64,7 @@ class ChatCodeHover {
|
||||
child: Material(
|
||||
elevation: 3,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: ChatCopyButton(
|
||||
text: text,
|
||||
cupertino: false,
|
||||
showLabel: true,
|
||||
),
|
||||
child: ChatCopyButton(text: text, showLabel: true),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -132,12 +128,12 @@ class ChatCodeCopyRegion extends StatefulWidget {
|
||||
const ChatCodeCopyRegion({
|
||||
super.key,
|
||||
required this.code,
|
||||
required this.cupertino,
|
||||
this.cupertino,
|
||||
required this.label,
|
||||
required this.child,
|
||||
});
|
||||
final String code;
|
||||
final bool cupertino;
|
||||
final bool? cupertino;
|
||||
final Widget label, child;
|
||||
@override
|
||||
State<ChatCodeCopyRegion> createState() => _ChatCodeCopyRegionState();
|
||||
@@ -170,7 +166,6 @@ class _ChatCodeCopyRegionState extends State<ChatCodeCopyRegion> {
|
||||
child: SelectionContainer.disabled(
|
||||
child: ChatCopyButton(
|
||||
text: widget.code,
|
||||
cupertino: widget.cupertino,
|
||||
showLabel: true,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -12,15 +12,9 @@ const String chatCopiedLabel = 'Copied';
|
||||
/// the clipboard. It shows a check for a moment after copying, so the operator
|
||||
/// sees the copy landed without a separate toast.
|
||||
class ChatCopyButton extends StatefulWidget {
|
||||
const ChatCopyButton({
|
||||
super.key,
|
||||
required this.text,
|
||||
required this.cupertino,
|
||||
this.showLabel = false,
|
||||
});
|
||||
const ChatCopyButton({super.key, required this.text, this.showLabel = false});
|
||||
|
||||
final String text;
|
||||
final bool cupertino;
|
||||
final bool showLabel;
|
||||
|
||||
@override
|
||||
|
||||
@@ -202,7 +202,6 @@ class _ChatMarkdownViewState extends State<ChatMarkdownView> {
|
||||
);
|
||||
return ChatCodeCopyRegion(
|
||||
code: code,
|
||||
cupertino: false,
|
||||
label: Text(markdownCodeLabel(language), style: labelStyle),
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(color: _codeFill(context)),
|
||||
@@ -274,13 +273,7 @@ class _ChatMarkdownViewState extends State<ChatMarkdownView> {
|
||||
),
|
||||
onEnter: (event) {
|
||||
if (_route?.isCurrent != false) {
|
||||
_codeHover.show(
|
||||
context,
|
||||
token,
|
||||
text,
|
||||
event.position,
|
||||
cupertino: false,
|
||||
);
|
||||
_codeHover.show(context, token, text, event.position);
|
||||
}
|
||||
},
|
||||
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
|
||||
/// text sits on the page, so only the operator's words are enclosed.
|
||||
class ChatUserBubble extends StatelessWidget {
|
||||
const ChatUserBubble({
|
||||
super.key,
|
||||
required this.cupertino,
|
||||
required this.child,
|
||||
});
|
||||
const ChatUserBubble({super.key, required this.child});
|
||||
|
||||
final bool cupertino;
|
||||
final Widget child;
|
||||
|
||||
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
|
||||
/// surface so disclosure ListTiles still paint their ink.
|
||||
class ChatAgentSurface extends StatelessWidget {
|
||||
const ChatAgentSurface({
|
||||
super.key,
|
||||
required this.cupertino,
|
||||
required this.child,
|
||||
});
|
||||
const ChatAgentSurface({super.key, required this.child});
|
||||
|
||||
final bool cupertino;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
@@ -81,7 +71,7 @@ class ChatAgentSurface extends StatelessWidget {
|
||||
|
||||
/// 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.
|
||||
TextStyle? chatMessageTextStyle(BuildContext context, bool cupertino) =>
|
||||
TextStyle? chatMessageTextStyle(BuildContext context, [bool? cupertino]) =>
|
||||
Theme.of(context).textTheme.bodyLarge;
|
||||
|
||||
/// The empty-line gap between two paragraphs of a reply: about one line of
|
||||
|
||||
@@ -87,7 +87,7 @@ class ChatMessageView extends StatelessWidget {
|
||||
: _agentRow(
|
||||
context,
|
||||
content,
|
||||
ChatAgentSurface(cupertino: false, child: body),
|
||||
ChatAgentSurface(child: body),
|
||||
gutter,
|
||||
),
|
||||
),
|
||||
@@ -117,7 +117,7 @@ class ChatMessageView extends StatelessWidget {
|
||||
);
|
||||
final hasTimestamp = chatMessageCreatedAt(_userMessage) != null;
|
||||
if (thumbnails.isEmpty && footer.isEmpty && !hasTimestamp) {
|
||||
return ChatUserBubble(cupertino: false, child: body);
|
||||
return ChatUserBubble(child: body);
|
||||
}
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -132,7 +132,7 @@ class ChatMessageView extends StatelessWidget {
|
||||
if (thumbnails.isNotEmpty && content.isNotEmpty)
|
||||
const SizedBox(height: 6),
|
||||
if (content.isNotEmpty || thumbnails.isEmpty)
|
||||
ChatUserBubble(cupertino: false, child: body),
|
||||
ChatUserBubble(child: body),
|
||||
if (footer.isNotEmpty) ...[
|
||||
const SizedBox(height: 2),
|
||||
Wrap(
|
||||
@@ -181,9 +181,7 @@ class ChatMessageView extends StatelessWidget {
|
||||
double gutter,
|
||||
) {
|
||||
final copyText = row['streaming'] == true ? '' : _answerText(_partsOf(row));
|
||||
final copy = copyText.isEmpty
|
||||
? null
|
||||
: ChatCopyButton(text: copyText, cupertino: false);
|
||||
final copy = copyText.isEmpty ? null : ChatCopyButton(text: copyText);
|
||||
if (gutter <= 0) return _agentTurn(context, content, answer, copy);
|
||||
return ChatCopyGutterRow(
|
||||
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 {
|
||||
final bubble = ChatBubbleColor(
|
||||
name: color,
|
||||
child: const ChatUserBubble(cupertino: false, child: Text('Hello')),
|
||||
child: const ChatUserBubble(child: Text('Hello')),
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
@@ -68,9 +68,7 @@ void main() {
|
||||
testWidgets('a bubble with no colour scope stays neutral', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: ChatUserBubble(cupertino: false, child: Text('Hello')),
|
||||
),
|
||||
home: Scaffold(body: ChatUserBubble(child: Text('Hello'))),
|
||||
),
|
||||
);
|
||||
final context = tester.element(find.byType(ChatUserBubble));
|
||||
|
||||
Reference in New Issue
Block a user