Skip to main content

SimpleDialog

Struct SimpleDialog 

Source
pub struct SimpleDialog<Msg = Callback> { /* private fields */ }
Expand description

A dialog that offers a choice: a title, and a list of options to pick from.

The one the reference calls simple, and the difference from AlertDialog is what it is for: an alert dialog asks a question and puts the answers in a row of buttons at the bottom, this one lists them and each row is an answer.

Implementations§

Source§

impl<Msg: Clone + 'static> SimpleDialog<Msg>

Source

pub fn new(open: bool) -> Self

Creates one; open says whether it is showing.

Source

pub fn on_dismiss(self, message: impl Into<Msg>) -> Self

What a click on the scrim sends — see Dialog::on_dismiss.

Source

pub fn title(self, title: impl Into<String>) -> Self

The heading, as text.

Source

pub fn title_widget(self, title: impl Widget<Msg> + 'static) -> Self

The heading, as a widget.

Source

pub fn title_text_style(self, style: TextStyle) -> Self

The heading’s type. headlineSmall by default, as AlertDialog’s is.

Source

pub fn title_padding(self, padding: Insets) -> Self

The space around the heading.

Source

pub fn content_padding(self, padding: Insets) -> Self

The space around the list of options. No side padding by default: an option is a full-width row that pads itself.

Source

pub fn content_text_style(self, style: TextStyle) -> Self

What the options are set in. bodyMedium by default.

Source

pub fn option(self, option: impl Widget<Msg> + 'static) -> Self

Adds an option — usually a SimpleDialogOption.

Source

pub fn background(self, color: Color) -> Self

The surface’s colour — see Dialog::background.

Source

pub fn elevation(self, elevation: f32) -> Self

How far off the page it sits — see Dialog::elevation.

Source

pub fn shape(self, shape: ShapeBorder) -> Self

What shape it is — see Dialog::shape.

Source

pub fn inset_padding(self, padding: Insets) -> Self

How far off the window’s edges — see Dialog::inset_padding.

Source

pub fn body(self, body: impl Widget<Msg> + 'static) -> Dialog<Msg>

Sets the screen behind it and finalises the dialog.

Auto Trait Implementations§

§

impl<Msg = Callback> !RefUnwindSafe for SimpleDialog<Msg>

§

impl<Msg = Callback> !Send for SimpleDialog<Msg>

§

impl<Msg = Callback> !Sync for SimpleDialog<Msg>

§

impl<Msg = Callback> !UnwindSafe for SimpleDialog<Msg>

§

impl<Msg> Freeze for SimpleDialog<Msg>
where Dialog<Msg>: Freeze, Option<Box<dyn Widget<Msg>>>: Freeze, Vec<Box<dyn Widget<Msg>>>: Freeze,

§

impl<Msg> Unpin for SimpleDialog<Msg>
where Dialog<Msg>: Unpin, Option<Box<dyn Widget<Msg>>>: Unpin, Vec<Box<dyn Widget<Msg>>>: Unpin,

§

impl<Msg> UnsafeUnpin for SimpleDialog<Msg>
where Dialog<Msg>: UnsafeUnpin, Option<Box<dyn Widget<Msg>>>: UnsafeUnpin, Vec<Box<dyn Widget<Msg>>>: 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<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<Msg> IntoMsg<Msg> for Msg

Source§

fn defer(work: impl Fn() -> Msg + 'static) -> Msg

The message that stands for work’s result.
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.