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:
2026-11-25 00:10:13 +00:00
parent bfccf39671
commit f72c46d599
5 changed files with 98 additions and 39 deletions
@@ -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(
@@ -63,11 +63,8 @@ void main() {
final highlight = tester.widget<AnimatedContainer>(
find.byKey(ValueKey('chat-visibility-$id')),
);
final gradient =
(highlight.decoration as BoxDecoration).gradient!
as LinearGradient;
expect(gradient.colors.first.a > 0, active);
expect(gradient.colors.last.a > 0, active);
final fill = (highlight.decoration as BoxDecoration).color;
expect(fill != null && fill.a > 0, active);
}
expectRow('a', true);
@@ -215,14 +215,11 @@ void main() {
final highlight = tester.widget<AnimatedContainer>(
find.byKey(const ValueKey('chat-visibility-s1')),
);
final gradient =
(highlight.decoration as BoxDecoration).gradient! as LinearGradient;
expect(gradient.colors.first.a, greaterThan(gradient.colors.last.a));
// The selected row is filled in its own colour.
final fill = (highlight.decoration as BoxDecoration).color!;
expect(fill.a, greaterThan(0));
final context = tester.element(find.byType(ChatSessionRow));
expect(
gradient.colors.first.withValues(alpha: 1),
chatColorShade(context, 'amber'),
);
expect(fill.withValues(alpha: 1), chatColorShade(context, 'amber'));
expect(find.byKey(appListRowAccentKey), findsNothing);
expect(find.byKey(const ValueKey('chat-visibility-s1')), findsOneWidget);
});
@@ -79,9 +79,9 @@ void main() {
await tester.pump();
await tester.pump(const Duration(milliseconds: 100));
expect(edge(tester, 'on').width, greaterThan(3));
expect(edge(tester, 'on').width, lessThan(10));
expect(edge(tester, 'on').width, lessThan(8));
await tester.pumpAndSettle();
expect(edge(tester, 'on').width, 10);
expect(edge(tester, 'on').width, 8);
update(() => active = false);
await tester.pumpAndSettle();
expect(edge(tester, 'on').width, 3);
@@ -128,7 +128,7 @@ void main() {
await tester.tap(find.byTooltip('New chat'));
expect(newChatPressed, isTrue);
expect(find.byTooltip('Expand chat list'), findsOneWidget);
expect(edge(tester, 'a').width, 10);
expect(edge(tester, 'a').width, 8);
expect(edge(tester, 'b').width, 3);
expect(edge(tester, 'c').style, BorderStyle.none);
final avatars = tester