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
+18 -1
View File
@@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
import '../ui/adaptive/host.dart';
import '../ui/adaptive/segmented_bar.dart';
import '../ui/motion/container_transform_route.dart';
import '../ui/motion/container_transform_source.dart';
import 'destination.dart';
import 'shell_bar.dart';
@@ -26,6 +28,7 @@ class DetailPageHost {
required AppDestination destination,
required WidgetBuilder builder,
required VoidCallback onClosed,
ContainerTransformLink? growFrom,
}) {
if (selected && _route != null) {
// Another route cannot be rebuilt mid-build; the page follows next frame.
@@ -38,6 +41,7 @@ class DetailPageHost {
final route = detailPageRoute(
context,
destination: destination,
growFrom: growFrom,
builder: (context) => ValueListenableBuilder<WidgetBuilder?>(
valueListenable: _content,
builder: (context, build, _) =>
@@ -78,13 +82,26 @@ class DetailPageHost {
/// A full-screen page whose bar shows what the page's content publishes
/// through [ShellBar] (title and actions), with the platform's Back.
///
/// With [growFrom] the page grows out of the list item that opened it and
/// shrinks back into it ([ContainerTransformPageRoute]); otherwise it enters
/// with the platform's page transition.
PageRoute<void> detailPageRoute(
BuildContext context, {
required AppDestination destination,
required WidgetBuilder builder,
ContainerTransformLink? growFrom,
}) {
final page = DetailPane(destination: destination, builder: builder);
return usesCupertinoHost(context)
final cupertino = usesCupertinoHost(context);
if (growFrom != null) {
return ContainerTransformPageRoute<void>(
link: growFrom,
cupertino: cupertino,
builder: (_) => page,
);
}
return cupertino
? CupertinoPageRoute<void>(builder: (_) => page)
: MaterialPageRoute<void>(builder: (_) => page);
}