Grow the tapped chat row into the chat page on phones

Replace the identity-avatar Hero with a container transform: the row's
surface, tint and edge marker morph into the full page while the content
cross-fades, and Back, the Cupertino edge swipe or Android predictive back
shrink the page into the open chat's row. Reduced motion or a row off
screen fades instead; wide layouts are unchanged.
This commit is contained in:
2026-11-10 03:11:05 +00:00
parent 60b4c495f1
commit eea1361980
16 changed files with 1392 additions and 124 deletions
@@ -6,7 +6,7 @@ import '../../../../core/api_gateway.dart';
import '../../../../ui/layout/app_list_avatar.dart';
import '../../../../ui/layout/app_list_row.dart';
import '../../../../ui/text/relative_time_label.dart';
import '../../../../shell/list_detail_policy.dart';
import '../../../../ui/motion/container_transform_source.dart';
import '../../domain/chat_colors.dart';
import '../../domain/chat_list_activity.dart';
import '../../domain/chat_sessions.dart';
@@ -65,11 +65,34 @@ class ChatSessionRow extends StatelessWidget {
final id = '${session['id'] ?? ''}';
final cupertino =
chatControlsStyleOf(context) == ChatControlsStyle.cupertino;
final closed = chatSessionRowStatus(session, unseen: false) == 'Closed';
final unread = unseen && !closed;
final accent = cupertino
? CupertinoTheme.of(context).primaryColor
: Theme.of(context).colorScheme.primary;
final shade = chatColorShade(context, chatSessionColor(session));
final marker = shade ?? accent;
final tint = AppListRow.tintFor(context, shade, cupertino: cupertino);
final background = cupertino
? CupertinoDynamicColor.resolve(
CupertinoTheme.of(context).scaffoldBackgroundColor,
context,
)
: Theme.of(context).scaffoldBackgroundColor;
// On a phone the chat's page grows out of this row and shrinks back
// into it; the surface it starts from is the row's tint over the list.
return ContainerTransformSource(
id: id,
color: tint == null ? background : Color.alphaBlend(tint, background),
marker: marker,
markerWidth: visible ? (selected ? 10 : 3) : 0,
child: _marked(context, id, marker, accent),
);
}
Widget _marked(BuildContext context, String id, Color marker, Color accent) {
final cupertino =
chatControlsStyleOf(context) == ChatControlsStyle.cupertino;
final closed = chatSessionRowStatus(session, unseen: false) == 'Closed';
final unread = unseen && !closed;
final text = chatSessionSubtitle(session);
final updatedAt = _chatSessionInstant(session['updated_at']);
final avatar = ChatSessionAvatar(
@@ -80,15 +103,9 @@ class ChatSessionRow extends StatelessWidget {
: chatSessionBackgroundTasks(session),
selected: selected,
);
final mobileHero =
!showsListBesideDetail(context) &&
!(MediaQuery.maybeDisableAnimationsOf(context) ?? false);
final identity = mobileHero
? Hero(tag: 'chat-identity-$id', child: avatar)
: avatar;
return ChatVisibilityMarker(
sessionId: id,
color: chatColorShade(context, chatSessionColor(session)) ?? accent,
color: marker,
visible: visible,
active: selected,
child: AppListRow(
@@ -102,7 +119,7 @@ class ChatSessionRow extends StatelessWidget {
onLongPress: selectionOnly ? null : onLongPress,
accent: chatColorShade(context, chatSessionColor(session)),
showAccentBorder: false,
leading: identity,
leading: avatar,
// The star rides in the title's own text, so a narrow row ellipsises
// them together.
title: Text.rich(