Files
pipelines/app/lib/features/chat/ui/transcript/chat_copy_gutter.dart
T
alan a3a59adb30 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>
2026-11-25 11:10:51 +00:00

94 lines
2.7 KiB
Dart

import 'package:flutter/material.dart';
import 'chat_hover_actions.dart';
/// The width of the strip left of the reading column that an answer row
/// draws its Copy button in (`chatCopyGutter`); 0 when there is no room, and
/// Copy stays in the answer's footer.
class ChatCopyGutter extends InheritedWidget {
const ChatCopyGutter({super.key, required this.width, required super.child});
final double width;
static double of(BuildContext context) =>
context.dependOnInheritedWidgetOfExactType<ChatCopyGutter>()?.width ?? 0;
@override
bool updateShouldNotify(ChatCopyGutter oldWidget) => width != oldWidget.width;
}
/// The transcript's [children] when the list starts [gutter] left of the
/// reading column: every child except the transcript [rows] (which inset
/// themselves) is inset past the gutter, so it keeps to the column.
List<Widget> chatCopyGutterInset(
double gutter,
List<Widget> rows,
List<Widget> children,
) {
if (gutter <= 0) return children;
final own = Set<Widget>.identity()..addAll(rows);
return [
for (final child in children)
if (own.contains(child))
child
else
Padding(
key: child.key,
padding: EdgeInsets.only(left: gutter),
child: child,
),
];
}
/// An answer with its Copy button in the gutter to its left, bottom-aligned
/// with the answer's footer row. On a desktop the button shows while the
/// pointer is over the answer or the button has focus; it stays in the
/// focus order and the semantics tree when hidden. Touch platforms always
/// show it.
class ChatCopyGutterRow extends StatelessWidget {
const ChatCopyGutterRow({
super.key,
required this.width,
required this.copy,
required this.child,
this.pinned = false,
});
final double width;
/// The Copy button, or null when the answer has nothing to copy yet.
final Widget? copy;
final Widget child;
/// Keeps the buttons shown without hover (while the reply reads aloud).
final bool pinned;
@override
Widget build(BuildContext context) {
final copy = this.copy;
return ChatHoverRegion(
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
SizedBox(
key: const Key('chat-copy-gutter'),
width: width,
child: copy == null
? null
: Align(
alignment: Alignment.bottomRight,
child: ChatHoverReveal(
visibilityKey: const Key('chat-copy-gutter-visibility'),
pinned: pinned,
child: copy,
),
),
),
Flexible(child: child),
],
),
);
}
}