pub struct AlertDialog<Msg = Callback> { /* private fields */ }Expand description
A dialog that asks something: an optional icon, an optional title, some content, and the buttons that answer it.
The paddings are the reference’s, and conditional the way the reference’s are: a title
under an icon loses its top padding, a title with content below it loses its bottom
padding, and a title with nothing below it keeps twenty of it (dialog.dart:824).
An icon also centres the title, which is the one place the presence of one slot
changes how another is aligned (dialog.dart:844).
Implementations§
Source§impl<Msg: Clone + 'static> AlertDialog<Msg>
impl<Msg: Clone + 'static> AlertDialog<Msg>
Sourcepub fn on_dismiss(self, message: impl Into<Msg>) -> Self
pub fn on_dismiss(self, message: impl Into<Msg>) -> Self
What a click on the scrim sends. Without it the scrim is inert — the reference’s
barrierDismissible: false, for a question a button has to answer.
Sourcepub fn icon(self, icon: impl Widget<Msg> + 'static) -> Self
pub fn icon(self, icon: impl Widget<Msg> + 'static) -> Self
A glyph above the title, centred. Having one centres the title too.
Sourcepub fn icon_color(self, color: Color) -> Self
pub fn icon_color(self, color: Color) -> Self
The icon’s colour. The scheme’s secondary by default (dialog.dart:1976).
Sourcepub fn title_widget(self, title: impl Widget<Msg> + 'static) -> Self
pub fn title_widget(self, title: impl Widget<Msg> + 'static) -> Self
The heading, as a widget.
Sourcepub fn title_text_style(self, style: TextStyle) -> Self
pub fn title_text_style(self, style: TextStyle) -> Self
The heading’s type. headlineSmall by default.
Sourcepub fn content_widget(self, content: impl Widget<Msg> + 'static) -> Self
pub fn content_widget(self, content: impl Widget<Msg> + 'static) -> Self
What the dialog says, as a widget.
Sourcepub fn content_text_style(self, style: TextStyle) -> Self
pub fn content_text_style(self, style: TextStyle) -> Self
The content’s type. bodyMedium by default.
Sourcepub fn action(self, action: impl Widget<Msg> + 'static) -> Self
pub fn action(self, action: impl Widget<Msg> + 'static) -> Self
Adds a button to the row along the bottom.
Sourcepub fn actions_alignment(self, alignment: ActionsAlignment) -> Self
pub fn actions_alignment(self, alignment: ActionsAlignment) -> Self
Where the buttons sit along that row. The trailing end by default, as in the
reference (MainAxisAlignment.end).
Sourcepub fn actions_overflow_alignment(self, alignment: Align) -> Self
pub fn actions_overflow_alignment(self, alignment: Align) -> Self
Which edge the buttons line up on once they have stacked — see
OverflowBar::overflow_alignment. The
trailing end by default, so a column of answers sits where the row of them was
(dialog.dart:610).
Sourcepub fn actions_overflow_direction(self, direction: VerticalDirection) -> Self
pub fn actions_overflow_direction(self, direction: VerticalDirection) -> Self
Which way that column runs — see
OverflowBar::overflow_direction.
Downwards by default, so the buttons stack in the order they were given.
Worth saying for a destructive answer: last on a line is first in a column, so a
dialog that folds moves “Delete” to where the thumb was reaching for “Cancel”.
VerticalDirection::Up is how an application says to keep it last.
The space between the buttons once they have stacked, which is not the space
between them on one line (dialog.dart:613). Nothing by default, as in the
reference: buttons that already pad themselves need no more.
Sourcepub fn background(self, color: Color) -> Self
pub fn background(self, color: Color) -> Self
The surface’s colour — see Dialog::background.
Sourcepub fn elevation(self, elevation: f32) -> Self
pub fn elevation(self, elevation: f32) -> Self
How far off the page it sits — see Dialog::elevation.
Sourcepub fn shadow_color(self, color: Color) -> Self
pub fn shadow_color(self, color: Color) -> Self
The shadow’s colour — see Dialog::shadow_color.
Sourcepub fn surface_tint(self, color: Color) -> Self
pub fn surface_tint(self, color: Color) -> Self
The tint for its elevation — see Dialog::surface_tint.
Sourcepub fn shape(self, shape: ShapeBorder) -> Self
pub fn shape(self, shape: ShapeBorder) -> Self
What shape it is — see Dialog::shape.
Sourcepub fn inset_padding(self, padding: Insets) -> Self
pub fn inset_padding(self, padding: Insets) -> Self
How far off the window’s edges — see Dialog::inset_padding.
Sourcepub fn min_width(self, width: f32) -> Self
pub fn min_width(self, width: f32) -> Self
The narrowest it gets — see Dialog::min_width.
Sourcepub fn max_width(self, width: f32) -> Self
pub fn max_width(self, width: f32) -> Self
The widest it gets — see Dialog::max_width.
Sourcepub fn body(self, body: impl Widget<Msg> + 'static) -> Dialog<Msg>
pub fn body(self, body: impl Widget<Msg> + 'static) -> Dialog<Msg>
Sets the screen behind it and finalises the dialog.
The column is composed by a ThemeBuilder: the title’s type
comes from the theme and its alignment from whether there is an icon, so what the
column contains cannot be decided before the theme is known.