Make the open chat unmistakable in the chat list
The open chat's row now has a strong fill in its colour, a full outline with a thick leading bar, a bold title and a pointer on its trailing edge toward the conversation shown beside the list. A selected chat that is not shown keeps a lighter fill; a chat visible in another pane keeps its thin bar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,38 +20,100 @@ class ChatVisibilityMarker extends StatelessWidget {
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Semantics(
|
||||
label: visible && active
|
||||
? 'Active chat'
|
||||
: visible
|
||||
? 'Visible chat'
|
||||
: null,
|
||||
child: AnimatedContainer(
|
||||
Widget build(BuildContext context) {
|
||||
final dark = chatColorDarkSurface(context);
|
||||
// The open chat: selected and shown beside the list.
|
||||
final open = active && visible;
|
||||
final row = AnimatedContainer(
|
||||
key: ValueKey('chat-visibility-$sessionId'),
|
||||
duration: MediaQuery.disableAnimationsOf(context)
|
||||
? Duration.zero
|
||||
: const Duration(milliseconds: 220),
|
||||
curve: Curves.easeInOut,
|
||||
// The open chat is unmistakable: a strong fill in its colour, a full
|
||||
// outline, a thick leading bar and (below) a pointer toward the
|
||||
// conversation shown beside the list. A chat visible elsewhere keeps a
|
||||
// thin leading bar.
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: AlignmentDirectional.centerStart,
|
||||
end: AlignmentDirectional.centerEnd,
|
||||
colors: [
|
||||
color.withValues(
|
||||
alpha: active ? (chatColorDarkSurface(context) ? .30 : .22) : 0,
|
||||
),
|
||||
color.withValues(alpha: active ? .06 : 0),
|
||||
],
|
||||
),
|
||||
color: open
|
||||
? color.withValues(alpha: dark ? .40 : .28)
|
||||
: active
|
||||
? color.withValues(alpha: dark ? .30 : .22)
|
||||
: null,
|
||||
),
|
||||
foregroundDecoration: BoxDecoration(
|
||||
border: BorderDirectional(
|
||||
start: visible
|
||||
? BorderSide(color: color, width: active ? 10 : 3)
|
||||
: BorderSide.none,
|
||||
),
|
||||
border: open
|
||||
? BorderDirectional(
|
||||
start: BorderSide(color: color, width: 8),
|
||||
top: BorderSide(color: color, width: 2),
|
||||
end: BorderSide(color: color, width: 2),
|
||||
bottom: BorderSide(color: color, width: 2),
|
||||
)
|
||||
: BorderDirectional(
|
||||
start: visible
|
||||
? BorderSide(color: color, width: 3)
|
||||
: BorderSide.none,
|
||||
),
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
);
|
||||
return Semantics(
|
||||
label: visible && active
|
||||
? 'Active chat'
|
||||
: visible
|
||||
? 'Visible chat'
|
||||
: null,
|
||||
selected: active,
|
||||
// Always a Stack, so selecting a chat never rebuilds its row.
|
||||
child: Stack(
|
||||
children: [
|
||||
row,
|
||||
if (open)
|
||||
PositionedDirectional(
|
||||
end: 0,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
child: IgnorePointer(
|
||||
child: Center(
|
||||
child: CustomPaint(
|
||||
key: Key('chat-active-pointer-$sessionId'),
|
||||
size: const Size(9, 18),
|
||||
painter: _Pointer(
|
||||
color: color,
|
||||
rtl: Directionality.of(context) == TextDirection.rtl,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A small triangle on the row's trailing edge, pointing toward the open
|
||||
/// conversation beside the list.
|
||||
class _Pointer extends CustomPainter {
|
||||
const _Pointer({required this.color, required this.rtl});
|
||||
|
||||
final Color color;
|
||||
final bool rtl;
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
final path = rtl
|
||||
? (Path()
|
||||
..moveTo(size.width, 0)
|
||||
..lineTo(0, size.height / 2)
|
||||
..lineTo(size.width, size.height))
|
||||
: (Path()
|
||||
..moveTo(0, 0)
|
||||
..lineTo(size.width, size.height / 2)
|
||||
..lineTo(0, size.height));
|
||||
canvas.drawPath(path..close(), Paint()..color = color);
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(_Pointer old) => old.color != color || old.rtl != rtl;
|
||||
}
|
||||
|
||||
@@ -143,6 +143,9 @@ class ChatSessionRow extends StatelessWidget {
|
||||
title: Text.rich(
|
||||
TextSpan(
|
||||
text: chatSessionTitle(session),
|
||||
style: selected
|
||||
? const TextStyle(fontWeight: FontWeight.w800)
|
||||
: null,
|
||||
children: [
|
||||
if (session['starred'] == true)
|
||||
WidgetSpan(
|
||||
|
||||
Reference in New Issue
Block a user