Skip to main content

MaterialPage

Struct MaterialPage 

Source
pub struct MaterialPage {
    pub key: Option<KeyRef>,
    pub can_pop: bool,
    pub on_pop_invoked: Option<PopInvokedWithResultCallback>,
    pub name: Option<String>,
    pub arguments: Option<Rc<dyn Any>>,
    pub restoration_id: Option<String>,
    pub child: WidgetRef,
    pub maintain_state: bool,
    pub fullscreen_dialog: bool,
    pub allow_snapshotting: bool,
    pub include_route_semantics: bool,
}
Expand description

A page that creates a material style PageRoute.

For Android, the entrance transition for the page zooms in and fades in while the exiting page zooms out and fades out. The exit transition is similar, but in reverse.

For iOS, the page slides in from the right and exits in reverse. The page also shifts to the left in parallax when another page enters to cover it. (These directions are flipped in environments with a right-to-left reading direction.)

By default, when the created route is replaced by another, the previous route remains in memory. To free all the resources when this is not necessary, set maintain_state to false.

The fullscreen_dialog property specifies whether the created route is a fullscreen modal dialog. On iOS, those routes animate from the bottom to the top rather than horizontally.

See also:

Fields§

§key: Option<KeyRef>

See Page::key.

§can_pop: bool§on_pop_invoked: Option<PopInvokedWithResultCallback>§name: Option<String>§arguments: Option<Rc<dyn Any>>§restoration_id: Option<String>§child: WidgetRef

The content to be shown in the Route created by this page.

§maintain_state: bool

Whether the route should remain in memory when it is inactive.

§fullscreen_dialog: bool

Whether this page route is a full-screen dialog.

§allow_snapshotting: bool

Whether the route transition will prefer to animate a snapshot of the entering and exiting routes.

§include_route_semantics: bool

Whether the route introduces a route scope in the semantics tree; see MaterialRouteTransitionMixin::include_route_semantics.

Implementations§

Source§

impl MaterialPage

Source

pub fn new<K>(child: impl IntoWidget<K>) -> MaterialPage

Creates a material page; Dart’s optional arguments are the setters.

Dart’s defaults: maintain_state true, fullscreen_dialog false, allow_snapshotting true, include_route_semantics true, can_pop true.

Source

pub fn maintain_state(self, maintain_state: bool) -> MaterialPage

Dart MaterialPage(maintainState:).

Source

pub fn fullscreen_dialog(self, fullscreen_dialog: bool) -> MaterialPage

Dart MaterialPage(fullscreenDialog:).

Source

pub fn allow_snapshotting(self, allow_snapshotting: bool) -> MaterialPage

Dart MaterialPage(allowSnapshotting:).

Source

pub fn include_route_semantics( self, include_route_semantics: bool, ) -> MaterialPage

Dart MaterialPage(includeRouteSemantics:).

Source

pub fn key(self, key: KeyRef) -> MaterialPage

Dart MaterialPage(key:).

Source

pub fn can_pop(self, can_pop: bool) -> MaterialPage

Dart MaterialPage(canPop:).

Source

pub fn on_pop_invoked( self, on_pop_invoked: PopInvokedWithResultCallback, ) -> MaterialPage

Dart MaterialPage(onPopInvoked:).

Source

pub fn name(self, name: String) -> MaterialPage

Dart MaterialPage(name:).

Source

pub fn arguments(self, arguments: Rc<dyn Any>) -> MaterialPage

Dart MaterialPage(arguments:).

Source

pub fn restoration_id(self, restoration_id: String) -> MaterialPage

Dart MaterialPage(restorationId:).

Trait Implementations§

Source§

impl Clone for MaterialPage

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MaterialPage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Page for MaterialPage

Source§

fn as_any(&self) -> &dyn Any

The concrete page, for Dart’s runtimeType in can_update.
Source§

fn key(&self) -> Option<&KeyRef>

The key associated with this page. Read more
Source§

fn name(&self) -> Option<&str>

Source§

fn arguments(&self) -> Option<&Rc<dyn Any>>

Source§

fn restoration_id(&self) -> Option<&str>

Restoration ID to save and restore the state of the Route configured by this page. Read more
Source§

fn can_pop(&self) -> bool

When false, blocks the associated route from being popped. Read more
Source§

fn on_pop_invoked(&self, app: &mut App, did_pop: bool, result: RouteResult)

Called after a pop on the associated route was handled. Read more
Source§

fn create_route( &self, app: &mut App, context: BuildContext, this: &PageRef, ) -> RouteRef

Creates the Route that corresponds to this page. Read more
Source§

fn can_update(&self, other: &(dyn Page + 'static)) -> bool

Whether this page can be updated with the other page. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for MaterialPage

§

impl !Send for MaterialPage

§

impl !Sync for MaterialPage

§

impl !UnwindSafe for MaterialPage

§

impl Forget for MaterialPage

§

impl Freeze for MaterialPage
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, *const RcInner<dyn Fn(&mut App, bool, Option<Rc<dyn Any>>)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, bool, Option<Rc<dyn Any>>)>>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const RcInner<dyn Any> is !null: Freeze, PhantomData<RcInner<dyn Any>>: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze,

§

impl Move for MaterialPage

§

impl Unpin for MaterialPage
where Rc<dyn Key>: Unpin, Rc<dyn Fn(&mut App, bool, Option<Rc<dyn Any>>)>: Unpin, *const u8 is !null: Unpin, Rc<dyn Any>: Unpin, Rc<dyn Widget>: Unpin,

§

impl UnsafeUnpin for MaterialPage
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, bool, Option<Rc<dyn Any>>)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, bool, Option<Rc<dyn Any>>)>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, *const RcInner<dyn Any> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Any>>: UnsafeUnpin, *const RcInner<dyn Widget> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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>