flightShuttleBuilder property

HeroFlightShuttleBuilder? flightShuttleBuilder

Optional override to supply a widget that's shown during the hero's flight.

This in-flight widget can depend on the route transition's animation as well as the incoming and outgoing routes' Hero descendants' widgets and layout.

When both the source and destination Heroes provide a flightShuttleBuilder, the destination's flightShuttleBuilder takes precedence.

If none is provided, the destination route's Hero child is shown in-flight by default.


If a widget built by flightShuttleBuilder takes part in a Navigator push transition, that widget or its descendants must not have any GlobalKey that is used in the source Hero's descendant widgets. That is because both subtrees will be included in the widget tree during the Hero flight animation, and GlobalKeys must be unique across the entire widget tree.

If the said GlobalKey is essential to your application, consider providing a custom placeholderBuilder for the source Hero, to avoid the GlobalKey collision, such as a builder that builds an empty SizedBox, keeping the Hero child's original size.


final HeroFlightShuttleBuilder? flightShuttleBuilder;