Skip to main content

ShowDialog

Struct ShowDialog 

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

Displays a Material dialog above the current contents of the app, with Material entrance and exit animations, modal barrier color, and modal barrier behavior (dialog is dismissible with a tap on the barrier).

This function takes a builder which typically builds a Dialog widget. Content below the dialog is dimmed with a ModalBarrier. The widget returned by the builder does not share a context with the location that ShowDialog is originally called from. Use a StatefulBuilder or a custom StatefulWidget if the dialog needs to update dynamically.

The context argument is used to look up the Navigator and Theme for the dialog. It is only used when the method is called. Its corresponding widget can be safely removed from the tree before the dialog is closed.

The barrier_dismissible argument is used to indicate whether tapping on the barrier will dismiss the dialog. It is true by default and can not be null.

The barrier_color argument is used to specify the color of the modal barrier that darkens everything below the dialog. If null the barrier_color field from DialogThemeData is used. If that is null the default color Colors::BLACK54 is used.

The use_safe_area argument is used to indicate if the dialog should only display in ‘safe’ areas of the screen not used by the operating system (see SafeArea for more details). It is true by default, which means the dialog will not overlap operating system areas. If it is set to false the dialog will only be constrained by the screen size. It can not be null.

The use_root_navigator argument is used to determine whether to push the dialog to the Navigator furthest from or nearest to the given context. By default, use_root_navigator is true and the dialog route created by this method is pushed to the root navigator. It can not be null.

The route_settings argument is passed to DialogRoute::settings.

If not null, the traversal_edge_behavior argument specifies the transfer of focus beyond the first and the last items of the dialog route. By default, TraversalEdgeBehavior::ClosedLoop is used, because it’s typical for dialogs to allow users to cycle through dialog widgets without leaving the dialog.

If animation_style is provided, it will be used to override the default animation duration and curves of the dialog.

Returns a future that resolves to the value (if any) that was passed to Navigator::pop when the dialog was closed.

See also:

Builder for ShowDialog’s arguments, in place of Dart’s named arguments.

Create one with ShowDialog::new, set what differs from Flutter’s defaults, and call show.

Implementations§

Source§

impl ShowDialog

Source

pub fn new(builder: WidgetBuilder) -> ShowDialog

Creates a builder for a Material dialog; Dart’s showDialog required argument is the builder, and every other argument is a setter.

Source

pub fn barrier_dismissible(self, barrier_dismissible: bool) -> ShowDialog

Whether tapping on the barrier will dismiss the dialog. Defaults to true.

Source

pub fn barrier_color(self, barrier_color: Color) -> ShowDialog

The color of the modal barrier that darkens everything below the dialog.

Source

pub fn barrier_label(self, barrier_label: impl Into<String>) -> ShowDialog

The semantic label of the dialog’s modal barrier.

Source

pub fn use_safe_area(self, use_safe_area: bool) -> ShowDialog

Whether the dialog should only display in the safe areas of the screen. Defaults to true.

Source

pub fn use_root_navigator(self, use_root_navigator: bool) -> ShowDialog

Whether to push the dialog to the root navigator rather than the nearest one. Defaults to true.

Source

pub fn route_settings(self, route_settings: RouteSettingsRef) -> ShowDialog

The route settings passed to DialogRoute::settings.

Source

pub fn traversal_edge_behavior( self, traversal_edge_behavior: TraversalEdgeBehavior, ) -> ShowDialog

How focus transfers beyond the first and last items of the dialog route.

Source

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

Whether this is a fullscreen dialog. Defaults to false.

Source

pub fn request_focus(self, request_focus: bool) -> ShowDialog

Whether the dialog’s route requests focus when it is pushed.

Source

pub fn animation_style(self, animation_style: AnimationStyle) -> ShowDialog

An animation style that overrides the default animation duration and curves.

Source

pub fn show( self, app: &mut App, context: BuildContext, ) -> CompleterFuture<RouteResult> ⓘ

Displays the dialog and returns a future that resolves to the value passed to Navigator::pop when it closes.

Auto Trait Implementations§

§

impl !RefUnwindSafe for ShowDialog

§

impl !Send for ShowDialog

§

impl !Sync for ShowDialog

§

impl !UnwindSafe for ShowDialog

§

impl Forget for ShowDialog

§

impl Freeze for ShowDialog
where *const RcInner<dyn Fn(&mut App, AnyElement) -> Rc<dyn Widget>> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, AnyElement) -> Rc<dyn Widget>>>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const RcInner<dyn Any> is !null: Freeze, PhantomData<RcInner<dyn Any>>: Freeze, *const RcInner<dyn Page> is !null: Freeze, PhantomData<RcInner<dyn Page>>: Freeze, *const RcInner<dyn Curve> is !null: Freeze, PhantomData<RcInner<dyn Curve>>: Freeze,

§

impl Move for ShowDialog

§

impl Unpin for ShowDialog
where Rc<dyn Fn(&mut App, AnyElement) -> Rc<dyn Widget>>: Unpin, *const u8 is !null: Unpin, Rc<dyn Any>: Unpin, Rc<dyn Page>: Unpin, Rc<dyn Curve>: Unpin,

§

impl UnsafeUnpin for ShowDialog
where *const RcInner<dyn Fn(&mut App, AnyElement) -> Rc<dyn Widget>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, AnyElement) -> Rc<dyn Widget>>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, *const RcInner<dyn Any> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Any>>: UnsafeUnpin, *const RcInner<dyn Page> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Page>>: UnsafeUnpin, *const RcInner<dyn Curve> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Curve>>: 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> 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>