Skip to main content

TimePickerDialog

Struct TimePickerDialog 

Source
pub struct TimePickerDialog {
Show 15 fields pub key: Option<KeyRef>, pub initial_time: TimeOfDay, pub cancel_text: Option<String>, pub confirm_text: Option<String>, pub help_text: Option<String>, pub error_invalid_text: Option<String>, pub hour_label_text: Option<String>, pub minute_label_text: Option<String>, pub restoration_id: Option<String>, pub initial_entry_mode: TimePickerEntryMode, pub orientation: Option<Orientation>, pub on_entry_mode_changed: Option<EntryModeChangeCallback>, pub switch_to_input_entry_mode_icon: Option<WidgetRef>, pub switch_to_timer_entry_mode_icon: Option<WidgetRef>, pub empty_initial_input: bool,
}
Expand description

A Material Design time picker designed to appear inside a popup dialog.

Pass this widget to ShowDialog. The value returned by ShowDialog is the selected TimeOfDay if the user taps the “OK” button, or null if the user taps the “CANCEL” button. The selected time is reported by popping the navigator with the selected time.

Use ShowTimePicker to show the dialog.

Fields§

§key: Option<KeyRef>§initial_time: TimeOfDay

The time initially selected when the dialog is shown.

§cancel_text: Option<String>

Optionally provide your own text for the cancel button.

If null, the button uses MaterialLocalizations::cancel_button_label.

§confirm_text: Option<String>

Optionally provide your own text for the confirm button.

If null, the button uses MaterialLocalizations::ok_button_label.

§help_text: Option<String>

Optionally provide your own help text to the header of the time picker.

§error_invalid_text: Option<String>

Optionally provide your own validation error text.

§hour_label_text: Option<String>

Optionally provide your own hour label text.

§minute_label_text: Option<String>

Optionally provide your own minute label text.

§restoration_id: Option<String>

Restoration ID to save and restore the state of the TimePickerDialog.

If it is non-null, the time picker will persist and restore the selected time and whether the dialog was in the dial or input entry mode.

The state of this widget is persisted in a [RestorationBucket] claimed from the surrounding [RestorationScope] using the provided restoration ID.

§initial_entry_mode: TimePickerEntryMode

The entry mode for the picker. Whether it’s text input or a dial.

§orientation: Option<Orientation>

The optional orientation parameter sets the Orientation to use when displaying the dialog.

By default, the orientation is derived from the [MediaQueryData::size] of the ambient MediaQuery. If the aspect of the size is tall, then Orientation::Portrait is used, if the size is wide, then Orientation::Landscape is used.

Use this parameter to override the default and force the dialog to appear in either portrait or landscape mode regardless of the aspect of the [MediaQueryData::size].

§on_entry_mode_changed: Option<EntryModeChangeCallback>

Callback called when the selected entry mode is changed.

§switch_to_input_entry_mode_icon: Option<WidgetRef>

Optionally provide your own icon for the icon button used to switch the mode to input.

§switch_to_timer_entry_mode_icon: Option<WidgetRef>

Optionally provide your own icon for the icon button used to switch the mode to dial.

§empty_initial_input: bool

Whether the input mode should start empty.

If true, the hour and minute fields start empty and display hints for the expected values.

Implementations§

Source§

impl TimePickerDialog

Source

pub fn new(initial_time: TimeOfDay) -> TimePickerDialog

Creates a Material Design time picker.

Dart’s named arguments are the setters.

Source

pub fn key(self, key: KeyRef) -> TimePickerDialog

Dart TimePickerDialog(key:).

Source

pub fn cancel_text(self, cancel_text: impl Into<String>) -> TimePickerDialog

Dart TimePickerDialog(cancelText:).

Source

pub fn confirm_text(self, confirm_text: impl Into<String>) -> TimePickerDialog

Dart TimePickerDialog(confirmText:).

Source

pub fn help_text(self, help_text: impl Into<String>) -> TimePickerDialog

Dart TimePickerDialog(helpText:).

Source

pub fn error_invalid_text( self, error_invalid_text: impl Into<String>, ) -> TimePickerDialog

Dart TimePickerDialog(errorInvalidText:).

Source

pub fn hour_label_text( self, hour_label_text: impl Into<String>, ) -> TimePickerDialog

Dart TimePickerDialog(hourLabelText:).

Source

pub fn minute_label_text( self, minute_label_text: impl Into<String>, ) -> TimePickerDialog

Dart TimePickerDialog(minuteLabelText:).

Source

pub fn restoration_id( self, restoration_id: impl Into<String>, ) -> TimePickerDialog

Dart TimePickerDialog(restorationId:).

Source

pub fn initial_entry_mode( self, initial_entry_mode: TimePickerEntryMode, ) -> TimePickerDialog

Dart TimePickerDialog(initialEntryMode:).

Source

pub fn orientation(self, orientation: Orientation) -> TimePickerDialog

Dart TimePickerDialog(orientation:).

Source

pub fn on_entry_mode_changed( self, on_entry_mode_changed: EntryModeChangeCallback, ) -> TimePickerDialog

Dart TimePickerDialog(onEntryModeChanged:).

Source

pub fn switch_to_input_entry_mode_icon(self, icon: Icon) -> TimePickerDialog

Dart TimePickerDialog(switchToInputEntryModeIcon:).

Source

pub fn switch_to_timer_entry_mode_icon(self, icon: Icon) -> TimePickerDialog

Dart TimePickerDialog(switchToTimerEntryModeIcon:).

Source

pub fn empty_initial_input(self, empty_initial_input: bool) -> TimePickerDialog

Dart TimePickerDialog(emptyInitialInput:).

Trait Implementations§

Source§

impl Clone for TimePickerDialog

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TimePickerDialog

Source§

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

Formats the value using the given formatter. Read more
Source§

impl StatefulWidget for TimePickerDialog

Source§

type State = TimePickerDialogState

The state this widget creates.
Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn create_state(&self) -> TimePickerDialogState

Creates the mutable state for this widget at a given location in the tree. Read more
Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s debugFillProperties: the properties a dump shows for this widget, in Dart’s order. Dart’s Widget base only sets the dense tree style, which the framework does.
Source§

fn debug_check_constructor(&self)

Source§

fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>

Source§

fn type_name(&self) -> &'static str

See Widget::type_name. A stateful form another widget kind becomes (an animated or status transition widget) names the widget it wraps.

Auto Trait Implementations§

§

impl !RefUnwindSafe for TimePickerDialog

§

impl !Send for TimePickerDialog

§

impl !Sync for TimePickerDialog

§

impl !UnwindSafe for TimePickerDialog

§

impl Forget for TimePickerDialog

§

impl Freeze for TimePickerDialog
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const RcInner<dyn Fn(&mut App, TimePickerEntryMode)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, TimePickerEntryMode)>>: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze,

§

impl Move for TimePickerDialog

§

impl Unpin for TimePickerDialog
where Rc<dyn Key>: Unpin, *const u8 is !null: Unpin, Rc<dyn Fn(&mut App, TimePickerEntryMode)>: Unpin, Rc<dyn Widget>: Unpin,

§

impl UnsafeUnpin for TimePickerDialog
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, TimePickerEntryMode)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, TimePickerEntryMode)>>: UnsafeUnpin, *const RcInner<dyn Widget> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Widget>>: 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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<W> IntoWidget<StatefulKind> for W
where W: StatefulWidget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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>