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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user