Remove Cupertino chat transcript branches
Keep the existing Material transcript path while preserving public Cupertino parameters for callers. Narrow transcript tests to the Material-only behavior and remove Cupertino-only fixtures.
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../core/api_gateway.dart';
|
||||
import '../sessions/chat_adaptive.dart';
|
||||
import 'chat_message_bubble.dart';
|
||||
import 'chat_message_view.dart';
|
||||
|
||||
@@ -63,66 +61,39 @@ class _ChatAgentReportCardState extends State<ChatAgentReportCard> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino =
|
||||
chatControlsStyleOf(context) == ChatControlsStyle.cupertino;
|
||||
final content = _content(widget.row);
|
||||
final title = content.sender.isEmpty
|
||||
? 'Agent report'
|
||||
: 'Agent report · ${content.sender}';
|
||||
final summary = chatAgentReportSummary(content.text);
|
||||
final secondary = cupertino
|
||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
final secondary = Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
final header = Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.only(end: 12, top: 2),
|
||||
child: Icon(
|
||||
cupertino ? CupertinoIcons.person_crop_rectangle : Icons.assignment,
|
||||
color: secondary,
|
||||
),
|
||||
child: Icon(Icons.assignment, color: secondary),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: cupertino
|
||||
? CupertinoTheme.of(context).textTheme.textStyle.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
)
|
||||
: Theme.of(context).textTheme.titleSmall,
|
||||
),
|
||||
Text(title, style: Theme.of(context).textTheme.titleSmall),
|
||||
if (summary.isNotEmpty)
|
||||
Text(
|
||||
summary,
|
||||
maxLines: _expanded ? null : 1,
|
||||
overflow: _expanded ? null : TextOverflow.ellipsis,
|
||||
style:
|
||||
(cupertino
|
||||
? CupertinoTheme.of(context).textTheme.textStyle
|
||||
: Theme.of(context).textTheme.bodyMedium)
|
||||
?.copyWith(
|
||||
// This summary is readable content, not disabled
|
||||
// chrome; translucent secondaryLabel falls below
|
||||
// normal-text contrast on a light card.
|
||||
color: cupertino
|
||||
? CupertinoColors.label.resolveFrom(context)
|
||||
: secondary,
|
||||
),
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.bodyMedium?.copyWith(color: secondary),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
cupertino
|
||||
? (_expanded
|
||||
? CupertinoIcons.chevron_up
|
||||
: CupertinoIcons.chevron_down)
|
||||
: (_expanded ? Icons.expand_less : Icons.expand_more),
|
||||
_expanded ? Icons.expand_less : Icons.expand_more,
|
||||
color: secondary,
|
||||
),
|
||||
],
|
||||
@@ -135,29 +106,17 @@ class _ChatAgentReportCardState extends State<ChatAgentReportCard> {
|
||||
value: summary,
|
||||
onTap: _toggle,
|
||||
child: ExcludeSemantics(
|
||||
child: cupertino
|
||||
? CupertinoButton(
|
||||
padding: const EdgeInsets.all(12),
|
||||
onPressed: _toggle,
|
||||
child: DefaultTextStyle.merge(
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
child: header,
|
||||
),
|
||||
)
|
||||
: InkWell(
|
||||
onTap: _toggle,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: header,
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: _toggle,
|
||||
child: Padding(padding: const EdgeInsets.all(12), child: header),
|
||||
),
|
||||
),
|
||||
);
|
||||
final body = _expanded
|
||||
? Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(12, 0, 12, 12),
|
||||
child: DefaultTextStyle.merge(
|
||||
style: chatMessageTextStyle(context, cupertino),
|
||||
style: chatMessageTextStyle(context, false),
|
||||
child:
|
||||
widget.textBuilder?.call(context, content.text) ??
|
||||
SelectableText(content.text),
|
||||
@@ -179,23 +138,11 @@ class _ChatAgentReportCardState extends State<ChatAgentReportCard> {
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 720),
|
||||
child: cupertino
|
||||
? DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: CupertinoColors.secondarySystemGroupedBackground
|
||||
.resolveFrom(context),
|
||||
border: Border.all(
|
||||
color: CupertinoColors.separator.resolveFrom(context),
|
||||
),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
child: column,
|
||||
)
|
||||
: Card.outlined(
|
||||
margin: EdgeInsets.zero,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: column,
|
||||
),
|
||||
child: Card.outlined(
|
||||
margin: EdgeInsets.zero,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: column,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -211,22 +158,10 @@ class ChatSystemNoticeLine extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino =
|
||||
chatControlsStyleOf(context) == ChatControlsStyle.cupertino;
|
||||
final text = _content(row).text;
|
||||
if (text.isEmpty) return const SizedBox.shrink();
|
||||
final color = cupertino
|
||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
final style =
|
||||
(cupertino
|
||||
? CupertinoTheme.of(context).textTheme.textStyle
|
||||
: Theme.of(context).textTheme.bodySmall)
|
||||
?.copyWith(
|
||||
color: cupertino
|
||||
? CupertinoColors.label.resolveFrom(context)
|
||||
: color,
|
||||
);
|
||||
final color = Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
final style = Theme.of(context).textTheme.bodySmall?.copyWith(color: color);
|
||||
return Semantics(
|
||||
container: true,
|
||||
label: 'System notice',
|
||||
@@ -240,7 +175,7 @@ class ChatSystemNoticeLine extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.only(end: 8),
|
||||
child: Icon(
|
||||
cupertino ? CupertinoIcons.info_circle : Icons.info_outline,
|
||||
Icons.info_outline,
|
||||
size: style?.fontSize == null ? 16 : style!.fontSize! * 1.2,
|
||||
color: color,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user