Skip to main content

SimpleDialog

Struct SimpleDialog 

Source
pub struct SimpleDialog {
Show 17 fields pub key: Option<KeyRef>, pub title: Option<WidgetRef>, pub title_padding: EdgeInsetsGeometry, pub title_text_style: Option<TextStyle>, pub children: Option<Vec<WidgetRef>>, pub content_padding: EdgeInsetsGeometry, pub background_color: Option<Color>, pub elevation: Option<f64>, pub shadow_color: Option<Color>, pub surface_tint_color: Option<Color>, pub content_text_style: Option<TextStyle>, pub semantic_label: Option<String>, pub inset_padding: Option<EdgeInsets>, pub clip_behavior: Option<Clip>, pub shape: Option<ShapeBorderRef>, pub alignment: Option<AlignmentGeometry>, pub constraints: Option<BoxConstraints>,
}
Expand description

A simple Material Design dialog.

A simple dialog offers the user a choice between several options. A simple dialog has an optional title that is displayed above the choices.

Choices are normally represented using SimpleDialogOption widgets. If other widgets are used, see content_padding for notes regarding the conventions for obtaining the spacing expected by Material Design.

For dialogs that inform the user about a situation, consider using an AlertDialog.

Typically passed as the child widget to ShowDialog, which displays the dialog.

See also:

Fields§

§key: Option<KeyRef>§title: Option<WidgetRef>

The (optional) title of the dialog is displayed in a large font at the top of the dialog.

Typically a Text widget.

§title_padding: EdgeInsetsGeometry

Padding around the title.

If there is no title, no padding will be provided.

By default, this provides the recommend Material Design padding of 24 pixels around the left, top, and right edges of the title.

See content_padding for the conventions regarding padding between the title and the children.

§title_text_style: Option<TextStyle>

Style for the text in the title of this SimpleDialog.

If null, DialogThemeData::title_text_style is used. If that’s null, defaults to TextTheme::title_large of ThemeData::text_theme.

§children: Option<Vec<WidgetRef>>

The (optional) content of the dialog is displayed in a SingleChildScrollView underneath the title.

Typically a list of SimpleDialogOptions.

§content_padding: EdgeInsetsGeometry

Padding around the content.

By default, this is 12 pixels on the top and 16 pixels on the bottom. This is intended to be combined with children that have 24 pixels of padding on the left and right, and 8 pixels of padding on the top and bottom, so that the content ends up being indented 20 pixels from the title, 24 pixels from the bottom, and 24 pixels from the sides.

The SimpleDialogOption widget uses such padding.

If there is no title, the content_padding should be adjusted so that the top padding ends up being 24 pixels.

§background_color: Option<Color>§elevation: Option<f64>§shadow_color: Option<Color>§surface_tint_color: Option<Color>§content_text_style: Option<TextStyle>

Style for the text in the children of this SimpleDialog.

If null, DialogThemeData::content_text_style is used. If that’s null, defaults to TextTheme::title_medium of ThemeData::text_theme.

§semantic_label: Option<String>

The semantic label of the dialog used by accessibility frameworks to announce screen transitions when the dialog is opened and closed.

If this label is not provided, a semantic label will be inferred from the title if it is not null. If there is no title, the label will be taken from MaterialLocalizations::dialog_label.

§inset_padding: Option<EdgeInsets>§clip_behavior: Option<Clip>§shape: Option<ShapeBorderRef>§alignment: Option<AlignmentGeometry>§constraints: Option<BoxConstraints>

Implementations§

Source§

impl SimpleDialog

Source

pub fn new() -> SimpleDialog

Creates a simple dialog.

Typically used in conjunction with ShowDialog.

Source

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

Dart SimpleDialog(key:).

Source

pub fn title<K>(self, title: impl IntoWidget<K>) -> SimpleDialog

Dart SimpleDialog(title:).

Source

pub fn title_padding( self, title_padding: impl Into<EdgeInsetsGeometry>, ) -> SimpleDialog

Dart SimpleDialog(titlePadding:).

Source

pub fn title_text_style(self, title_text_style: TextStyle) -> SimpleDialog

Dart SimpleDialog(titleTextStyle:).

Source

pub fn children( self, children: impl IntoIterator<Item = WidgetRef>, ) -> SimpleDialog

Dart SimpleDialog(children:).

Source

pub fn content_padding( self, content_padding: impl Into<EdgeInsetsGeometry>, ) -> SimpleDialog

Dart SimpleDialog(contentPadding:).

Source

pub fn content_text_style(self, content_text_style: TextStyle) -> SimpleDialog

Dart SimpleDialog(contentTextStyle:).

Source

pub fn background_color(self, background_color: Color) -> SimpleDialog

Dart SimpleDialog(backgroundColor:).

Source

pub fn elevation(self, elevation: f64) -> SimpleDialog

Dart SimpleDialog(elevation:).

Source

pub fn shadow_color(self, shadow_color: Color) -> SimpleDialog

Dart SimpleDialog(shadowColor:).

Source

pub fn surface_tint_color(self, surface_tint_color: Color) -> SimpleDialog

Dart SimpleDialog(surfaceTintColor:).

Source

pub fn semantic_label(self, semantic_label: impl Into<String>) -> SimpleDialog

Dart SimpleDialog(semanticLabel:).

Source

pub fn inset_padding(self, inset_padding: EdgeInsets) -> SimpleDialog

Dart SimpleDialog(insetPadding:).

Source

pub fn clip_behavior(self, clip_behavior: Clip) -> SimpleDialog

Dart SimpleDialog(clipBehavior:).

Source

pub fn shape(self, shape: impl Into<ShapeBorderRef>) -> SimpleDialog

Dart SimpleDialog(shape:).

Source

pub fn alignment(self, alignment: AlignmentGeometry) -> SimpleDialog

Dart SimpleDialog(alignment:).

Source

pub fn constraints(self, constraints: BoxConstraints) -> SimpleDialog

Dart SimpleDialog(constraints:).

Trait Implementations§

Source§

impl Debug for SimpleDialog

Source§

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

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

impl Default for SimpleDialog

Source§

fn default() -> SimpleDialog

Returns the “default value” for a type. Read more
Source§

impl StatelessWidget for SimpleDialog

Source§

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

Source§

fn build(&self, app: &mut App, context: BuildContext) -> WidgetRef

Describes the part of the user interface represented by this widget. Read more
Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s debugFillProperties: the properties a dump shows for this widget, in Dart’s order. Dart’s Widget base only sets the dense tree style, which the framework does.
Source§

fn debug_check_constructor(&self)

Dart’s constructor asserts that relate two or more arguments. Read more
Source§

fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>

Dart’s this is PreferredSizeWidget: a widget that implements PreferredSizeWidget answers with itself, which is what a parent asking an erased child for its preferred size reads.

Auto Trait Implementations§

§

impl !RefUnwindSafe for SimpleDialog

§

impl !Send for SimpleDialog

§

impl !Sync for SimpleDialog

§

impl !UnwindSafe for SimpleDialog

§

impl Forget for SimpleDialog

§

impl Freeze for SimpleDialog
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze, &'static dyn ColorExtension: Freeze, *const RcInner<dyn ColorExtension> is !null: Freeze, PhantomData<RcInner<dyn ColorExtension>>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, PhantomData<String>: Freeze, *const RcInner<Paint> is !null: Freeze, PhantomData<RcInner<Paint>>: Freeze, PhantomData<Shadow>: Freeze, PhantomData<FontFeature>: Freeze, PhantomData<FontVariation>: Freeze, PhantomData<Rc<dyn Widget>>: Freeze, *const RcInner<dyn ShapeBorder> is !null: Freeze, PhantomData<RcInner<dyn ShapeBorder>>: Freeze,

§

impl Move for SimpleDialog

§

impl Unpin for SimpleDialog
where Rc<dyn Key>: Unpin, Rc<dyn Widget>: Unpin, &'static dyn ColorExtension: Unpin, Rc<dyn ColorExtension>: Unpin, *const u8 is !null: Unpin, Rc<Paint>: Unpin, Rc<dyn ShapeBorder>: Unpin,

§

impl UnsafeUnpin for SimpleDialog

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<W> IntoWidget<StatelessKind> for W
where W: StatelessWidget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
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>