flutter/examples/api/lib/widgets/routes
Mitchell Goodwin d877d2875e
Allow mixing route transitions in one app. (#150031)
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.
2024-10-02 20:08:11 +00:00
..
flexible_route_transitions.0.dart Allow mixing route transitions in one app. (#150031) 2024-10-02 20:08:11 +00:00
flexible_route_transitions.1.dart Allow mixing route transitions in one app. (#150031) 2024-10-02 20:08:11 +00:00
popup_route.0.dart Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
route_observer.0.dart Update RouteObserver example and fix an error thrown (#141166) 2024-01-09 20:48:56 +00:00
show_general_dialog.0.dart Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00