From cc28dcbca04409db64d5809c57b8ccad8452e1bf Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Sat, 7 Nov 2026 14:34:06 +0000 Subject: [PATCH] Strengthen active chat marker and fade identity tint across selection --- .../ui/sessions/chat_compact_sidebar.dart | 2 +- .../ui/sessions/chat_visibility_marker.dart | 19 ++++++++++++++++--- .../chat/ui/sessions/session_row_content.dart | 1 + app/lib/ui/layout/app_list_row.dart | 12 ++++++++++-- .../sessions/chat_active_selection_test.dart | 16 ++++++++-------- .../chat/ui/sessions/chat_color_test.dart | 13 ++++++++++--- .../sessions/chat_visibility_marker_test.dart | 6 +++--- 7 files changed, 49 insertions(+), 20 deletions(-) diff --git a/app/lib/features/chat/ui/sessions/chat_compact_sidebar.dart b/app/lib/features/chat/ui/sessions/chat_compact_sidebar.dart index b667be42..30e2ad6d 100644 --- a/app/lib/features/chat/ui/sessions/chat_compact_sidebar.dart +++ b/app/lib/features/chat/ui/sessions/chat_compact_sidebar.dart @@ -76,7 +76,7 @@ class ChatCompactSidebar extends StatelessWidget { duration: MediaQuery.disableAnimationsOf(context) ? Duration.zero : const Duration(milliseconds: 200), - color: color.withValues(alpha: selected ? .24 : .07), + color: selected ? Colors.transparent : color.withValues(alpha: .07), child: _button( context, chatSessionTitle(row), diff --git a/app/lib/features/chat/ui/sessions/chat_visibility_marker.dart b/app/lib/features/chat/ui/sessions/chat_visibility_marker.dart index 46597908..c9439f8c 100644 --- a/app/lib/features/chat/ui/sessions/chat_visibility_marker.dart +++ b/app/lib/features/chat/ui/sessions/chat_visibility_marker.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'chat_color_palette.dart'; /// A chat's colour identifies it; this animated edge identifies where it is /// visible. The active chat has a stronger edge in both list presentations. @@ -20,7 +21,7 @@ class ChatVisibilityMarker extends StatelessWidget { @override Widget build(BuildContext context) => Semantics( - label: active + label: visible && active ? 'Active chat' : visible ? 'Visible chat' @@ -29,12 +30,24 @@ class ChatVisibilityMarker extends StatelessWidget { key: ValueKey('chat-visibility-$sessionId'), duration: MediaQuery.disableAnimationsOf(context) ? Duration.zero - : const Duration(milliseconds: 200), + : const Duration(milliseconds: 220), curve: Curves.easeInOut, + 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), + ], + ), + ), foregroundDecoration: BoxDecoration( border: BorderDirectional( start: visible - ? BorderSide(color: color, width: active ? 7 : 3) + ? BorderSide(color: color, width: active ? 10 : 3) : BorderSide.none, ), ), diff --git a/app/lib/features/chat/ui/sessions/session_row_content.dart b/app/lib/features/chat/ui/sessions/session_row_content.dart index 66e4f8bd..810fd27f 100644 --- a/app/lib/features/chat/ui/sessions/session_row_content.dart +++ b/app/lib/features/chat/ui/sessions/session_row_content.dart @@ -78,6 +78,7 @@ class ChatSessionRow extends StatelessWidget { key: Key('chat-row-$id'), cupertino: cupertino, selected: selected, + selectedFill: Colors.transparent, emphasized: unread, divider: divider, onTap: () => onOpen(session), diff --git a/app/lib/ui/layout/app_list_row.dart b/app/lib/ui/layout/app_list_row.dart index 5183f6d3..45d6a118 100644 --- a/app/lib/ui/layout/app_list_row.dart +++ b/app/lib/ui/layout/app_list_row.dart @@ -69,6 +69,7 @@ class AppListRow extends StatelessWidget { this.selectionControl, this.tapKey, this.selected = false, + this.selectedFill, this.emphasized = false, this.divider = true, this.compactWidth = kAppListRowCompactWidth, @@ -82,6 +83,9 @@ class AppListRow extends StatelessWidget { /// marks the open row, so the two never read as one another. final Color? accent; + /// Optional feature-specific selection surface, retaining selection semantics. + final Color? selectedFill; + /// Retain identity tint while a feature supplies its own visibility marker. final bool showAccentBorder; @@ -179,12 +183,13 @@ class AppListRow extends StatelessWidget { onLongPress: onLongPress, selected: selected, tint: tint, + selectedFill: selectedFill, child: content, ) : Material( key: appListRowSurfaceKey, color: selected - ? selectedColor(context, cupertino: false) + ? selectedFill ?? selectedColor(context, cupertino: false) : tint ?? Colors.transparent, child: InkWell( key: tapKey, @@ -395,11 +400,13 @@ class _CupertinoRowSurface extends StatefulWidget { required this.selected, this.onLongPress, this.tint, + this.selectedFill, required this.child, }); /// The unselected row's tint, transparent when null. final Color? tint; + final Color? selectedFill; final Key? tapKey; final VoidCallback? onTap; @@ -423,7 +430,8 @@ class _CupertinoRowSurfaceState extends State<_CupertinoRowSurface> { final color = _pressed ? CupertinoColors.systemGrey4.resolveFrom(context) : widget.selected - ? AppListRow.selectedColor(context, cupertino: true) + ? widget.selectedFill ?? + AppListRow.selectedColor(context, cupertino: true) : widget.tint ?? const Color(0x00000000); final enabled = widget.onTap != null; return GestureDetector( diff --git a/app/test/features/chat/ui/sessions/chat_active_selection_test.dart b/app/test/features/chat/ui/sessions/chat_active_selection_test.dart index aa9fe47b..566b1adf 100644 --- a/app/test/features/chat/ui/sessions/chat_active_selection_test.dart +++ b/app/test/features/chat/ui/sessions/chat_active_selection_test.dart @@ -68,15 +68,15 @@ void main() { final color = cupertino ? tester.widget(surface).color : tester.widget(surface).color; - expect( - color, - active - ? AppListRow.selectedColor( - tester.element(row), - cupertino: cupertino, - ) - : const Color(0x00000000), + expect(color, const Color(0x00000000)); + final highlight = tester.widget( + 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); } expectRow('a', true); diff --git a/app/test/features/chat/ui/sessions/chat_color_test.dart b/app/test/features/chat/ui/sessions/chat_color_test.dart index 77278ccf..cf958438 100644 --- a/app/test/features/chat/ui/sessions/chat_color_test.dart +++ b/app/test/features/chat/ui/sessions/chat_color_test.dart @@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; +import 'package:pipelines_app/features/chat/ui/sessions/chat_color_palette.dart'; import 'package:pipelines_app/features/chat/data/chat_repository.dart'; import 'package:pipelines_app/features/chat/ui/sessions/chat_sessions_controller.dart'; import 'package:pipelines_app/features/chat/ui/sessions/chat_sessions_screen.dart'; @@ -207,11 +208,17 @@ void main() { ), ); final surface = tester.widget(find.byKey(appListRowSurfaceKey)); + expect(surface.color, Colors.transparent); + final highlight = tester.widget( + 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)); final context = tester.element(find.byType(ChatSessionRow)); expect( - surface.color, - AppListRow.selectedColor(context, cupertino: false), - reason: 'The selected fill, not the tint, marks the open row', + gradient.colors.first.withValues(alpha: 1), + chatColorShade(context, 'amber'), ); expect(find.byKey(appListRowAccentKey), findsNothing); expect(find.byKey(const ValueKey('chat-visibility-s1')), findsOneWidget); diff --git a/app/test/features/chat/ui/sessions/chat_visibility_marker_test.dart b/app/test/features/chat/ui/sessions/chat_visibility_marker_test.dart index 25aead6d..7642e111 100644 --- a/app/test/features/chat/ui/sessions/chat_visibility_marker_test.dart +++ b/app/test/features/chat/ui/sessions/chat_visibility_marker_test.dart @@ -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(7)); + expect(edge(tester, 'on').width, lessThan(10)); await tester.pumpAndSettle(); - expect(edge(tester, 'on').width, 7); + expect(edge(tester, 'on').width, 10); update(() => active = false); await tester.pumpAndSettle(); expect(edge(tester, 'on').width, 3); @@ -123,7 +123,7 @@ void main() { ); await tester.pumpAndSettle(); expect(find.byTooltip('Expand chat list'), findsOneWidget); - expect(edge(tester, 'a').width, 7); + expect(edge(tester, 'a').width, 10); expect(edge(tester, 'b').width, 3); expect(edge(tester, 'c').style, BorderStyle.none); final avatars = tester