Skip to main content

ContentDialog

Struct ContentDialog 

Source
pub struct ContentDialog {
Show 15 fields pub title: Option<WidgetRef>, pub content: Option<WidgetRef>, pub primary_button_text: String, pub secondary_button_text: String, pub close_button_text: String, pub is_primary_button_enabled: bool, pub is_secondary_button_enabled: bool, pub default_button: ContentDialogButton, pub full_size_desired: bool, pub primary_button_click: Option<ContentDialogButtonClickHandler>, pub secondary_button_click: Option<ContentDialogButtonClickHandler>, pub close_button_click: Option<ContentDialogButtonClickHandler>, pub opened: Option<Listener>, pub closing: Option<ContentDialogClosingHandler>, pub closed: Option<ContentDialogClosedHandler>, /* private fields */
}
Expand description

A persistent dialog object: set its properties, show it with show_async from a context beneath a Navigator, and dispose it when its owner is disposed.

Fields§

§title: Option<WidgetRef>

Title: shown above the content in the subtitle size, on at most two lines. Without one, the title row and its margin collapse.

§content: Option<WidgetRef>

Content: shown below the title in the body size, wrapping.

§primary_button_text: String

PrimaryButtonText: the leftmost button’s label; empty hides the button.

§secondary_button_text: String

SecondaryButtonText: the middle button’s label; empty hides the button.

§close_button_text: String

CloseButtonText: the rightmost button’s label, which Escape also invokes; empty hides the button.

§is_primary_button_enabled: bool

IsPrimaryButtonEnabled.

§is_secondary_button_enabled: bool

IsSecondaryButtonEnabled.

§default_button: ContentDialogButton

DefaultButton: drawn in the accent style and invoked by Enter.

§full_size_desired: bool

FullSizeDesired: whether the dialog takes the window’s height, up to its maximum.

§primary_button_click: Option<ContentDialogButtonClickHandler>

PrimaryButtonClick: can cancel the close the primary button asks for.

§secondary_button_click: Option<ContentDialogButtonClickHandler>

SecondaryButtonClick: can cancel the close the secondary button asks for.

§close_button_click: Option<ContentDialogButtonClickHandler>

CloseButtonClick: can cancel the close the close button or Escape asks for.

§opened: Option<Listener>

Opened: called after the dialog’s first frame and its initial focus.

§closing: Option<ContentDialogClosingHandler>

Closing: can cancel any close but one the dialog’s route was removed for.

§closed: Option<ContentDialogClosedHandler>

Closed: called after the close transition, before the result is delivered.

Implementations§

Source§

impl ContentDialog

Source

pub fn new(app: &mut App) -> Ref<Self>

Creates a dialog with no title, no content and no buttons.

Source

pub fn title<K>(self: Handle<Self>, app: &mut App, title: impl IntoWidget<K>)

Sets Title.

Source

pub fn content<K>( self: Handle<Self>, app: &mut App, content: impl IntoWidget<K>, )

Sets Content.

Source

pub fn primary_button_text( self: Handle<Self>, app: &mut App, text: impl Into<String>, )

Sets PrimaryButtonText.

Source

pub fn secondary_button_text( self: Handle<Self>, app: &mut App, text: impl Into<String>, )

Sets SecondaryButtonText.

Source

pub fn close_button_text( self: Handle<Self>, app: &mut App, text: impl Into<String>, )

Sets CloseButtonText.

Source

pub fn is_primary_button_enabled(self: Handle<Self>, app: &mut App, value: bool)

Sets IsPrimaryButtonEnabled.

Source

pub fn is_secondary_button_enabled( self: Handle<Self>, app: &mut App, value: bool, )

Sets IsSecondaryButtonEnabled.

Source

pub fn default_button( self: Handle<Self>, app: &mut App, button: ContentDialogButton, )

Sets DefaultButton.

Source

pub fn full_size_desired(self: Handle<Self>, app: &mut App, value: bool)

Sets FullSizeDesired.

Source

pub fn primary_button_click( self: Handle<Self>, app: &mut App, handler: impl Fn(&mut App, &Rc<ContentDialogButtonClickEventArgs>) + 'static, )

Sets the PrimaryButtonClick handler.

Source

pub fn secondary_button_click( self: Handle<Self>, app: &mut App, handler: impl Fn(&mut App, &Rc<ContentDialogButtonClickEventArgs>) + 'static, )

Sets the SecondaryButtonClick handler.

Source

pub fn close_button_click( self: Handle<Self>, app: &mut App, handler: impl Fn(&mut App, &Rc<ContentDialogButtonClickEventArgs>) + 'static, )

Sets the CloseButtonClick handler.

Source

pub fn opened(self: Handle<Self>, app: &mut App, handler: Listener)

Sets the Opened handler.

Source

pub fn closing( self: Handle<Self>, app: &mut App, handler: impl Fn(&mut App, &Rc<ContentDialogClosingEventArgs>) + 'static, )

Sets the Closing handler.

Source

pub fn closed( self: Handle<Self>, app: &mut App, handler: impl Fn(&mut App, ContentDialogClosedEventArgs) + 'static, )

Sets the Closed handler.

Source

pub fn show_async( self: Handle<Self>, app: &mut App, context: BuildContext, ) -> Result<CompleterFuture<ContentDialogResult>, ContentDialogError>

ShowAsync: shows the dialog over the window of context’s root navigator. The future completes with the result once the dialog has closed.

Source

pub fn hide(self: Handle<Self>, app: &mut App)

Hide: closes the dialog with None, through the Closing event.

Source

pub fn dispose(self: Handle<Self>, app: &mut App)

Releases the dialog. A shown dialog closes first, without its Closing and Closed events, and its result is None.

Trait Implementations§

Source§

impl ChangeNotifier for ContentDialog

Source§

fn change_notifier_data(&self) -> &ChangeNotifierData

Source§

fn change_notifier_data_mut(&mut self) -> &mut ChangeNotifierData

Source§

fn will_add_listener(self: Handle<Self>, app: &mut App)

Runs before the listener is stored. Dart overrides of addListener that work before super.addListener go here.
Source§

fn did_remove_listener(self: Handle<Self>, app: &mut App)

Runs after the listener is removed. Dart overrides of removeListener that work after super.removeListener go here.
Source§

impl Debug for ContentDialog

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for ContentDialog

§

impl !Send for ContentDialog

§

impl !Sync for ContentDialog

§

impl !UnwindSafe for ContentDialog

§

impl Forget for ContentDialog

§

impl Freeze for ContentDialog
where *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const RcInner<dyn Fn(&mut App, &Rc<ContentDialogButtonClickEventArgs>)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, &Rc<ContentDialogButtonClickEventArgs>)>>: 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 Fn(&mut App, &Rc<ContentDialogClosingEventArgs>)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, &Rc<ContentDialogClosingEventArgs>)>>: Freeze, *const RcInner<dyn Fn(&mut App, ContentDialogClosedEventArgs)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, ContentDialogClosedEventArgs)>>: Freeze, PhantomData<Option<Listener>>: Freeze, *const RcInner<Cell<usize>> is !null: Freeze, PhantomData<RcInner<Cell<usize>>>: Freeze, &'static RouteVTable: Freeze, PhantomData<fn() -> NavigatorState>: Freeze, *const RcInner<Shared<ContentDialogResult>> is !null: Freeze, PhantomData<RcInner<Shared<ContentDialogResult>>>: Freeze, *const RcInner<ThemeResources> is !null: Freeze, PhantomData<RcInner<ThemeResources>>: Freeze, *const RcInner<DeferralManager> is !null: Freeze, PhantomData<RcInner<DeferralManager>>: Freeze,

§

impl Move for ContentDialog

§

impl Unpin for ContentDialog
where Rc<dyn Widget>: Unpin, *const u8 is !null: Unpin, Rc<dyn Fn(&mut App, &Rc<ContentDialogButtonClickEventArgs>)>: Unpin, Rc<dyn Fn(&mut App)>: Unpin, NonZero<u32>: Unpin, *const (): Unpin, Rc<dyn Fn(&mut App, &Rc<ContentDialogClosingEventArgs>)>: Unpin, Rc<dyn Fn(&mut App, ContentDialogClosedEventArgs)>: Unpin, Rc<Cell<usize>>: Unpin, &'static RouteVTable: Unpin, Rc<Shared<ContentDialogResult>>: Unpin, Rc<ThemeResources>: Unpin, Rc<DeferralManager>: Unpin,

§

impl UnsafeUnpin for ContentDialog
where *const RcInner<dyn Widget> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Widget>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, &Rc<ContentDialogButtonClickEventArgs>)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, &Rc<ContentDialogButtonClickEventArgs>)>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App)>>: UnsafeUnpin, NonZeroU32Inner: UnsafeUnpin, *const (): UnsafeUnpin, *const RcInner<dyn Fn(&mut App, &Rc<ContentDialogClosingEventArgs>)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, &Rc<ContentDialogClosingEventArgs>)>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, ContentDialogClosedEventArgs)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, ContentDialogClosedEventArgs)>>: UnsafeUnpin, PhantomData<Option<Listener>>: UnsafeUnpin, *const RcInner<Cell<usize>> is !null: UnsafeUnpin, PhantomData<RcInner<Cell<usize>>>: UnsafeUnpin, &'static RouteVTable: UnsafeUnpin, PhantomData<fn() -> NavigatorState>: UnsafeUnpin, *const RcInner<Shared<ContentDialogResult>> is !null: UnsafeUnpin, PhantomData<RcInner<Shared<ContentDialogResult>>>: UnsafeUnpin, *const RcInner<ThemeResources> is !null: UnsafeUnpin, PhantomData<RcInner<ThemeResources>>: UnsafeUnpin, *const RcInner<DeferralManager> is !null: UnsafeUnpin, PhantomData<RcInner<DeferralManager>>: UnsafeUnpin,

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<T> ListenableObject for T
where T: ChangeNotifier,

Source§

fn add_listener(self: Handle<T>, app: &mut App, listener: Listener)

Register a closure to be called when the object notifies its listeners.
Source§

fn remove_listener(self: Handle<T>, app: &mut App, listener: &Listener)

Remove a previously registered closure from the list of closures that the object notifies.
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>