Skip to main content

NavigatorState

Struct NavigatorState 

Source
pub struct NavigatorState { /* private fields */ }
Expand description

The state for a Navigator widget.

A reference to this class can be obtained by calling Navigator::of.

Implementations§

Source§

impl NavigatorState

Source

pub fn focus_node(self: Handle<Self>, app: &App) -> Handle<FocusNode>

The focus node for this navigator.

The navigator will attempt to focus this node when the top-most route changes.

Source

pub fn user_gesture_in_progress(self: Handle<Self>, app: &App) -> bool

True if the state’s user_gesture_in_progress_notifier value is true, meaning a route is being moved by a user gesture.

Source

pub fn user_gesture_in_progress_notifier( self: Handle<Self>, app: &App, ) -> Handle<ValueNotifier<bool>>

Notifies its listeners if the value of user_gesture_in_progress changes.

Source

pub fn overlay( self: Handle<Self>, app: &mut App, ) -> Option<Handle<OverlayState>>

The OverlayState of the Overlay this navigator builds, once it is mounted.

Source§

impl NavigatorState

Source

pub fn push_named( self: Handle<Self>, app: &mut App, route_name: &str, arguments: Option<Rc<dyn Any>>, ) -> CompleterFuture<RouteResult> ⓘ

Push a named route onto the navigator.

The route name will be passed to Navigator::on_generate_route.

Returns a future that completes to the result value passed to pop when the pushed route is popped off the navigator.

Source

pub fn restorable_push_named( self: Handle<Self>, app: &mut App, route_name: &str, arguments: Option<RestorationData>, ) -> String

Push a named route onto the navigator and return its restoration ID.

The route name will be passed to Navigator::on_generate_route.

Source

pub fn push_replacement_named( self: Handle<Self>, app: &mut App, route_name: &str, result: RouteResult, arguments: Option<Rc<dyn Any>>, ) -> CompleterFuture<RouteResult> ⓘ

Replace the current route of the navigator by pushing the route named route_name and then disposing the previous route once the animation has completed.

Source

pub fn restorable_push_replacement_named( self: Handle<Self>, app: &mut App, route_name: &str, result: RouteResult, arguments: Option<RestorationData>, ) -> String

The restorable version of push_replacement_named.

Source

pub fn pop_and_push_named( self: Handle<Self>, app: &mut App, route_name: &str, result: RouteResult, arguments: Option<Rc<dyn Any>>, ) -> CompleterFuture<RouteResult> ⓘ

Pop the current route off the navigator and push a named route in its place.

Source

pub fn restorable_pop_and_push_named( self: Handle<Self>, app: &mut App, route_name: &str, result: RouteResult, arguments: Option<RestorationData>, ) -> String

The restorable version of pop_and_push_named.

Source

pub fn push_named_and_remove_until( self: Handle<Self>, app: &mut App, new_route_name: &str, predicate: RoutePredicate, arguments: Option<Rc<dyn Any>>, ) -> CompleterFuture<RouteResult> ⓘ

Push the route with the given name onto the navigator, and then remove all the previous routes until the predicate returns true.

Source

pub fn restorable_push_named_and_remove_until( self: Handle<Self>, app: &mut App, new_route_name: &str, predicate: RoutePredicate, arguments: Option<RestorationData>, ) -> String

The restorable version of push_named_and_remove_until.

Source

pub fn push( self: Handle<Self>, app: &mut App, route: RouteRef, ) -> CompleterFuture<RouteResult> ⓘ

Push the given route onto the navigator.

Returns a future that completes to the result value passed to pop when the pushed route is popped off the navigator.

Source

pub fn restorable_push( self: Handle<Self>, app: &mut App, route_builder: RestorableRouteBuilder, arguments: Option<RestorationData>, ) -> String

Push a new route onto the navigator and return its restoration ID.

The route is created by route_builder, which is called again during state restoration.

Source

pub fn push_replacement( self: Handle<Self>, app: &mut App, new_route: RouteRef, result: RouteResult, ) -> CompleterFuture<RouteResult> ⓘ

Replace the current route of the navigator by pushing the given route and then disposing the previous route once the new route has finished animating in.

Source

pub fn restorable_push_replacement( self: Handle<Self>, app: &mut App, route_builder: RestorableRouteBuilder, result: RouteResult, arguments: Option<RestorationData>, ) -> String

The restorable version of push_replacement.

Source

pub fn push_and_remove_until( self: Handle<Self>, app: &mut App, new_route: RouteRef, predicate: RoutePredicate, ) -> CompleterFuture<RouteResult> ⓘ

Push the given route onto the navigator, and then remove all the previous routes until the predicate returns true.

Source

pub fn restorable_push_and_remove_until( self: Handle<Self>, app: &mut App, new_route_builder: RestorableRouteBuilder, predicate: RoutePredicate, arguments: Option<RestorationData>, ) -> String

The restorable version of push_and_remove_until.

Source

pub fn replace( self: Handle<Self>, app: &mut App, old_route: AnyRoute, new_route: RouteRef, )

Replaces a route on the navigator with a new route.

Source

pub fn restorable_replace( self: Handle<Self>, app: &mut App, old_route: AnyRoute, new_route_builder: RestorableRouteBuilder, arguments: Option<RestorationData>, ) -> String

The restorable version of replace.

Source

pub fn replace_route_below( self: Handle<Self>, app: &mut App, anchor_route: AnyRoute, new_route: RouteRef, )

Replaces a route on the navigator with a new route. The route to be replaced is the one below the given anchor_route.

Source

pub fn restorable_replace_route_below( self: Handle<Self>, app: &mut App, anchor_route: AnyRoute, new_route_builder: RestorableRouteBuilder, arguments: Option<RestorationData>, ) -> String

The restorable version of replace_route_below.

Source

pub fn can_pop(self: Handle<Self>, app: &App) -> bool

Whether the navigator can be popped.

Source

pub fn maybe_pop(self: Handle<Self>, app: &mut App, result: RouteResult) -> bool

Consults the current route’s AnyRoute::pop_disposition method, and acts accordingly, potentially popping the route as a result; returns whether the pop request should be considered handled.

Source

pub fn pop(self: Handle<Self>, app: &mut App, result: RouteResult)

Pop the top-most route off the navigator.

Source

pub fn pop_until(self: Handle<Self>, app: &mut App, predicate: RoutePredicate)

Calls pop repeatedly until the predicate returns true.

Source

pub fn pop_until_with_result( self: Handle<Self>, app: &mut App, predicate: RoutePredicate, result: RouteResult, )

Calls pop repeatedly until the predicate returns true, passing result to the last route that is popped.

Source

pub fn remove_route( self: Handle<Self>, app: &mut App, route: AnyRoute, result: RouteResult, )

Immediately remove route from the navigator, and dispose of it.

Source

pub fn remove_route_below( self: Handle<Self>, app: &mut App, anchor_route: AnyRoute, result: RouteResult, )

Immediately remove a route from the navigator, and dispose of it. The route to be removed is the one below the given anchor_route.

Source

pub fn finalize_route(self: Handle<Self>, app: &mut App, route: AnyRoute)

Complete the lifecycle for a route that has been popped off the navigator.

When the navigator pops a route, the navigator retains a reference to the route in order to call Route::dispose if the navigator itself is removed from the tree. When the route is finished with any exit animation, the route should call this function to complete its lifecycle (e.g., to receive a call to dispose).

Source

pub fn did_start_user_gesture(self: Handle<Self>, app: &mut App)

Called when a route is about to be moved by a user gesture.

This is called by the route that is being moved, and is used to inform the observers.

Source

pub fn did_stop_user_gesture(self: Handle<Self>, app: &mut App)

A user gesture completed.

Notifies the navigator that a gesture regarding the navigation has stopped.

Trait Implementations§

Source§

impl RestorationMixin for NavigatorState

Source§

fn restoration_mixin_data( self: Handle<Self>, app: &App, ) -> &RestorationMixinData

Dart’s RestorationMixin fields, held under the field restoration (restoration_mixin_accessors!).
Source§

fn restoration_mixin_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut RestorationMixinData

Source§

fn restoration_id(self: Handle<Self>, app: &App) -> Option<&str>

The restoration ID used for the RestorationBucket in which the mixin will store the restoration data of all registered properties. Read more
Source§

fn restore_state( self: Handle<Self>, app: &mut App, _old_bucket: Option<Handle<RestorationBucket>>, _initial_restore: bool, )

Called to initialize or restore the RestorablePropertys used by the State object. Read more
Source§

fn did_toggle_bucket( self: Handle<Self>, app: &mut App, old_bucket: Option<Handle<RestorationBucket>>, )

Called when bucket switches between None and non-None values. Read more
Source§

fn bucket(self: Handle<Self>, app: &App) -> Option<Handle<RestorationBucket>>

The RestorationBucket used for the restoration data of the RestorablePropertys registered to this mixin. Read more
Source§

fn register_for_restoration( self: Handle<Self>, app: &mut App, property: AnyRestorableProperty, restoration_id: &str, )

Registers a RestorableProperty for state restoration. Read more
Source§

fn unregister_from_restoration( self: Handle<Self>, app: &mut App, property: AnyRestorableProperty, )

Unregisters a RestorableProperty from state restoration. Read more
Source§

fn did_update_restoration_id(self: Handle<Self>, app: &mut App)

Must be called when the value returned by restoration_id changes. Read more
Source§

fn restore_pending(self: Handle<Self>, app: &mut App) -> bool

Whether restore_state will be called at the beginning of the next build phase. Read more
Source§

fn did_change_dependencies_restoration(self: Handle<Self>, app: &mut App)

Dart’s RestorationMixin.didChangeDependencies, called by the State from its own State::did_change_dependencies.
Source§

fn dispose_restoration(self: Handle<Self>, app: &mut App)

Dart’s RestorationMixin.dispose, called by the State from its own State::dispose.
Source§

fn as_restoration_mixin(self: Handle<Self>) -> AnyRestorationMixin

This state as the erased AnyRestorationMixin — what a RestorableProperty keeps as its owner.
Source§

fn debug_doing_restore(self: Handle<Self>, app: &App) -> bool

Dart’s _debugDoingRestore.
Source§

fn do_restore( self: Handle<Self>, app: &mut App, old_bucket: Option<Handle<RestorationBucket>>, )

Dart’s _doRestore.
Source§

fn update_bucket_if_necessary( self: Handle<Self>, app: &mut App, parent: Option<Handle<RestorationBucket>>, restore_pending: bool, ) -> bool

Dart’s _updateBucketIfNecessary. Returns true if bucket has been replaced with a new bucket; it is the responsibility of the caller to dispose the old bucket when this returns true.
Source§

fn set_new_bucket_if_necessary( self: Handle<Self>, app: &mut App, new_bucket: Option<Ref<RestorationBucket>>, restore_pending: bool, ) -> bool

Dart’s _setNewBucketIfNecessary. Returns true if bucket has been replaced with a new bucket; it is the responsibility of the caller to dispose the old bucket when this returns true.
Source§

fn update_property( self: Handle<Self>, app: &mut App, property: AnyRestorableProperty, )

Dart’s _updateProperty.
Source§

fn unregister( self: Handle<Self>, app: &mut App, property: AnyRestorableProperty, )

Dart’s RestorationMixin._unregister.
Source§

impl State for NavigatorState

Source§

type Widget = Navigator

The widget this state belongs to; Dart’s State<T> type argument.
Source§

fn state_data(self: Handle<Self>, app: &App) -> &StateData<Self::Widget>

The framework’s bookkeeping, held under the field state (state_accessors!).
Source§

fn state_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut StateData<Self::Widget>

Source§

fn init_state(self: Handle<Self>, app: &mut App)

Called when this object is inserted into the tree. Read more
Source§

fn did_change_dependencies(self: Handle<Self>, app: &mut App)

Called when a dependency of this State object changes. Read more
Source§

fn did_update_widget(self: Handle<Self>, app: &mut App, old_widget: &Navigator)

Called whenever the widget configuration changes. Read more
Source§

fn deactivate(self: Handle<Self>, app: &mut App)

Called when this object is removed from the tree. Read more
Source§

fn activate(self: Handle<Self>, app: &mut App)

Called when this object is reinserted into the tree after having been removed via deactivate. Read more
Source§

fn dispose(self: Handle<Self>, app: &mut App)

Called when this object is removed from the tree permanently. Read more
Source§

fn build(self: Handle<Self>, app: &mut App, context: BuildContext) -> WidgetRef

Describes the part of the user interface represented by this widget. Read more
Source§

fn widget(self: Handle<Self>, app: &App) -> &Self::Widget

The current configuration. Read more
Source§

fn context(self: Handle<Self>, app: &App) -> BuildContext

The location in the tree where this widget builds. Read more
Source§

fn mounted(self: Handle<Self>, app: &App) -> bool

Whether this State object is currently in a tree. Read more
Source§

fn set_state(self: Handle<Self>, app: &mut App, f: impl FnOnce(&mut Self))

Notify the framework that the internal state of this object has changed. Read more
Source§

fn debug_fill_properties( self: Handle<Self>, app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s debugFillProperties: the properties this state shows where its element’s dump names it (state: ScrollableState#1a2b3(offset: 0.0)), after the lifecycle and mounting properties State’s base adds, which the framework adds first.
Source§

impl TickerProviderObject for NavigatorState

Source§

impl TickerProviderStateMixin for NavigatorState

Source§

fn ticker_provider_data( self: Handle<Self>, app: &App, ) -> &TickerProviderStateMixinData

Mixin field access.
Source§

fn ticker_provider_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut TickerProviderStateMixinData

Source§

fn debug_fill_properties( self: Handle<Self>, app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s TickerProviderStateMixin.debugFillProperties, which a state’s own body calls where Dart’s mixin adds its line.
Source§

fn create_ticker( self: Handle<Self>, app: &mut App, on_tick: TickerCallback, ) -> Ref<Ticker>

TickerProvider::create_ticker: creates a ticker with the given callback.
Source§

fn activate(self: Handle<Self>, app: &mut App)

The mixin’s part of State::activate; the state calls it where Dart’s super.activate() would reach the mixin. A GlobalKey that moves the element to another view deactivates and activates it, so this is where the tickers follow it.
Source§

fn dispose(self: Handle<Self>, app: &mut App)

The mixin’s part of State::dispose; the state calls it where Dart’s super.dispose() would reach the mixin. Every vended ticker must already be disposed (by disposing its AnimationController).

Auto Trait Implementations§

§

impl !RefUnwindSafe for NavigatorState

§

impl !Send for NavigatorState

§

impl !Sync for NavigatorState

§

impl !UnwindSafe for NavigatorState

§

impl Forget for NavigatorState

§

impl Freeze for NavigatorState

§

impl Move for NavigatorState

§

impl Unpin for NavigatorState
where Rc<dyn Widget>: Unpin, NonZero<u32>: Unpin, *const u8 is !null: Unpin, Rc<Keep>: Unpin, Rc<dyn ValueListenable<TickerModeData>>: Unpin, &'static RestorablePropertyVTable: Unpin, Rc<dyn Fn(&mut App)>: Unpin, *const (): Unpin, Rc<dyn Key>: Unpin, &'static RouteVTable: Unpin, &'static NavigatorObserverVTable: Unpin,

§

impl UnsafeUnpin for NavigatorState

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>