Quieter transcript metadata: day dividers, time-only rows, muted meta rows
- Date once per calendar day: a muted centred divider above each day's
first timed row (chatDayDividers); rows show only their time ("10:16"),
with the full date and time kept in the tooltip and semantics. The user's
time shares the delivery line; a harness notice's time trails its line.
- Activity line and turn chips are secondary: bodyMedium, regular weight,
onSurfaceVariant (error colour kept for failures), a small chevron_right
that turns down while its details are open (replaces expand_less).
- Copy / Read aloud: 18 px muted icons; on pointer devices shown only while
the reply is hovered or an action is focused (also without the gutter);
touch keeps them visible with a full tap target. The time leads the
footer so hidden actions leave no gap.
- Settled questions: the question on one line, the operator's answer in
full on its own line beneath it.
- Meta rows (activity, chips, notices, compaction line) start at the reply
text's leading edge; turn chips sit in their own column under the answer.
- Scroll fixture: ?timestamps=1 spreads messages over two days.
Row keys are unchanged; the divider joins a row without replacing it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../ui/adaptive/app_popups.dart';
|
||||
import 'chat_turn_activity_view.dart';
|
||||
|
||||
/// The quiet chip under an agent turn (its tools, its permissions) and the
|
||||
/// native sheet it opens.
|
||||
class ChatTurnChip extends StatelessWidget {
|
||||
///
|
||||
/// Its leading icon starts at the reply text's edge: the chip sits at the
|
||||
/// row's edge with the same inset as the turn's activity line. Its chevron is
|
||||
/// the transcript's expand affordance and turns down while the sheet is open.
|
||||
class ChatTurnChip extends StatefulWidget {
|
||||
const ChatTurnChip({
|
||||
super.key,
|
||||
required this.chipKey,
|
||||
@@ -16,6 +21,7 @@ class ChatTurnChip extends StatelessWidget {
|
||||
this.open,
|
||||
this.ellipsizeLabel = false,
|
||||
this.labelSpans,
|
||||
this.detail,
|
||||
}) : assert(sheet != null || open != null);
|
||||
|
||||
final Key chipKey;
|
||||
@@ -38,35 +44,72 @@ class ChatTurnChip extends StatelessWidget {
|
||||
/// plain text. Pieces without their own style inherit the chip's style.
|
||||
final List<InlineSpan> Function(BuildContext context)? labelSpans;
|
||||
|
||||
/// A second line under the label, shown in full (a question's answer).
|
||||
final Widget? detail;
|
||||
|
||||
@override
|
||||
State<ChatTurnChip> createState() => _ChatTurnChipState();
|
||||
}
|
||||
|
||||
class _ChatTurnChipState extends State<ChatTurnChip> {
|
||||
bool _open = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final content = Row(
|
||||
final labelRow = Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
leading,
|
||||
const SizedBox(width: 6),
|
||||
if (ellipsizeLabel)
|
||||
if (widget.ellipsizeLabel || widget.detail != null)
|
||||
Flexible(child: _label(maxLines: 1, overflow: TextOverflow.ellipsis))
|
||||
else
|
||||
_label(),
|
||||
Icon(Icons.expand_less, size: 14, color: color),
|
||||
const SizedBox(width: 2),
|
||||
AnimatedRotation(
|
||||
turns: _open ? 0.25 : 0,
|
||||
duration: const Duration(milliseconds: 150),
|
||||
child: Icon(Icons.chevron_right, size: 18, color: widget.color),
|
||||
),
|
||||
],
|
||||
);
|
||||
final content = Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.only(top: 2),
|
||||
child: widget.leading,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Flexible(
|
||||
child: widget.detail == null
|
||||
? labelRow
|
||||
: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [labelRow, widget.detail!],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
return Semantics(
|
||||
button: true,
|
||||
expanded: _open,
|
||||
// The child's own action is excluded with its label, so the node
|
||||
// carries the activation for assistive technology.
|
||||
onTap: () => _open(context),
|
||||
label: semanticsLabel,
|
||||
onTap: _show,
|
||||
label: widget.semanticsLabel,
|
||||
excludeSemantics: true,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 2),
|
||||
child: InkWell(
|
||||
key: chipKey,
|
||||
key: widget.chipKey,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
onTap: () => _open(context),
|
||||
onTap: _show,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 6),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: chatAgentContentInset,
|
||||
vertical: 6,
|
||||
),
|
||||
child: content,
|
||||
),
|
||||
),
|
||||
@@ -75,10 +118,15 @@ class ChatTurnChip extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _label({int? maxLines, TextOverflow? overflow}) {
|
||||
final style = TextStyle(color: color, fontSize: 13);
|
||||
final spans = labelSpans;
|
||||
final style = chatTurnChipTextStyle(context, widget.color);
|
||||
final spans = widget.labelSpans;
|
||||
if (spans == null) {
|
||||
return Text(label, maxLines: maxLines, overflow: overflow, style: style);
|
||||
return Text(
|
||||
widget.label,
|
||||
maxLines: maxLines,
|
||||
overflow: overflow,
|
||||
style: style,
|
||||
);
|
||||
}
|
||||
return Builder(
|
||||
builder: (context) => Text.rich(
|
||||
@@ -90,12 +138,27 @@ class ChatTurnChip extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _open(BuildContext context) {
|
||||
if (open case final open?) return open(context);
|
||||
return showChatTurnSheet(context, sheet!);
|
||||
Future<void> _show() async {
|
||||
if (_open) return;
|
||||
setState(() => _open = true);
|
||||
try {
|
||||
if (widget.open case final open?) {
|
||||
await open(context);
|
||||
} else {
|
||||
await showChatTurnSheet(context, widget.sheet!);
|
||||
}
|
||||
} finally {
|
||||
if (mounted) setState(() => _open = false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The secondary text of a turn's meta rows (chips, the activity line):
|
||||
/// smaller and quieter than the reply's prose.
|
||||
TextStyle? chatTurnChipTextStyle(BuildContext context, Color color) => Theme.of(
|
||||
context,
|
||||
).textTheme.bodyMedium?.copyWith(color: color, fontWeight: FontWeight.w400);
|
||||
|
||||
/// The detail surface a turn chip opens: a dialog on desktop and a bottom
|
||||
/// sheet on a phone.
|
||||
Future<void> showChatTurnSheet(BuildContext context, Widget sheet) {
|
||||
|
||||
Reference in New Issue
Block a user