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:
@@ -0,0 +1,79 @@
|
||||
# Chat opens as a container transform from its row
|
||||
|
||||
User request: "for the hero animation in the chat list, I meant like the chat
|
||||
expanding from the list, not just the icon".
|
||||
|
||||
## Behaviour
|
||||
|
||||
On a phone (list and chat not side by side) tapping a chat row grows the row
|
||||
itself into the full chat page; Back shrinks the page back into the row.
|
||||
|
||||
- The surface morphs: bounds go from the row's rectangle to the full page
|
||||
(`Curves.fastOutSlowIn`, played backwards for the close), colour goes from
|
||||
the row's tint over the list background to the page background, and the
|
||||
row's leading-edge marker (chat colour, 3 or 10 px) narrows to nothing.
|
||||
- Content cross-fades: opening covers the row content in the first 20 % and
|
||||
fades the page in over 25-70 %; closing fades the page out in the first
|
||||
30 % and uncovers the real row underneath in the last 30 %.
|
||||
- The list behind does not move (the route refuses a secondary transition);
|
||||
it dims by at most 20 % (`Motion.containerTransformScrim`) with the
|
||||
page's size.
|
||||
- Timing: `Motion.containerTransform` (300 ms) and
|
||||
`Motion.containerTransformReverse` (250 ms). The animation-speed setting
|
||||
scales them through `timeDilation`, as for every route.
|
||||
- Reduced motion: no movement; the page fades in place (Flutter's
|
||||
`AnimationBehavior.normal` additionally shortens the route under the
|
||||
system setting).
|
||||
- No row on screen (deep link at start-up, the row scrolled away, or the page
|
||||
switched to a chat whose row is not laid out): the page fades instead.
|
||||
- Closing resolves the row again, so after Next chat or the quick-switch tape
|
||||
the page shrinks into the row of the chat now open.
|
||||
- Cupertino host: the native swipe from the start edge (20 px, or the notch
|
||||
inset) drives the shrink with the finger, linearly; release commits by
|
||||
fling or past halfway, otherwise it settles back, as iOS does. A page pushed
|
||||
over the chat keeps the Cupertino parallax.
|
||||
- Android: system predictive back drives the same shrink; cancel restores
|
||||
the page, commit pops it.
|
||||
- Wide layouts (list beside the pane) and the workspace-after-wide path are
|
||||
unchanged: neither pushes this route.
|
||||
- The old identity-avatar `Hero` (row avatar to header) is removed: a
|
||||
separate flying avatar over a fading container does not compose, and
|
||||
Material's container transform is itself the shared element.
|
||||
|
||||
## Code
|
||||
|
||||
- `lib/ui/motion/container_transform_route.dart`: `ContainerTransformPageRoute`
|
||||
(durations, opacity, swipe settle logic).
|
||||
- `lib/ui/motion/container_transform_flight.dart`: the morph itself; one fixed
|
||||
widget tree in every state, so the chat page keeps its state and scroll.
|
||||
- `lib/ui/motion/container_transform_gestures.dart`: Cupertino edge swipe and
|
||||
Android predictive back forwarding.
|
||||
- `lib/ui/motion/container_transform_source.dart`: rows register their
|
||||
rectangle, surface and marker by id under a `ContainerTransformScope`.
|
||||
- `lib/shell/detail_page.dart`: `DetailPageHost.sync(growFrom:)` and
|
||||
`detailPageRoute(growFrom:)`; runs and pipelines keep the platform route.
|
||||
- `lib/features/chat/screen.dart`: scope around the list; link resolves the
|
||||
currently selected chat.
|
||||
- `lib/features/chat/ui/sessions/session_row_content.dart`: row registers as a
|
||||
source (tint via the new `AppListRow.tintFor`).
|
||||
|
||||
## Verification
|
||||
|
||||
- `tool/memwatch/full.sh 'test/features/chat test/shell test/ui'`: PASS,
|
||||
1604 passed, 0 failed.
|
||||
- `tool/analyze.sh`: clean.
|
||||
- Tests: `test/ui/motion/container_transform_route_test.dart` (row rect to
|
||||
full page and back, list stays put, reduced-motion fade, missing row fade,
|
||||
Cupertino swipe follows the finger and commits, short swipe settles back,
|
||||
Android predictive back cancel and commit) and
|
||||
`test/features/chat/chat_open_transition_test.dart` (real `ChatScreen` at
|
||||
390x844 grows and shrinks with no Hero, reduced-motion fade, 1280x800
|
||||
opens beside the list with no transform, row surface/marker, Motion timing).
|
||||
- Real Chrome, fixture `?chats=3&rich=1&colors=1`, 390x844, filmed with
|
||||
`film=` (half animation speed so the headless screencast catches frames,
|
||||
plus one at 1x): Material dark, Material light and Cupertino light open and
|
||||
close contact sheets, and a held mid-swipe on Cupertino showing the page
|
||||
shrunk toward the row. The kit warns about widths under 500 px; these
|
||||
captures rendered correctly.
|
||||
- Not verified on a device (iOS swipe and Android predictive back were only
|
||||
exercised in widget tests and, for the swipe, with a mouse drag in Chrome).
|
||||
@@ -1,5 +1,5 @@
|
||||
# Mobile chat opening transition
|
||||
|
||||
The mobile chat row and conversation header share the chat identity avatar through a native Flutter `Hero`. The identity is added inside the existing title pill, preserving the colored header wash and desktop title geometry. Wide list/detail panes and reduced-motion contexts do not create a flight.
|
||||
|
||||
Focused behavioral coverage is in `test/features/chat/chat_open_transition_test.dart`; it uses a fake chat, checks the mobile route opens/returns with the identity in the header, verifies an intermediate Hero geometry during the route animation, and checks reduced motion omits `Hero`.
|
||||
Superseded by `chat-open-container-transform.md`: the tapped row itself grows
|
||||
into the chat page and shrinks back on Back. The earlier identity-avatar
|
||||
`Hero` between the row and the header was removed.
|
||||
|
||||
Reference in New Issue
Block a user