01cced95e5
Use an easing curve that visibly begins on the first reverse frame instead of leaving the phone chat page apparently still. Add a regression test and record the measured before/after latency evidence.
55 lines
2.4 KiB
Markdown
55 lines
2.4 KiB
Markdown
# Chat Back starts immediately (phone)
|
|
|
|
## Finding
|
|
|
|
Static reading of the phone chat path (`DetailPageHost`, `ContainerTransformPageRoute`,
|
|
`ContainerTransformFlight`, the chat screen's `_back`, the shell's back handling) found no
|
|
awaited work before the pop. Draft, scroll and transcript saves run fire-and-forget or in
|
|
`dispose`, after the reverse animation. `DetailPageHost`'s `onClosed` runs when the route is
|
|
disposed, so it cannot delay the pop.
|
|
|
|
The delay the user sees is the close curve. Closing used `Curves.fastOutSlowIn.flipped`
|
|
against the animation value, which barely moves for its first ~60 ms. The page sat still
|
|
after Back, then began to shrink.
|
|
|
|
## Change
|
|
|
|
`lib/ui/motion/container_transform_flight.dart`: the closing shrink uses
|
|
`Curves.easeInCubic.transform(t)` on the reverse animation value. That is a shrink that starts
|
|
on the first frame and decelerates into the row. Opening is unchanged. The reverse duration
|
|
stays at `Motion.containerTransformReverse` = 250 ms (≤300 ms).
|
|
|
|
## Measured (widget test, fake frame clock, 390x844, 16 ms per frame)
|
|
|
|
Share of the page's shrink travel completed after each frame following the system Back
|
|
(`handlePopRoute` then `pump`). The first frame after the pop only starts the ticker, so it
|
|
reads 0 in both builds.
|
|
|
|
| Elapsed after pop | Before | After |
|
|
| --- | ---: | ---: |
|
|
| 16 ms | 0.0% | 0.0% |
|
|
| 32 ms | 1.0% | 15.7% |
|
|
| 48 ms | 4.6% | 30.7% |
|
|
| 64 ms | 12.1% | 44.1% |
|
|
| 80 ms | 25.2% | 56.4% |
|
|
|
|
The Back route is no longer current, and its animation is `reverse`, after the first pump
|
|
in both builds. Route change was already synchronous.
|
|
|
|
## Focused tests
|
|
|
|
Command: `tool/memwatch/full.sh 'test/ui/motion/container_transform_back_start_test.dart test/ui/motion/container_transform_route_test.dart test/shell/detail_page_test.dart test/features/chat/chat_open_transition_test.dart'`
|
|
Result: 15 passed, 0 failed (peak 1284 MB, 11 s).
|
|
|
|
- New regression `container_transform_back_start_test.dart`: system Back changes the route
|
|
in one pump, and the page is more than 10% shrunk 16 ms later. The owner's close work
|
|
awaits a future that never completes, and Back still starts. Against the old curve this
|
|
test fails (shrink 0.99%).
|
|
- `tool/analyze.sh`: clean.
|
|
|
|
## Not verified
|
|
|
|
- `tool/chat_back_latency_probe.mjs` (browser) was not run; UI capture belongs to ui-review.
|
|
- Phone device timing was not measured (no device test ran).
|
|
- Leaving the chat list (tab-root Back) was read, not measured: it calls `_select` synchronously.
|