pub struct Dialog {Show 14 fields
pub key: Option<KeyRef>,
pub background_color: Option<Color>,
pub elevation: Option<f64>,
pub shadow_color: Option<Color>,
pub surface_tint_color: Option<Color>,
pub inset_animation_duration: Duration,
pub inset_animation_curve: Rc<dyn Curve>,
pub inset_padding: Option<EdgeInsets>,
pub clip_behavior: Option<Clip>,
pub shape: Option<ShapeBorderRef>,
pub alignment: Option<AlignmentGeometry>,
pub child: Option<WidgetRef>,
pub semantics_role: SemanticsRole,
pub constraints: Option<BoxConstraints>,
/* private fields */
}Expand description
A Material Design dialog.
This dialog widget does not have any opinion about the contents of the
dialog. Rather than using this widget directly, consider using AlertDialog
or SimpleDialog, which implement specific kinds of Material Design
dialogs.
§Constraints
The Material 3 guideline recommends that a dialog should have a maximal width of 560dp.
For historical reasons, Flutter’s Dialog widget does not come with this constraint by
default. For applications targeting large screens such as desktop or Web, it is recommended
to set the constraints property.
One set of setters serves both of Dart’s constructors, Dialog::new and
Dialog::fullscreen.
See also:
AlertDialog, for dialogs that have a message and some buttons.SimpleDialog, for dialogs that offer a variety of options.ShowDialog, which actually displays the dialog and returns its result.- https://material.io/design/components/dialogs.html
Fields§
§key: Option<KeyRef>§background_color: Option<Color>The background color of the surface of this Dialog.
This sets the Material::color on this Dialog’s Material.
If null, then the DialogThemeData::background_color is used. If that is
also null, defaults to ColorScheme::surface_container_high. If
ThemeData::use_material3 is false, defaults to Colors::GREY with a shade
of 800 in dark theme and Colors::WHITE in light theme.
If Dialog::fullscreen is used, defaults to ColorScheme::surface.
elevation: Option<f64>The z-coordinate of this Dialog.
Controls how far above the parent the dialog will appear. Elevation is
represented by a drop shadow if shadow_color is non null,
and a surface tint overlay on the background color if
surface_tint_color is non null.
If null then DialogThemeData::elevation is used, and if that is null then
the elevation will match the Material Design specification for Dialogs.
shadow_color: Option<Color>The color used to paint a drop shadow under the dialog’s Material,
which reflects the dialog’s elevation.
If null and ThemeData::use_material3 is true then no drop shadow will
be rendered.
If null and ThemeData::use_material3 is false then it will default to
ThemeData::shadow_color.
surface_tint_color: Option<Color>The color used as a surface tint overlay on the dialog’s background color,
which reflects the dialog’s elevation.
If ThemeData::use_material3 is false property has no effect.
defaults to Colors::TRANSPARENT.
To disable this feature, set surface_tint_color to
Colors::TRANSPARENT.
inset_animation_duration: DurationThe duration of the animation to show when the system keyboard intrudes into the space that the dialog is placed in.
Defaults to 100 milliseconds.
inset_animation_curve: Rc<dyn Curve>The curve to use for the animation shown when the system keyboard intrudes into the space that the dialog is placed in.
Defaults to Curves::decelerate.
inset_padding: Option<EdgeInsets>The amount of padding added to MediaQueryData::view_insets on the outside
of the dialog. This defines the minimum space between the screen’s edges
and the dialog.
Defaults to EdgeInsets.symmetric(horizontal: 40.0, vertical: 24.0).
clip_behavior: Option<Clip>Controls how the contents of the dialog are clipped (or not) to the given
shape.
See the enum Clip for details of all possible options and their common
use cases.
If null, then DialogThemeData::clip_behavior is used. If that is also null,
defaults to Clip::None.
shape: Option<ShapeBorderRef>The shape of this dialog’s border.
Defines the dialog’s Material::shape.
The default shape is a RoundedRectangleBorder with a radius of 4.0
alignment: Option<AlignmentGeometry>How to align the Dialog.
If null, then DialogThemeData::alignment is used. If that is also null, the
default is Alignment::CENTER.
child: Option<WidgetRef>The widget below this widget in the tree.
semantics_role: SemanticsRoleThe role this dialog represent in assist technologies.
Defaults to SemanticsRole::Dialog.
constraints: Option<BoxConstraints>Constrains the size of the dialog.
If null, then DialogThemeData::constraints is used. If that is also null, the
default is const BoxConstraints(minWidth: 280.0).
Implementations§
Source§impl Dialog
impl Dialog
Sourcepub fn new() -> Dialog
pub fn new() -> Dialog
Creates a dialog.
Typically used in conjunction with ShowDialog.
Sourcepub fn fullscreen() -> Dialog
pub fn fullscreen() -> Dialog
Creates a fullscreen dialog.
Typically used in conjunction with ShowDialog.
The dialog’s Material covers the whole screen, including the area
behind the software keyboard, while child is kept above the keyboard,
so that a translucent keyboard shows the dialog’s
background_color rather than what is behind the dialog.
Sourcepub fn background_color(self, background_color: Color) -> Dialog
pub fn background_color(self, background_color: Color) -> Dialog
Dart Dialog(backgroundColor:).
Sourcepub fn shadow_color(self, shadow_color: Color) -> Dialog
pub fn shadow_color(self, shadow_color: Color) -> Dialog
Dart Dialog(shadowColor:).
Sourcepub fn surface_tint_color(self, surface_tint_color: Color) -> Dialog
pub fn surface_tint_color(self, surface_tint_color: Color) -> Dialog
Dart Dialog(surfaceTintColor:).
Sourcepub fn inset_animation_duration(
self,
inset_animation_duration: Duration,
) -> Dialog
pub fn inset_animation_duration( self, inset_animation_duration: Duration, ) -> Dialog
Dart Dialog(insetAnimationDuration:).
Sourcepub fn inset_animation_curve(
self,
inset_animation_curve: Rc<dyn Curve>,
) -> Dialog
pub fn inset_animation_curve( self, inset_animation_curve: Rc<dyn Curve>, ) -> Dialog
Dart Dialog(insetAnimationCurve:).
Sourcepub fn inset_padding(self, inset_padding: EdgeInsets) -> Dialog
pub fn inset_padding(self, inset_padding: EdgeInsets) -> Dialog
Dart Dialog(insetPadding:).
Sourcepub fn clip_behavior(self, clip_behavior: Clip) -> Dialog
pub fn clip_behavior(self, clip_behavior: Clip) -> Dialog
Dart Dialog(clipBehavior:).
Sourcepub fn shape(self, shape: impl Into<ShapeBorderRef>) -> Dialog
pub fn shape(self, shape: impl Into<ShapeBorderRef>) -> Dialog
Dart Dialog(shape:).
Sourcepub fn alignment(self, alignment: AlignmentGeometry) -> Dialog
pub fn alignment(self, alignment: AlignmentGeometry) -> Dialog
Dart Dialog(alignment:).
Sourcepub fn child<K>(self, child: impl IntoWidget<K>) -> Dialog
pub fn child<K>(self, child: impl IntoWidget<K>) -> Dialog
Dart Dialog(child:).
Sourcepub fn semantics_role(self, semantics_role: SemanticsRole) -> Dialog
pub fn semantics_role(self, semantics_role: SemanticsRole) -> Dialog
Dart Dialog(semanticsRole:).
Sourcepub fn constraints(self, constraints: BoxConstraints) -> Dialog
pub fn constraints(self, constraints: BoxConstraints) -> Dialog
Dart Dialog(constraints:).
Trait Implementations§
Source§impl StatelessWidget for Dialog
impl StatelessWidget for Dialog
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 Dialog
impl !Send for Dialog
impl !Sync for Dialog
impl !UnwindSafe for Dialog
impl Forget for Dialog
impl Freeze for Dialogwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
*const RcInner<dyn Curve> is !null: Freeze,
PhantomData<RcInner<dyn Curve>>: Freeze,
*const RcInner<dyn ShapeBorder> is !null: Freeze,
PhantomData<RcInner<dyn ShapeBorder>>: Freeze,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
impl Move for Dialog
impl Unpin for Dialog
impl UnsafeUnpin for Dialogwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const RcInner<dyn Curve> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Curve>>: UnsafeUnpin,
*const RcInner<dyn ShapeBorder> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn ShapeBorder>>: 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.