mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
![]() Fixes #33799 Allows for a route to inform the route below it in the navigation stack how to animate when the topmost route enters are leaves the stack. It does this by making a `DelegatedTransition` available for the previous route to look up and use. If available, the route lower in the stack will wrap it's transition builders with that delegated transition and use it instead of it's default secondary transition. This is what the sample code in this PR shows an app that is able to use both a Material zoom transition and a Cupertino slide transition in one app. It also includes a custom vertical transition. Every page animates off the screen in a way to match up with the incoming page's transition. When popped, the correct transitions play in reverse. https://github.com/user-attachments/assets/1fc910fa-8cde-4e05-898e-daad8ff4a697 The below video shows this logic making a pseudo iOS styled sheet transition. https://github.com/flutter/flutter/assets/58190796/207163d8-d87f-48b1-aad9-7e770d1d96c5 All existing page transitions in Flutter will be overwritten by the incoming route if a `delegatedTransition` is provided. This can be opted out of through `canTransitionTo` for a new route widget. Of Flutter's existing page transitions, this PR only adds a `DelegatedTransition` for the Zoom and Cupertino transitions. The other transitions possible in Material will get delegated transitions in a later PR. |
||
---|---|---|
.. | ||
flexible_route_transitions.0.dart | ||
flexible_route_transitions.1.dart | ||
popup_route.0.dart | ||
route_observer.0.dart | ||
show_general_dialog.0.dart |