pub struct CalendarDatePicker {
pub key: Option<KeyRef>,
pub initial_date: Option<DateTime>,
pub first_date: DateTime,
pub last_date: DateTime,
pub current_date: Option<DateTime>,
pub on_date_changed: ValueChanged<DateTime>,
pub on_displayed_month_changed: Option<ValueChanged<DateTime>>,
pub initial_calendar_mode: DatePickerMode,
pub selectable_day_predicate: Option<SelectableDayPredicate>,
pub day_builder: Option<CalendarDatePickerDayBuilder>,
pub weekday_builder: Option<CalendarDatePickerWeekdayBuilder>,
pub calendar_delegate: Rc<dyn CalendarDelegate>,
}Expand description
A calendar date picker.
A date picker widget that lets the user select a year, month and day: the days of one month show at a time, a header button switches to a grid of years, and the arrows page between months.
The first_date and last_date bound the selectable dates (both inclusive); the
selectable_day_predicate can disable single days.
on_date_changed is called with the date the user picks.
Requires a Material ancestor, a MaterialLocalizations and a
Directionality.
The widget takes the dates “as dates”: it reads only their day, through the
calendar_delegate’s CalendarDelegate::date_only, so a time
of day on initial_date is dropped (effective_initial_date
and its siblings).
See also:
showDatePicker, which shows a dialog that contains a Material Design date picker.showTimePicker, which shows a dialog that contains a Material Design time picker.
Fields§
§key: Option<KeyRef>§initial_date: Option<DateTime>The initially selected DateTime that the picker should display.
Subsequently changing this has no effect. To change the selected date, change the
key to create a new instance of the widget.
If None, no date is selected.
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.
Defaults to CalendarDelegate::now; None: not given.
on_date_changed: ValueChanged<DateTime>Called when the user selects a date in the picker.
on_displayed_month_changed: Option<ValueChanged<DateTime>>Called when the user navigates to a new month/year in the picker.
initial_calendar_mode: DatePickerModeThe initial display of the calendar picker.
selectable_day_predicate: Option<SelectableDayPredicate>Function to provide full control over which dates in the calendar can be selected.
day_builder: Option<CalendarDatePickerDayBuilder>Builds the widget of a day in the calendar, from the default one.
weekday_builder: Option<CalendarDatePickerWeekdayBuilder>Builds the widget of a weekday header, from the default one.
calendar_delegate: Rc<dyn CalendarDelegate>The calendar system to use.
Defaults to GregorianCalendarDelegate.
Implementations§
Source§impl CalendarDatePicker
impl CalendarDatePicker
Sourcepub fn new(
initial_date: Option<DateTime>,
first_date: DateTime,
last_date: DateTime,
on_date_changed: ValueChanged<DateTime>,
) -> CalendarDatePicker
pub fn new( initial_date: Option<DateTime>, first_date: DateTime, last_date: DateTime, on_date_changed: ValueChanged<DateTime>, ) -> CalendarDatePicker
Creates a calendar date picker; Dart’s optional named arguments are the setters.
It will display a grid of days for the initial_date’s month, if non-None, or the
current date’s month otherwise. The day indicated by initial_date will be selected if
it is non-None.
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 effective_current_date(&self, app: &App) -> DateTime
pub fn effective_current_date(&self, app: &App) -> DateTime
Dart’s currentDate field, as its constructor fills it: the day of the date given, or
of the delegate’s now.
Sourcepub fn key(self, key: KeyRef) -> CalendarDatePicker
pub fn key(self, key: KeyRef) -> CalendarDatePicker
Dart CalendarDatePicker(key:).
Sourcepub fn current_date(self, current_date: DateTime) -> CalendarDatePicker
pub fn current_date(self, current_date: DateTime) -> CalendarDatePicker
Dart CalendarDatePicker(currentDate:).
Sourcepub fn on_displayed_month_changed(
self,
on_displayed_month_changed: ValueChanged<DateTime>,
) -> CalendarDatePicker
pub fn on_displayed_month_changed( self, on_displayed_month_changed: ValueChanged<DateTime>, ) -> CalendarDatePicker
Dart CalendarDatePicker(onDisplayedMonthChanged:).
Sourcepub fn initial_calendar_mode(
self,
initial_calendar_mode: DatePickerMode,
) -> CalendarDatePicker
pub fn initial_calendar_mode( self, initial_calendar_mode: DatePickerMode, ) -> CalendarDatePicker
Dart CalendarDatePicker(initialCalendarMode:).
Sourcepub fn selectable_day_predicate(
self,
selectable_day_predicate: SelectableDayPredicate,
) -> CalendarDatePicker
pub fn selectable_day_predicate( self, selectable_day_predicate: SelectableDayPredicate, ) -> CalendarDatePicker
Dart CalendarDatePicker(selectableDayPredicate:).
Sourcepub fn day_builder(
self,
day_builder: CalendarDatePickerDayBuilder,
) -> CalendarDatePicker
pub fn day_builder( self, day_builder: CalendarDatePickerDayBuilder, ) -> CalendarDatePicker
Dart CalendarDatePicker(dayBuilder:).
Sourcepub fn weekday_builder(
self,
weekday_builder: CalendarDatePickerWeekdayBuilder,
) -> CalendarDatePicker
pub fn weekday_builder( self, weekday_builder: CalendarDatePickerWeekdayBuilder, ) -> CalendarDatePicker
Dart CalendarDatePicker(weekdayBuilder:).
Sourcepub fn calendar_delegate(
self,
calendar_delegate: Rc<dyn CalendarDelegate>,
) -> CalendarDatePicker
pub fn calendar_delegate( self, calendar_delegate: Rc<dyn CalendarDelegate>, ) -> CalendarDatePicker
Dart CalendarDatePicker(calendarDelegate:).
Trait Implementations§
Source§impl Debug for CalendarDatePicker
impl Debug for CalendarDatePicker
Source§impl StatefulWidget for CalendarDatePicker
impl StatefulWidget for CalendarDatePicker
Source§type State = CalendarDatePickerState
type State = CalendarDatePickerState
Source§fn create_state(&self) -> CalendarDatePickerState
fn create_state(&self) -> CalendarDatePickerState
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 CalendarDatePicker
impl !Send for CalendarDatePicker
impl !Sync for CalendarDatePicker
impl !UnwindSafe for CalendarDatePicker
impl Forget for CalendarDatePicker
impl Freeze for CalendarDatePickerwhere
*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 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 CalendarDatePicker
impl Unpin for CalendarDatePickerwhere
Rc<dyn Key>: Unpin,
Rc<dyn Fn(&mut App, DateTime)>: Unpin,
Rc<dyn Fn(&App, DateTime) -> bool>: 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 CalendarDatePickerwhere
*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 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<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.