Fix ghosting in native screen transitions

Routed screens are transparent fragments rendered into the shell's single
Scaffold. A screen pushed on top (e.g. device detail) was therefore
see-through, leaving the screen beneath visible as it slid in, and the fade
page ignored secondaryAnimation so the covered screen sat frozen instead of
parallaxing out.

- Paint each routed page opaque (theme surface) so pushes cover cleanly.
- Drill into detail screens with a CupertinoPageTransition slide; the covered
  page parallaxes out via the same route animation, so both move in lockstep
  on the native iOS curve. Tabs keep their crossfade.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
rzuasti
2026-06-07 18:29:57 -04:00
co-authored by Claude Opus 4.8
parent 80f0f54785
commit dedfe1c838
3 changed files with 62 additions and 23 deletions
@@ -6,8 +6,8 @@ void main() {
// The app's real [router] is configured so that switching between top-level
// destinations crossfades (a [CustomTransitionPage]) instead of using the
// default platform slide, which would otherwise leave the outgoing screen
// visible behind the incoming one. Drilling into a detail screen keeps the
// default slide (a plain [GoRoute.builder]).
// visible behind the incoming one. Drilling into a detail screen uses its own
// custom page builder (an opaque iOS-style slide), not the default builder.
List<GoRoute> topLevelRoutes() {
final shell = router.configuration.routes.single as ShellRoute;
return shell.routes.cast<GoRoute>();
@@ -29,17 +29,17 @@ void main() {
}
});
test('the device detail drill-in keeps the default slide builder', () {
test('the device detail drill-in uses a custom page builder (slide)', () {
final devices = routeByName('devices');
final detail = devices.routes.single as GoRoute;
expect(detail.name, 'deviceDetail');
expect(
detail.builder,
detail.pageBuilder,
isNotNull,
reason: 'the detail push should keep the default platform slide',
reason: 'the detail push should use the opaque drill-in slide page',
);
expect(detail.pageBuilder, isNull);
expect(detail.builder, isNull, reason: 'the detail should not also build');
});
});
}