pub struct InputDatePickerFormField {Show 16 fields
pub key: Option<KeyRef>,
pub initial_date: Option<DateTime>,
pub first_date: DateTime,
pub last_date: DateTime,
pub on_date_submitted: Option<ValueChanged<DateTime>>,
pub on_date_saved: Option<ValueChanged<DateTime>>,
pub selectable_day_predicate: Option<SelectableDayPredicate>,
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 autofocus: bool,
pub accept_empty_date: bool,
pub focus_node: Option<FocusNodeRef>,
pub calendar_delegate: Rc<dyn CalendarDelegate>,
}Expand description
A TextFormField configured to accept and validate a date entered by a user.
When the field is saved or submitted, the text will be parsed into a DateTime according
to the ambient locale’s compact date format. If the input text doesn’t parse into a date,
the error_format_text message will be displayed under the field.
first_date, last_date, and
selectable_day_predicate provide constraints on the
dates that are valid. If the input date isn’t in the date range or doesn’t pass the given
predicate, then the error_invalid_text message will be
displayed under the field.
In addition to validating the user input text, this widget can accept user input
through the keyboard or other input methods, via the field’s text editing; the date it
shows is the initial_date, formatted.
Requires a MaterialLocalizations and a Directionality
ancestor.
See also:
showDatePicker, which shows a dialog that contains a Material Design date picker which includes support for text entry of dates.
Fields§
§key: Option<KeyRef>§initial_date: Option<DateTime>If provided, it will be used as the default value of the field.
first_date: DateTimeThe earliest allowable DateTime that the user can input.
last_date: DateTimeThe latest allowable DateTime that the user can input.
on_date_submitted: Option<ValueChanged<DateTime>>An optional method to call when the user indicates they are done editing the text in
the field. Will only be called if the input represents a valid DateTime.
on_date_saved: Option<ValueChanged<DateTime>>An optional method to call with the final date when the form is saved via
FormState::save. Will only be called if the input represents a valid DateTime.
selectable_day_predicate: Option<SelectableDayPredicate>Function to provide full control over which DateTime can be selected.
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.
autofocus: boolWhether this field should focus itself if nothing else is already focused.
If true, the keyboard will open as soon as this input obtains focus. Otherwise, the keyboard is only shown after the user taps the text field.
Defaults to false.
accept_empty_date: boolDetermines if an empty date would show error_format_text or
not.
Defaults to false.
When autofocus is true and the date is empty, an error is not
shown.
focus_node: Option<FocusNodeRef>Focus node of the field.
calendar_delegate: Rc<dyn CalendarDelegate>The calendar system to use.
Defaults to GregorianCalendarDelegate.
Implementations§
Source§impl InputDatePickerFormField
impl InputDatePickerFormField
Sourcepub fn new(
first_date: DateTime,
last_date: DateTime,
) -> InputDatePickerFormField
pub fn new( first_date: DateTime, last_date: DateTime, ) -> InputDatePickerFormField
Creates a TextFormField configured to accept and validate a date; Dart’s optional
named arguments are the setters.
If the optional initial_date is provided, then it will be used
to populate the text field. If the initial_date is outside of
the allowed range, it will be shown as the initial text, and an error will be shown.
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 effective_first_date(&self, app: &App) -> DateTime
pub fn effective_first_date(&self, app: &App) -> DateTime
Dart’s firstDate field, as its constructor fills it: the day of the date given.
Sourcepub fn effective_last_date(&self, app: &App) -> DateTime
pub fn effective_last_date(&self, app: &App) -> DateTime
Dart’s lastDate field, as its constructor fills it: the day of the date given.
Sourcepub fn key(self, key: KeyRef) -> InputDatePickerFormField
pub fn key(self, key: KeyRef) -> InputDatePickerFormField
Dart InputDatePickerFormField(key:).
Sourcepub fn initial_date(self, initial_date: DateTime) -> InputDatePickerFormField
pub fn initial_date(self, initial_date: DateTime) -> InputDatePickerFormField
Dart InputDatePickerFormField(initialDate:).
Sourcepub fn on_date_submitted(
self,
on_date_submitted: ValueChanged<DateTime>,
) -> InputDatePickerFormField
pub fn on_date_submitted( self, on_date_submitted: ValueChanged<DateTime>, ) -> InputDatePickerFormField
Dart InputDatePickerFormField(onDateSubmitted:).
Sourcepub fn on_date_saved(
self,
on_date_saved: ValueChanged<DateTime>,
) -> InputDatePickerFormField
pub fn on_date_saved( self, on_date_saved: ValueChanged<DateTime>, ) -> InputDatePickerFormField
Dart InputDatePickerFormField(onDateSaved:).
Sourcepub fn selectable_day_predicate(
self,
selectable_day_predicate: SelectableDayPredicate,
) -> InputDatePickerFormField
pub fn selectable_day_predicate( self, selectable_day_predicate: SelectableDayPredicate, ) -> InputDatePickerFormField
Dart InputDatePickerFormField(selectableDayPredicate:).
Sourcepub fn error_format_text(
self,
error_format_text: impl Into<String>,
) -> InputDatePickerFormField
pub fn error_format_text( self, error_format_text: impl Into<String>, ) -> InputDatePickerFormField
Dart InputDatePickerFormField(errorFormatText:).
Sourcepub fn error_invalid_text(
self,
error_invalid_text: impl Into<String>,
) -> InputDatePickerFormField
pub fn error_invalid_text( self, error_invalid_text: impl Into<String>, ) -> InputDatePickerFormField
Dart InputDatePickerFormField(errorInvalidText:).
Sourcepub fn field_hint_text(
self,
field_hint_text: impl Into<String>,
) -> InputDatePickerFormField
pub fn field_hint_text( self, field_hint_text: impl Into<String>, ) -> InputDatePickerFormField
Dart InputDatePickerFormField(fieldHintText:).
Sourcepub fn field_label_text(
self,
field_label_text: impl Into<String>,
) -> InputDatePickerFormField
pub fn field_label_text( self, field_label_text: impl Into<String>, ) -> InputDatePickerFormField
Dart InputDatePickerFormField(fieldLabelText:).
Sourcepub fn keyboard_type(
self,
keyboard_type: TextInputType,
) -> InputDatePickerFormField
pub fn keyboard_type( self, keyboard_type: TextInputType, ) -> InputDatePickerFormField
Dart InputDatePickerFormField(keyboardType:).
Sourcepub fn autofocus(self, autofocus: bool) -> InputDatePickerFormField
pub fn autofocus(self, autofocus: bool) -> InputDatePickerFormField
Dart InputDatePickerFormField(autofocus:).
Sourcepub fn accept_empty_date(
self,
accept_empty_date: bool,
) -> InputDatePickerFormField
pub fn accept_empty_date( self, accept_empty_date: bool, ) -> InputDatePickerFormField
Dart InputDatePickerFormField(acceptEmptyDate:).
Sourcepub fn focus_node(self, focus_node: FocusNodeRef) -> InputDatePickerFormField
pub fn focus_node(self, focus_node: FocusNodeRef) -> InputDatePickerFormField
Dart InputDatePickerFormField(focusNode:).
Sourcepub fn calendar_delegate(
self,
calendar_delegate: Rc<dyn CalendarDelegate>,
) -> InputDatePickerFormField
pub fn calendar_delegate( self, calendar_delegate: Rc<dyn CalendarDelegate>, ) -> InputDatePickerFormField
Dart InputDatePickerFormField(calendarDelegate:).
Trait Implementations§
Source§impl Debug for InputDatePickerFormField
impl Debug for InputDatePickerFormField
Source§impl StatefulWidget for InputDatePickerFormField
impl StatefulWidget for InputDatePickerFormField
Source§type State = InputDatePickerFormFieldState
type State = InputDatePickerFormFieldState
Source§fn create_state(&self) -> InputDatePickerFormFieldState
fn create_state(&self) -> InputDatePickerFormFieldState
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 InputDatePickerFormField
impl !Send for InputDatePickerFormField
impl !Sync for InputDatePickerFormField
impl !UnwindSafe for InputDatePickerFormField
impl Forget for InputDatePickerFormField
impl Freeze for InputDatePickerFormFieldwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
*const RcInner<dyn Fn(&mut App, DateTime)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, DateTime)>>: 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,
NonZero<u32>: Freeze,
&'static FocusNodeVTable: Freeze,
*const RcInner<Keep> is !null: Freeze,
PhantomData<RcInner<Keep>>: Freeze,
*const RcInner<dyn CalendarDelegate> is !null: Freeze,
PhantomData<RcInner<dyn CalendarDelegate>>: Freeze,
impl Move for InputDatePickerFormField
impl Unpin for InputDatePickerFormField
impl UnsafeUnpin for InputDatePickerFormFieldwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, DateTime)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, DateTime)>>: 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,
NonZeroU32Inner: UnsafeUnpin,
&'static FocusNodeVTable: UnsafeUnpin,
*const RcInner<Keep> is !null: UnsafeUnpin,
PhantomData<RcInner<Keep>>: 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<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.