Material Navigator¶
MaterialNavigator is a Material Design 3-flavored subclass of Navigator. It is automatically configured by App.
The only difference from the base Navigator is the default transition: when you push a plain Widget, MaterialNavigator wraps it in a Route pre-configured with the MD3 page transition. Pushing an explicit Route bypasses this default and uses whatever transition_spec you provide.
Import convention
App and Navigator are the public names exported from nuiitivet.material for these classes.
Import and use them by these names throughout your code.
The rest of this guide follows this convention.
Automatic Setup¶
Passing a plain Widget to App is all that is needed. App wraps it in a MaterialNavigator automatically.
Accessing¶
App registers the MaterialNavigator as the root navigator.
import nuiitivet.material as nv
nv.Navigator.of(self) # root navigator
nv.Navigator.of(self) # nearest ancestor Navigator — use only with nested navigators
Neither can be resolved from a widget's __init__. Resolve one in the event handler, every time.
Further Reading¶
| Topic | Guide |
|---|---|
| push / pop basics | Navigation Overview |
| Custom transitions | Route and Animations |
| Intent-based routing | Intent-Based Navigation |
| Nested navigation | Nested Navigation |