Skip to content

fix(navigation): previous page frozen when pushing a MaterialPageRoute - #3490

Open
MikaelDDavidd wants to merge 1 commit into
jonataslaw:masterfrom
MikaelDDavidd:fix/outgoing-route-transition-3452
Open

MikaelDDavidd wants to merge 1 commit into
jonataslaw:masterfrom
MikaelDDavidd:fix/outgoing-route-transition-3452

Conversation

@MikaelDDavidd

@MikaelDDavidd MikaelDDavidd commented Nov 14, 2026 •

Copy link
Copy Markdown

Fixes #3452

With GetMaterialApp, pushing a MaterialPageRoute (with Navigator.push, for example) leaves the page underneath frozen. Same thing when you pop it. With a plain MaterialApp both pages animate.

The problem is in GetPageRouteTransitionMixin.canTransitionTo. It only returns true when the next route is a GetPageRoute, a Cupertino route or a CupertinoSheetRoute. A MaterialPageRoute falls through, so the previous route's secondaryAnimation never leaves 0 and the transitions builder has nothing to animate.

I added MaterialRouteTransitionMixin routes to that check, skipping fullscreen dialogs. It's the same condition MaterialPageRoute.canTransitionTo uses in Flutter. The GetPageRoute cases didn't change, so Get.to(..., showCupertinoParallax: false) still keeps the previous page still.

I ran the code from the issue as a web build, once against master and once against this branch, slowed down with timeDilation. The screenshot is the same moment of the push using CupertinoPageTransitionsBuilder, since the 5% scale of the zoom transition is hard to see in a still image. Left is master, right is this branch:

Before and after: page underneath during a MaterialPageRoute push

The tests are in test/navigation/outgoing_route_transition_test.dart. Three of them fail on master: the secondaryAnimation value on push, and the position of the previous page on push and on pop. The other three cover things that shouldn't change (fullscreen dialog, Get.to, and Get.to with showCupertinoParallax: false).

All 228 tests pass on Flutter 3.47.8 and 3.50.0.

Pre-launch Checklist

  • I updated/added relevant documentation (doc comments with ///). No public API changes.
  • I added new tests to check the change I am making or feature I am adding, or @jonataslaw said the PR is test-exempt.
  • All existing and new tests are passing.

GetPageRouteTransitionMixin.canTransitionTo only returned true for
GetPageRoute, Cupertino routes and CupertinoSheetRoute. With a
MaterialPageRoute on top (Navigator.push), the previous route's
secondaryAnimation stayed at 0, so the page underneath didn't move on
push or pop.

Accept MaterialRouteTransitionMixin routes too, except fullscreen
dialogs. Flutter's MaterialPageRoute.canTransitionTo uses the same check.

Fixes jonataslaw#3452

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Previous page animation freezes during route transition with GetMaterialApp

1 participant