pub struct Dialog<'a, Message, Theme = Theme, Renderer = Renderer>where
Renderer: 'a + Renderer,
Theme: 'a + Catalog,{ /* private fields */ }
Expand description
A message dialog.
Only the content is required, buttons
and the title
are optional.
The sizing strategy used depends on whether you add any buttons: if you don’t, the dialog will
be sized to fit the content similarly to a container. If you do add buttons, max_width
& max_height
(or width
& height
when set to a fixed pixel value) are used. If
these aren’t set, DEFAULT_MAX_WIDTH
and/or DEFAULT_MAX_HEIGHT
are used.
Implementations§
Source§impl<'a, Message, Theme, Renderer> Dialog<'a, Message, Theme, Renderer>
impl<'a, Message, Theme, Renderer> Dialog<'a, Message, Theme, Renderer>
Sourcepub fn new(
is_open: bool,
base: impl Into<Element<'a, Message, Theme, Renderer>>,
content: impl Into<Element<'a, Message, Theme, Renderer>>,
) -> Self
pub fn new( is_open: bool, base: impl Into<Element<'a, Message, Theme, Renderer>>, content: impl Into<Element<'a, Message, Theme, Renderer>>, ) -> Self
Creates a new Dialog
with the given base and dialog content.
Creates a new Dialog
with the given base, dialog content and buttons.
Sourcepub fn on_press(self, on_press: Message) -> Selfwhere
Message: Clone,
pub fn on_press(self, on_press: Message) -> Selfwhere
Message: Clone,
Sets the message that will be produced when the Dialog
’s backdrop is pressed.
Sourcepub fn on_press_with(self, on_press: impl Fn() -> Message + 'a) -> Self
pub fn on_press_with(self, on_press: impl Fn() -> Message + 'a) -> Self
Sets the message that will be produced when the Dialog
’s backdrop is pressed.
This is analogous to Dialog::on_press
, but using a closure to produce
the message.
Sourcepub fn on_press_maybe(self, on_press: Option<Message>) -> Selfwhere
Message: Clone,
pub fn on_press_maybe(self, on_press: Option<Message>) -> Selfwhere
Message: Clone,
Sets the message that will be produced when the Dialog
’s backdrop is pressed, if Some
.
Sourcepub fn max_height(self, max_height: impl Into<Pixels>) -> Self
pub fn max_height(self, max_height: impl Into<Pixels>) -> Self
Sets the Dialog
’s maximum height.
Sourcepub fn align_left(self) -> Self
pub fn align_left(self) -> Self
Aligns the Dialog
to the left.
Sourcepub fn align_right(self) -> Self
pub fn align_right(self) -> Self
Aligns the Dialog
to the right.
Sourcepub fn align_bottom(self) -> Self
pub fn align_bottom(self) -> Self
Aligns the Dialog
to the bottom.
Sourcepub fn padding_inner(self, padding: impl Into<Padding>) -> Self
pub fn padding_inner(self, padding: impl Into<Padding>) -> Self
Sets the Dialog
’s inner padding.
Sourcepub fn padding_outer(self, padding: impl Into<Padding>) -> Self
pub fn padding_outer(self, padding: impl Into<Padding>) -> Self
Sets the Dialog
’s outer padding (sometimes called “margin”).
Sets the vertical alignment of the Dialog
’s buttons.
Adds a button to the Dialog
.
Adds a button to the Dialog
, if Some
.
Extends the Dialog
with the given buttons.
Sourcepub fn title_style(self, style: impl Fn(&Theme) -> Style + 'a) -> Selfwhere
<Theme as Catalog>::Class<'a>: From<StyleFn<'a, Theme>>,
pub fn title_style(self, style: impl Fn(&Theme) -> Style + 'a) -> Selfwhere
<Theme as Catalog>::Class<'a>: From<StyleFn<'a, Theme>>,
Sets the style of the Dialog
’s title.
Sourcepub fn container_style(self, style: impl Fn(&Theme) -> Style + 'a) -> Selfwhere
<Theme as Catalog>::Class<'a>: From<StyleFn<'a, Theme>>,
pub fn container_style(self, style: impl Fn(&Theme) -> Style + 'a) -> Selfwhere
<Theme as Catalog>::Class<'a>: From<StyleFn<'a, Theme>>,
Sets the style of the Dialog
’s container.
Sourcepub fn class(self, class: impl Into<<Theme as Catalog>::Class<'a>>) -> Self
pub fn class(self, class: impl Into<<Theme as Catalog>::Class<'a>>) -> Self
Sets the style class of the Dialog
.
Sourcepub fn title_class(
self,
class: impl Into<<Theme as Catalog>::Class<'a>>,
) -> Self
pub fn title_class( self, class: impl Into<<Theme as Catalog>::Class<'a>>, ) -> Self
Sets the style class of the Dialog
’s title.
Sourcepub fn container_class(
self,
class: impl Into<<Theme as Catalog>::Class<'a>>,
) -> Self
pub fn container_class( self, class: impl Into<<Theme as Catalog>::Class<'a>>, ) -> Self
Sets the style class of the Dialog
’s container.