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:
@@ -0,0 +1,105 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../ui/adaptive/platform.dart';
|
||||
|
||||
/// The area whose hover reveals a message's actions ([ChatHoverReveal]). On a
|
||||
/// touch device it is the bare [child]: there is no hover and the actions
|
||||
/// always show.
|
||||
class ChatHoverRegion extends StatefulWidget {
|
||||
const ChatHoverRegion({super.key, required this.child});
|
||||
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
State<ChatHoverRegion> createState() => _ChatHoverRegionState();
|
||||
}
|
||||
|
||||
class _ChatHoverRegionState extends State<ChatHoverRegion> {
|
||||
bool _hovered = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!prefersCompactHitTargets(context)) return widget.child;
|
||||
return MouseRegion(
|
||||
onEnter: (_) => setState(() => _hovered = true),
|
||||
onExit: (_) => setState(() => _hovered = false),
|
||||
child: _ChatHoverScope(hovered: _hovered, child: widget.child),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ChatHoverScope extends InheritedWidget {
|
||||
const _ChatHoverScope({required this.hovered, required super.child});
|
||||
|
||||
final bool hovered;
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(_ChatHoverScope oldWidget) =>
|
||||
hovered != oldWidget.hovered;
|
||||
}
|
||||
|
||||
/// A message's action buttons, shown on a pointer device only while the
|
||||
/// enclosing [ChatHoverRegion] is hovered, one of them has focus, or [pinned]
|
||||
/// (a reply reading aloud). Hidden actions stay in the focus order and the
|
||||
/// semantics tree, so keyboard and assistive users still reach them. Touch
|
||||
/// devices always show them.
|
||||
class ChatHoverReveal extends StatefulWidget {
|
||||
const ChatHoverReveal({
|
||||
super.key,
|
||||
required this.child,
|
||||
this.pinned = false,
|
||||
this.visibilityKey,
|
||||
});
|
||||
|
||||
final Widget child;
|
||||
final bool pinned;
|
||||
|
||||
/// The key of the fading widget, for tests.
|
||||
final Key? visibilityKey;
|
||||
|
||||
@override
|
||||
State<ChatHoverReveal> createState() => _ChatHoverRevealState();
|
||||
}
|
||||
|
||||
class _ChatHoverRevealState extends State<ChatHoverReveal> {
|
||||
bool _focused = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final hoverDevice = prefersCompactHitTargets(context);
|
||||
final hovered =
|
||||
context
|
||||
.dependOnInheritedWidgetOfExactType<_ChatHoverScope>()
|
||||
?.hovered ??
|
||||
false;
|
||||
final shown = !hoverDevice || widget.pinned || hovered || _focused;
|
||||
return Focus(
|
||||
canRequestFocus: false,
|
||||
skipTraversal: true,
|
||||
onFocusChange: (focused) => setState(() => _focused = focused),
|
||||
child: AnimatedOpacity(
|
||||
key: widget.visibilityKey,
|
||||
opacity: shown ? 1 : 0,
|
||||
duration: const Duration(milliseconds: 120),
|
||||
alwaysIncludeSemantics: true,
|
||||
child: widget.child,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// The compact, muted style of a message's icon actions (Copy, Read aloud):
|
||||
/// smaller than the text they follow. Touch devices keep a full-size tap
|
||||
/// target around the small icon.
|
||||
ButtonStyle chatMessageActionStyle(BuildContext context) {
|
||||
final compact = prefersCompactHitTargets(context);
|
||||
return IconButton.styleFrom(
|
||||
foregroundColor: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
iconSize: 18,
|
||||
padding: const EdgeInsets.all(8),
|
||||
minimumSize: const Size.square(34),
|
||||
tapTargetSize: compact
|
||||
? MaterialTapTargetSize.shrinkWrap
|
||||
: MaterialTapTargetSize.padded,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user