pub struct DatePickerDialog {Show 24 fields
pub key: Option<KeyRef>,
pub initial_date: Option<DateTime>,
pub first_date: DateTime,
pub last_date: DateTime,
pub current_date: Option<DateTime>,
pub initial_entry_mode: DatePickerEntryMode,
pub selectable_day_predicate: Option<SelectableDayPredicate>,
pub cancel_text: Option<String>,
pub confirm_text: Option<String>,
pub help_text: Option<String>,
pub initial_calendar_mode: DatePickerMode,
pub error_format_text: Option<String>,
pub error_invalid_text: Option<String>,
pub field_hint_text: Option<String>,
pub field_label_text: Option<String>,
pub keyboard_type: Option<TextInputType>,
pub restoration_id: Option<String>,
pub on_date_picker_mode_change: Option<ValueChanged<DatePickerEntryMode>>,
pub switch_to_input_entry_mode_icon: Option<WidgetRef>,
pub switch_to_calendar_entry_mode_icon: Option<WidgetRef>,
pub inset_padding: EdgeInsets,
pub day_builder: Option<CalendarDatePickerDayBuilder>,
pub weekday_builder: Option<CalendarDatePickerWeekdayBuilder>,
pub calendar_delegate: Rc<dyn CalendarDelegate>,
}Expand description
A Material-style date picker dialog.
It displays a calendar grid of days, allowing the user to select a date, and a button to switch to a text field where a date can be typed.
It is used by ShowDatePicker, which should usually be used
rather than creating a DatePickerDialog directly.
See also: CalendarDatePicker, InputDatePickerFormField, ShowDatePicker,
DateRangePickerDialog.
Fields§
§key: Option<KeyRef>§initial_date: Option<DateTime>The initially selected DateTime that the picker should display.
If this is null, there is no selected date. A date must be selected to submit the dialog.
first_date: DateTimeThe earliest allowable DateTime that the user can select.
last_date: DateTimeThe latest allowable DateTime that the user can select.
current_date: Option<DateTime>The DateTime representing today. It will be highlighted in the day grid. If null,
the date of the calendar delegate’s now is used.
initial_entry_mode: DatePickerEntryModeThe initial mode of date entry method for the date picker dialog.
See DatePickerEntryMode for the different data entry modes.
selectable_day_predicate: Option<SelectableDayPredicate>Function to provide full control over which DateTime can be selected.
cancel_text: Option<String>The text that is displayed on the cancel button.
confirm_text: Option<String>The text that is displayed on the confirm button.
help_text: Option<String>The text that is displayed at the top of the header.
This is used to indicate to the user what they are selecting a date for.
initial_calendar_mode: DatePickerModeThe initial display of the calendar picker.
error_format_text: Option<String>The error text displayed if the entered date is not in the correct format.
error_invalid_text: Option<String>The error text displayed if the date is not valid.
A date is not valid if it is earlier than first_date, later than
last_date, or doesn’t pass the
selectable_day_predicate.
field_hint_text: Option<String>The hint text displayed in the TextField.
If this is null, it will default to the date format string. For example, ‘mm/dd/yyyy’ for en_US.
field_label_text: Option<String>The label text displayed in the TextField.
If this is null, it will default to the words representing the date format string. For example, ‘Enter Date’ for en_US.
keyboard_type: Option<TextInputType>The keyboard type of the TextField.
If this is null, it will default to [TextInputType::datetime].
restoration_id: Option<String>Restoration ID to save and restore the state of the DatePickerDialog.
If it is non-null, the date picker will persist and restore the date selected on the dialog.
The state of this widget is persisted in a RestorationBucket claimed from the
surrounding RestorationScope using the provided restoration ID.
on_date_picker_mode_change: Option<ValueChanged<DatePickerEntryMode>>Called when the DatePickerDialog is toggled between
DatePickerEntryMode::Calendar and DatePickerEntryMode::Input.
switch_to_input_entry_mode_icon: Option<WidgetRef>An optional icon that, when pressed, switches from the calendar to the text input.
switch_to_calendar_entry_mode_icon: Option<WidgetRef>An optional icon that, when pressed, switches from the text input to the calendar.
inset_padding: EdgeInsetsThe padding that surrounds the dialog.
day_builder: Option<CalendarDatePickerDayBuilder>Called to construct the widget for a day in the calendar grid.
weekday_builder: Option<CalendarDatePickerWeekdayBuilder>Called to construct the widget for a weekday header.
calendar_delegate: Rc<dyn CalendarDelegate>The calendar the dialog works in.
Implementations§
Source§impl DatePickerDialog
impl DatePickerDialog
Sourcepub fn new(first_date: DateTime, last_date: DateTime) -> DatePickerDialog
pub fn new(first_date: DateTime, last_date: DateTime) -> DatePickerDialog
Creates a DatePickerDialog. Dart’s optional named arguments are the fluent setters.
The dates are kept as given; the calendar delegate truncates each to its day where the dialog reads it, as Dart’s constructor truncates them.
Sourcepub fn effective_initial_date(&self, app: &App) -> Option<DateTime>
pub fn effective_initial_date(&self, app: &App) -> Option<DateTime>
Dart’s initialDate field, as its constructor fills it: the day of the date given.
Sourcepub fn key(self, key: KeyRef) -> DatePickerDialog
pub fn key(self, key: KeyRef) -> DatePickerDialog
Dart DatePickerDialog(key:).
Sourcepub fn initial_date(self, initial_date: DateTime) -> DatePickerDialog
pub fn initial_date(self, initial_date: DateTime) -> DatePickerDialog
Dart DatePickerDialog(initialDate:).
Sourcepub fn current_date(self, current_date: DateTime) -> DatePickerDialog
pub fn current_date(self, current_date: DateTime) -> DatePickerDialog
Dart DatePickerDialog(currentDate:).
Sourcepub fn initial_entry_mode(
self,
initial_entry_mode: DatePickerEntryMode,
) -> DatePickerDialog
pub fn initial_entry_mode( self, initial_entry_mode: DatePickerEntryMode, ) -> DatePickerDialog
Dart DatePickerDialog(initialEntryMode:).
Sourcepub fn selectable_day_predicate(
self,
selectable_day_predicate: SelectableDayPredicate,
) -> DatePickerDialog
pub fn selectable_day_predicate( self, selectable_day_predicate: SelectableDayPredicate, ) -> DatePickerDialog
Dart DatePickerDialog(selectableDayPredicate:).
Sourcepub fn initial_calendar_mode(
self,
initial_calendar_mode: DatePickerMode,
) -> DatePickerDialog
pub fn initial_calendar_mode( self, initial_calendar_mode: DatePickerMode, ) -> DatePickerDialog
Dart DatePickerDialog(initialCalendarMode:).
Sourcepub fn restoration_id(
self,
restoration_id: impl Into<String>,
) -> DatePickerDialog
pub fn restoration_id( self, restoration_id: impl Into<String>, ) -> DatePickerDialog
Dart DatePickerDialog(restorationId:).
Sourcepub fn inset_padding(self, inset_padding: EdgeInsets) -> DatePickerDialog
pub fn inset_padding(self, inset_padding: EdgeInsets) -> DatePickerDialog
Dart DatePickerDialog(insetPadding:).
Sourcepub fn calendar_delegate(
self,
calendar_delegate: Rc<dyn CalendarDelegate>,
) -> DatePickerDialog
pub fn calendar_delegate( self, calendar_delegate: Rc<dyn CalendarDelegate>, ) -> DatePickerDialog
Dart DatePickerDialog(calendarDelegate:).
Trait Implementations§
Source§impl Clone for DatePickerDialog
impl Clone for DatePickerDialog
Source§impl Debug for DatePickerDialog
impl Debug for DatePickerDialog
Source§impl StatefulWidget for DatePickerDialog
impl StatefulWidget for DatePickerDialog
Source§type State = DatePickerDialogState
type State = DatePickerDialogState
Source§fn create_state(&self) -> DatePickerDialogState
fn create_state(&self) -> DatePickerDialogState
Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
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 as_preferred_size_widget(
&self,
) -> Option<&(dyn PreferredSizeWidget + 'static)>
fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>
Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
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 DatePickerDialog
impl !Send for DatePickerDialog
impl !Sync for DatePickerDialog
impl !UnwindSafe for DatePickerDialog
impl Forget for DatePickerDialog
impl Freeze for DatePickerDialogwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
*const RcInner<dyn Fn(&App, DateTime) -> bool> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&App, DateTime) -> bool>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const RcInner<dyn Fn(&mut App, DatePickerEntryMode)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, DatePickerEntryMode)>>: Freeze,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
*const RcInner<dyn Fn(&mut App, AnyElement, CalendarDatePickerDayDetails) -> Rc<dyn Widget>> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, CalendarDatePickerDayDetails) -> Rc<dyn Widget>>>: Freeze,
*const RcInner<dyn Fn(&mut App, AnyElement, CalendarDatePickerWeekdayDetails) -> Rc<dyn Widget>> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, CalendarDatePickerWeekdayDetails) -> Rc<dyn Widget>>>: Freeze,
*const RcInner<dyn CalendarDelegate> is !null: Freeze,
PhantomData<RcInner<dyn CalendarDelegate>>: Freeze,
impl Move for DatePickerDialog
impl Unpin for DatePickerDialogwhere
Rc<dyn Key>: Unpin,
Rc<dyn Fn(&App, DateTime) -> bool>: Unpin,
*const u8 is !null: Unpin,
Rc<dyn Fn(&mut App, DatePickerEntryMode)>: Unpin,
Rc<dyn Widget>: Unpin,
Rc<dyn Fn(&mut App, AnyElement, CalendarDatePickerDayDetails) -> Rc<dyn Widget>>: Unpin,
Rc<dyn Fn(&mut App, AnyElement, CalendarDatePickerWeekdayDetails) -> Rc<dyn Widget>>: Unpin,
Rc<dyn CalendarDelegate>: Unpin,
impl UnsafeUnpin for DatePickerDialogwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const RcInner<dyn Fn(&App, DateTime) -> bool> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&App, DateTime) -> bool>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, DatePickerEntryMode)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, DatePickerEntryMode)>>: UnsafeUnpin,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, AnyElement, CalendarDatePickerDayDetails) -> Rc<dyn Widget>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, CalendarDatePickerDayDetails) -> Rc<dyn Widget>>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, AnyElement, CalendarDatePickerWeekdayDetails) -> Rc<dyn Widget>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, CalendarDatePickerWeekdayDetails) -> Rc<dyn Widget>>>: UnsafeUnpin,
*const RcInner<dyn CalendarDelegate> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn CalendarDelegate>>: 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.