pub struct OverlayModalView<State: 'static> { /* private fields */ }Expand description
A declarative modal host. See overlay_modal.
The fields are crate-visible so the catalog’s modal components can wrap one
and adjust its config in their own builders (a dialog is a pre-configured
modal host); an app outside the crate configures it through
overlay_modal’s config argument and the builders below.
Implementations§
Source§impl<State: 'static> OverlayModalView<State>
impl<State: 'static> OverlayModalView<State>
Sourcepub fn label(self, label: impl Into<String>) -> Self
pub fn label(self, label: impl Into<String>) -> Self
Label the modal’s accessibility node (its title text).
Sourcepub fn dismissable(self, dismissable: bool) -> Self
pub fn dismissable(self, dismissable: bool) -> Self
Whether the user can dismiss this modal at all — the scrim tap, the
close affordance, the handle, a drag commit, Escape, and an Android
back press (default true; see the module docs). false
disables all six; only an explicit control the app wires through its own
content still dismisses it.
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
Set the unstaged dismiss callback — delivered with &mut State
during the event pass.
Used only when no on_close hook is wired: with one,
the dismissal is staged behind the exit ramp and fired from paint,
where no app state exists (see the module docs).
Sourcepub fn on_close<F: Fn() + 'static>(self, on_close: F) -> Self
pub fn on_close<F: Fn() + 'static>(self, on_close: F) -> Self
Set the state-free close hook fired when the exit ramp settles — the
staged-dismissal path. show_overlay_modal wires this to
controller.pop(); a Stack-mounted modal wires its own (a signal
write, a navigator pop).
Pinned at build: a directly constructed (non-staged) view’s later
rebuilds neither update nor clear this hook once installed — see
OverlayModalWidget’s on_close field doc for why.
An app hook is wrapped unguarded: only the navigator pop
show_overlay_modal wires has a stack identity to check.
Sourcepub fn dismiss_handle(self, dismiss: ModalDismiss) -> Self
pub fn dismiss_handle(self, dismiss: ModalDismiss) -> Self
Install the app-triggered staged-dismiss handle: the panel’s own
content can then close it through the very ramp the host chrome uses,
instead of the raw, unstaged controller.pop() that was its only route
before (see the module docs’ app-initiated dismiss section, and
ModalDismiss for the worked example).
Mint the handle outside a show_* page builder and clone it in — the
builder re-runs on every navigator rebuild.
Sourcepub fn snap_points(self, points: &[f64]) -> Self
pub fn snap_points(self, points: &[f64]) -> Self
Set the drag’s snap points: 0..=1 a fraction of the panel’s own
extent, above 1 logical px (see the module docs). The panel
opens to the first point — except a first point of 0.0 itself,
which OverlayModalWidget::open_progress treats as absent (fully
open) rather than authoring a panel that opens already closed.
A non-finite point (NaN or infinite — never a meaningful fraction or
px extent) is dropped here, at the boundary, rather than stored: this
is the one place caller input enters the widget, and every downstream
consumer (normalize_snap, snap_targets, open_progress) trusts
OverlayModalWidget::snap_points to already be all-finite rather
than re-checking (see the module docs’s Clamp Discipline
section). A caller-authored NaN/∞ behaves as if that point were never
passed at all.
Trait Implementations§
Source§impl<State: 'static> OverlayModalContent<State> for OverlayModalView<State>
impl<State: 'static> OverlayModalContent<State> for OverlayModalView<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 OverlayModalView<State>
impl<State: 'static> View<State> for OverlayModalView<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 OverlayModalView<State>
impl<State> !Send for OverlayModalView<State>
impl<State> !Sync for OverlayModalView<State>
impl<State> !UnwindSafe for OverlayModalView<State>
impl<State> Freeze for OverlayModalView<State>
impl<State> Unpin for OverlayModalView<State>
impl<State> UnsafeUnpin for OverlayModalView<State>
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).