pub struct DatePickerDialog<State: 'static> { /* private fields */ }Expand description
A declarative M3E date picker dialog. See the module docs.
Implementations§
Source§impl<State: 'static> DatePickerDialog<State>
impl<State: 'static> DatePickerDialog<State>
Sourcepub fn today(self, today: MaterialDate) -> Self
pub fn today(self, today: MaterialDate) -> Self
Mark today with the today ring — see
CalendarDatePicker::today for why
this is required rather than defaulted.
Sourcepub fn strings(self, strings: DatePickerStrings) -> Self
pub fn strings(self, strings: DatePickerStrings) -> Self
Replace the localized strings (default DatePickerStrings::ENGLISH).
Sourcepub fn selectable<F: Fn(MaterialDate) -> bool + 'static>(
self,
predicate: F,
) -> Self
pub fn selectable<F: Fn(MaterialDate) -> bool + 'static>( self, predicate: F, ) -> Self
Refuse individual dates inside the bounds — the reference’s
selectableDayPredicate, applied by both the calendar and the field.
Sourcepub fn on_confirm<F: Fn(&mut State, Option<MaterialDate>) + 'static>(
self,
on_confirm: F,
) -> Self
pub fn on_confirm<F: Fn(&mut State, Option<MaterialDate>) + 'static>( self, on_confirm: F, ) -> Self
Observe OK. show_date_picker wires this to a staged dismissal
carrying the picked date (ModalDismiss::dismiss_with); a caller
mounting the dialog directly (in a Stack, with no navigator) wires its
own.
Sourcepub fn dismissable(self, dismissable: bool) -> Self
pub fn dismissable(self, dismissable: bool) -> Self
Whether the user can dismiss the dialog at all — the scrim tap,
Escape, and an Android back press (default true). false disables
all three; Cancel and OK still work.
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 dismissal — the callback the Cancel button fires when no
dismiss_handle is installed (see the module
docs’ OK-and-Cancel section). show_date_picker installs a
handle, so on that path Cancel stages the host’s exit instead and this
callback is the host’s own unstaged fallback, nothing more.
Sourcepub fn dismiss_handle(self, dismiss: ModalDismiss) -> Self
pub fn dismiss_handle(self, dismiss: ModalDismiss) -> Self
Install the app-triggered staged-dismiss handle, so Cancel closes
the dialog through the host’s exit ramp instead of firing
on_dismiss into an immediate pop (see
ModalDismiss). show_date_picker installs one for you — and wires
OK to it too, since OK’s own pop is its to make.
Sourcepub fn confirmable(&self) -> Option<MaterialDate>
pub fn confirmable(&self) -> Option<MaterialDate>
What pressing OK would confirm right now.
In calendar mode that is DatePickerState::selected (or None — the
reference pops a null date from an untouched calendar too). In input
mode it is the parsed field text, and None there means OK does
nothing at all rather than confirming an empty pick — see the
module docs.
Sourcepub fn can_confirm(&self) -> bool
pub fn can_confirm(&self) -> bool
Whether pressing OK does anything at all — false only for an input mode whose text does not resolve.
Sourcepub fn confirm(&self, app: &mut State)
pub fn confirm(&self, app: &mut State)
Run the OK action’s body directly — the same code path
Self::confirm_view’s button callback runs, reachable without an
event pass (both routes share [confirm_action], so a test of one is a
test of the other).
Sourcepub fn cancel(&self, app: &mut State)
pub fn cancel(&self, app: &mut State)
Run the Cancel action’s body directly — see Self::confirm.
Trait Implementations§
Source§impl<State: 'static> OverlayModalContent<State> for DatePickerDialog<State>
impl<State: 'static> OverlayModalContent<State> for DatePickerDialog<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 DatePickerDialog<State>
impl<State: 'static> View<State> for DatePickerDialog<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 DatePickerDialog<State>
impl<State> !Send for DatePickerDialog<State>
impl<State> !Sync for DatePickerDialog<State>
impl<State> !UnwindSafe for DatePickerDialog<State>
impl<State> Freeze for DatePickerDialog<State>where
Rc<dyn Fn(&mut State, DatePickerState)>: Freeze,
Option<Rc<dyn Fn(&mut State, Option<MaterialDate>)>>: Freeze,
Option<Rc<dyn Fn(&mut State)>>: Freeze,
impl<State> Unpin for DatePickerDialog<State>where
Rc<dyn Fn(&mut State, DatePickerState)>: Unpin,
Option<Rc<dyn Fn(&mut State, Option<MaterialDate>)>>: Unpin,
Option<Rc<dyn Fn(&mut State)>>: Unpin,
impl<State> UnsafeUnpin for DatePickerDialog<State>where
Rc<dyn Fn(&mut State, DatePickerState)>: UnsafeUnpin,
Option<Rc<dyn Fn(&mut State, Option<MaterialDate>)>>: 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).