pub struct MaterialDialog { /* private fields */ }Expand description
An M3 dialog. Without MaterialDialog::modal it renders its container
in place (a specimen); with it, it is a modal overlay over the window.
Implementations§
Source§impl MaterialDialog
impl MaterialDialog
pub fn new(id: impl Into<ElementId>) -> Self
Sourcepub fn icon(self, icon: impl Into<Icon>) -> Self
pub fn icon(self, icon: impl Into<Icon>) -> Self
The hero icon above the headline; the headline then centers.
pub fn headline(self, headline: impl Into<SharedString>) -> Self
Sourcepub fn subtitle(self, subtitle: impl Into<SharedString>) -> Self
pub fn subtitle(self, subtitle: impl Into<SharedString>) -> Self
A body-medium line 16dp under the headline (md3.io).
Sourcepub fn label(self, label: impl Into<SharedString>) -> Self
pub fn label(self, label: impl Into<SharedString>) -> Self
The modal dialog’s accessible name when it differs from (or there is no) headline.
pub fn supporting_text(self, text: impl Into<SharedString>) -> Self
Sourcepub fn content(self, content: impl IntoElement) -> Self
pub fn content(self, content: impl IntoElement) -> Self
Content under the text, full width (e.g. a list of items).
Sourcepub fn action(self, action: impl IntoElement) -> Self
pub fn action(self, action: impl IntoElement) -> Self
An action button; actions sit at the trailing edge in call order.
Sourcepub fn divider(self, divider: bool) -> Self
pub fn divider(self, divider: bool) -> Self
An outline-variant divider between the content and the actions.
Sourcepub fn dividers(self, dividers: bool) -> Self
pub fn dividers(self, dividers: bool) -> Self
Outline-variant dividers above and below the body (supporting text and content), for a body that scrolls (md3.io’s Dividers).
Sourcepub fn width(self, width: f32) -> Self
pub fn width(self, width: f32) -> Self
The basic dialog’s width in dp, clamped to M3’s 280–560dp.
Sourcepub fn size(self, size: DialogSize) -> Self
pub fn size(self, size: DialogSize) -> Self
The dialog’s size; DialogSize::Small uses Self::width.
pub fn animation(self, animation: DialogAnimation) -> Self
pub fn action_alignment(self, alignment: DialogActionAlignment) -> Self
A close button named label at the header’s trailing edge; it calls
on_dismiss. A full-screen dialog shows it at its leading edge.
Sourcepub fn full_screen(
self,
close_label: impl Into<SharedString>,
confirm: Option<AnyElement>,
) -> Self
pub fn full_screen( self, close_label: impl Into<SharedString>, confirm: Option<AnyElement>, ) -> Self
Make this a full-screen dialog. close_label names its close button;
confirm is the header’s action (e.g. a text button).
Sourcepub fn contained(self, contained: bool) -> Self
pub fn contained(self, contained: bool) -> Self
Present the modal dialog over its positioned parent’s bounds instead of the whole window.
Sourcepub fn dismiss_on_scrim(self, dismiss: bool) -> Self
pub fn dismiss_on_scrim(self, dismiss: bool) -> Self
Whether pressing the scrim dismisses the dialog (default true).
Sourcepub fn dismiss_on_escape(self, dismiss: bool) -> Self
pub fn dismiss_on_escape(self, dismiss: bool) -> Self
Whether Escape dismisses the dialog (default true).
Sourcepub fn on_dismiss(self, f: impl Fn(&mut Window, &mut App) + 'static) -> Self
pub fn on_dismiss(self, f: impl Fn(&mut Window, &mut App) + 'static) -> Self
Called when the person dismisses the dialog: Escape, the scrim, or a close button. The caller closes it.
Trait Implementations§
Source§impl IntoElement for MaterialDialog
impl IntoElement for MaterialDialog
Source§type Element = ViewElement<MaterialDialog>
type Element = ViewElement<MaterialDialog>
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Element].Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement].Auto Trait Implementations§
impl !RefUnwindSafe for MaterialDialog
impl !Send for MaterialDialog
impl !Sync for MaterialDialog
impl !UnwindSafe for MaterialDialog
impl Freeze for MaterialDialog
impl Unpin for MaterialDialog
impl UnsafeUnpin for MaterialDialog
Blanket Implementations§
§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>where
Self: Sized,
T: SpringTarget,
<T as SpringTarget>::Output: 'static,
fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>where
Self: Sized,
T: SpringTarget,
<T as SpringTarget>::Output: 'static,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
§fn test_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_text(self, text: impl Into<SharedString>) -> Self::Element
test-support, records text each time the element paints.
Otherwise returns the element it builds.§fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
Self::test_text] for an image’s alternative text, which
stands in for what the element draws.