Strengthen active chat marker and fade identity tint across selection

This commit is contained in:
2026-11-07 14:34:06 +00:00
parent b7fc221360
commit cc28dcbca0
7 changed files with 49 additions and 20 deletions
@@ -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),
@@ -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,
),
),
@@ -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),
+10 -2
View File
@@ -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(
@@ -68,15 +68,15 @@ void main() {
final color = cupertino
? tester.widget<ColoredBox>(surface).color
: tester.widget<Material>(surface).color;
expect(
color,
active
? AppListRow.selectedColor(
tester.element(row),
cupertino: cupertino,
)
: const Color(0x00000000),
expect(color, const Color(0x00000000));
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);
}
expectRow('a', true);
@@ -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<Material>(find.byKey(appListRowSurfaceKey));
expect(surface.color, Colors.transparent);
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));
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);
@@ -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