builder property

TransitionBuilder builder

A builder for inserting widgets above the Navigator but below the other widgets created by the MaterialApp widget, or for replacing the Navigator entirely.

For example, from the BuildContext passed to this method, the Directionality, Localizations, DefaultTextStyle, MediaQuery, etc, are all available. They can also be overridden in a way that impacts all the routes in the Navigator.

This is rarely useful, but can be used in applications that wish to override those defaults, e.g. to force the application into right-to-left mode despite being in English, or to override the MediaQuery metrics (e.g. to leave a gap for advertisements shown by a plugin from OEM code).

The builder callback is passed two arguments, the BuildContext (as context) and a Navigator widget (as child).

If no routes are provided using home, routes, onGenerateRoute, or onUnknownRoute, the child will be null, and it is the responsibility of the builder to provide the application's routing machinery.

If routes are provided using one or more of those properties, then child is not null, and the returned value should include the child in the widget subtree; if it does not, then the application will have no navigator and the navigatorKey, home, routes, onGenerateRoute, onUnknownRoute, initialRoute, and navigatorObservers properties will have no effect.

If builder is null, it is as if a builder was specified that returned the child directly. If it is null, routes must be provided using one of the other properties listed above.

Unless a Navigator is provided, either implicitly from builder being null, or by a builder including its child argument, or by a builder explicitly providing a Navigator of its own, features such as showDialog and showMenu, widgets such as Tooltip, PopupMenuButton, or Hero, and APIs such as Navigator.push and Navigator.pop, will not function.

For specifically overriding the title with a value based on the Localizations, consider onGenerateTitle instead.


final TransitionBuilder builder