pub struct SelectionDialogView<State: 'static> { /* private fields */ }Expand description
A declarative M3 selection dialog: dialog’s centered panel, both
dividers on, and a radio/checkbox option list for content. See the
module docs’ controlled-component note.
Implementations§
Source§impl<State: 'static> SelectionDialogView<State>
impl<State: 'static> SelectionDialogView<State>
Sourcepub fn multi_select(self, multi_select: bool) -> Self
pub fn multi_select(self, multi_select: bool) -> Self
Allow more than one option selected at once (checkbox rows instead of
radio rows) — the reference’s multiSelect.
Sourcepub fn selected(self, selected: Vec<String>) -> Self
pub fn selected(self, selected: Vec<String>) -> Self
The currently-selected options (controlled — see the module docs). Single-select reads only the first entry.
Sourcepub fn on_toggle<F: Fn(&mut State, String) + 'static>(
self,
on_toggle: F,
) -> Self
pub fn on_toggle<F: Fn(&mut State, String) + 'static>( self, on_toggle: F, ) -> Self
Fired with the tapped option’s value on every row press — a
single-select tap reports the newly-chosen option; a multi-select tap
reports whichever option should flip membership. The caller updates
its own selected set and re-renders.
Sourcepub fn cancel_label(self, label: impl Into<String>) -> Self
pub fn cancel_label(self, label: impl Into<String>) -> Self
Override the cancel action’s label (_cancelLabel, default “Cancel”).
Sourcepub fn confirm_label(self, label: impl Into<String>) -> Self
pub fn confirm_label(self, label: impl Into<String>) -> Self
Override the confirm action’s label (_confirmLabel, default “OK”).
Sourcepub fn on_confirm<F: Fn(&mut State) + 'static>(self, on_confirm: F) -> Self
pub fn on_confirm<F: Fn(&mut State) + 'static>(self, on_confirm: F) -> Self
Fired on a confirm tap — disabled (per the reference) until at least
one option is selected. The caller decides what confirming means
(typically controller.pop_with_result(..) with its own selected),
exactly like the basic dialog’s .action(..) contract.
Sourcepub fn dismissable(self, dismissable: bool) -> Self
pub fn dismissable(self, dismissable: bool) -> Self
Whether the user can dismiss this dialog via the scrim tap, Escape,
or an Android back press (default true) — see
DialogView::dismissable.
Sourcepub fn on_dismiss<F: Fn(&mut State) + 'static>(self, on_dismiss: F) -> Self
pub fn on_dismiss<F: Fn(&mut State) + 'static>(self, on_dismiss: F) -> Self
Observe a scrim-tap/Escape/back/cancel dismissal — see
DialogView::on_dismiss.
Sourcepub fn dismiss_handle(self, dismiss: ModalDismiss) -> Self
pub fn dismiss_handle(self, dismiss: ModalDismiss) -> Self
Install the app-triggered staged-dismiss handle, so the confirm action
closes the dialog through the host’s exit ramp instead of a raw,
unstaged controller.pop() — see DialogView::dismiss_handle.
Trait Implementations§
Source§impl<State: 'static> OverlayModalContent<State> for SelectionDialogView<State>
impl<State: 'static> OverlayModalContent<State> for SelectionDialogView<State>
Source§fn on_modal_dismiss(self, on_dismiss: Rc<dyn Fn(&mut State)>) -> Self
fn on_modal_dismiss(self, on_dismiss: Rc<dyn Fn(&mut State)>) -> Self
Source§fn modal_dismissable(&self) -> bool
fn modal_dismissable(&self) -> bool
BackPolicy.Source§impl<State: 'static> View<State> for SelectionDialogView<State>
impl<State: 'static> View<State> for SelectionDialogView<State>
Source§type Element = OverlayModalWidget
type Element = OverlayModalWidget
Source§fn build(&self, ctx: &mut BuildCtx<'_>) -> OverlayModalWidget
fn build(&self, ctx: &mut BuildCtx<'_>) -> OverlayModalWidget
Source§fn rebuild(
&self,
prev: &Self,
element: &mut OverlayModalWidget,
ctx: &mut BuildCtx<'_>,
) -> ChangeFlags
fn rebuild( &self, prev: &Self, element: &mut OverlayModalWidget, ctx: &mut BuildCtx<'_>, ) -> ChangeFlags
prev (the previous view of the same type) against the live
element, mutating it in place and reporting what changed.Auto Trait Implementations§
impl<State> !RefUnwindSafe for SelectionDialogView<State>
impl<State> !Send for SelectionDialogView<State>
impl<State> !Sync for SelectionDialogView<State>
impl<State> !UnwindSafe for SelectionDialogView<State>
impl<State> Freeze for SelectionDialogView<State>
impl<State> Unpin for SelectionDialogView<State>
impl<State> UnsafeUnpin for SelectionDialogView<State>where
Option<Rc<dyn Fn(&mut State, String)>>: UnsafeUnpin,
Option<Rc<dyn Fn(&mut State)>>: 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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Source§impl<State, V> ViewSeq<State, One> for Vwhere
State: 'static,
V: View<State>,
impl<State, V> ViewSeq<State, One> for Vwhere
State: 'static,
V: View<State>,
Source§fn extend_views(self, out: &mut Vec<AnyView<State>>)
fn extend_views(self, out: &mut Vec<AnyView<State>>)
out — erasing each
with AnyView::new (a no-op for an element already an AnyView).