pub struct SimpleDialogOption {
pub key: Option<KeyRef>,
pub on_pressed: Option<Listener>,
pub child: Option<WidgetRef>,
pub padding: Option<EdgeInsets>,
}Expand description
An option used in a SimpleDialog.
A simple dialog offers the user a choice between several options. This
widget is commonly used to represent each of the options. If the user
selects this option, the widget will call the on_pressed
callback, which typically uses Navigator::pop to close the dialog.
The padding on a SimpleDialogOption is configured to combine with the
default SimpleDialog::content_padding so that each option ends up 8 pixels
from the other vertically, with 20 pixels of spacing between the dialog’s
title and the first option, and 24 pixels of spacing between the last option
and the bottom of the dialog.
See also:
SimpleDialog, for a dialog in which to use this widget.ShowDialog, which actually displays the dialog and returns its result.TextButton, which are commonly used as actions in other kinds of dialogs, such asAlertDialogs.- https://material.io/design/components/dialogs.html#simple-dialog
Fields§
§key: Option<KeyRef>§on_pressed: Option<Listener>The callback that is called when this option is selected.
If this is set to null, the option cannot be selected.
When used in a SimpleDialog, this will typically call Navigator::pop
with a value for ShowDialog to complete its future with.
child: Option<WidgetRef>The widget below this widget in the tree.
Typically a Text widget.
padding: Option<EdgeInsets>The amount of space to surround the child with.
Defaults to EdgeInsets.symmetric(vertical: 8.0, horizontal: 24.0).
Implementations§
Source§impl SimpleDialogOption
impl SimpleDialogOption
Sourcepub fn new() -> SimpleDialogOption
pub fn new() -> SimpleDialogOption
Creates an option for a SimpleDialog.
Sourcepub fn key(self, key: KeyRef) -> SimpleDialogOption
pub fn key(self, key: KeyRef) -> SimpleDialogOption
Dart SimpleDialogOption(key:).
Sourcepub fn on_pressed(self, on_pressed: Listener) -> SimpleDialogOption
pub fn on_pressed(self, on_pressed: Listener) -> SimpleDialogOption
Dart SimpleDialogOption(onPressed:).
Sourcepub fn padding(self, padding: EdgeInsets) -> SimpleDialogOption
pub fn padding(self, padding: EdgeInsets) -> SimpleDialogOption
Dart SimpleDialogOption(padding:).
Sourcepub fn child<K>(self, child: impl IntoWidget<K>) -> SimpleDialogOption
pub fn child<K>(self, child: impl IntoWidget<K>) -> SimpleDialogOption
Dart SimpleDialogOption(child:).
Trait Implementations§
Source§impl Debug for SimpleDialogOption
impl Debug for SimpleDialogOption
Source§impl Default for SimpleDialogOption
impl Default for SimpleDialogOption
Source§impl StatelessWidget for SimpleDialogOption
impl StatelessWidget for SimpleDialogOption
Source§fn build(&self, _app: &mut App, _context: BuildContext) -> WidgetRef
fn build(&self, _app: &mut App, _context: BuildContext) -> WidgetRef
Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
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)
fn debug_check_constructor(&self)
Source§fn as_preferred_size_widget(
&self,
) -> Option<&(dyn PreferredSizeWidget + 'static)>
fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>
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 SimpleDialogOption
impl !Send for SimpleDialogOption
impl !Sync for SimpleDialogOption
impl !UnwindSafe for SimpleDialogOption
impl Forget for SimpleDialogOption
impl Freeze for SimpleDialogOptionwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
*const RcInner<dyn Fn(&mut App)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App)>>: Freeze,
NonZero<u32>: Freeze,
*const (): Freeze,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
impl Move for SimpleDialogOption
impl Unpin for SimpleDialogOption
impl UnsafeUnpin for SimpleDialogOptionwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App)>>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
*const (): UnsafeUnpin,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<W> IntoWidget<StatelessKind> for Wwhere
W: StatelessWidget,
impl<W> IntoWidget<StatelessKind> for Wwhere
W: StatelessWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.