DatePicker class
Displays a grid of days for a given month and allows the user to select a date.
Days are arranged in a rectangular grid with one column for each day of the week. Controls are provided to change the year and month that the grid is showing.
The date picker widget is rarely used directly. Instead, consider using showDatePickerDialog, which will create a dialog that uses this.
See also:
- showDatePickerDialog, which creates a Dialog that contains a DatePicker.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- DatePicker
Constructors
-
DatePicker({Key? key, required DateTime maxDate, required DateTime minDate, ValueChanged<
DateTime> ? onDateSelected, ValueChanged<DateTime> ? onDisplayedMonthChanged, DateTime? displayedDate, DateTime? selectedDate, DateTime? currentDate, EdgeInsets padding = const EdgeInsets.all(16), PickerType initialPickerType = PickerType.days, DatePredicate? disabledDayPredicate, CellBuilder? cellBuilder, DatePickerPlusTheme? theme}) - Creates a calendar date picker.
Properties
- cellBuilder → CellBuilder?
-
Optional builder for customizing individual cells.
final
- currentDate → DateTime?
-
The date to which the picker will consider as current date. e.g (today).
If not specified, the picker will default to
DateTime.now()date.final - disabledDayPredicate → DatePredicate?
-
A predicate function used to determine if a given day should be disabled.
final
- displayedDate → DateTime?
-
The date which will be displayed on first opening. If not specified, the picker
will default to
DateTime.now(). IfDateTime.now()does not fall within the valid range of minDate and maxDate, it will automatically adjust to the nearest valid date, selecting maxDate ifDateTime.now()is after the valid range, or minDate if it is before.final - hashCode → int
-
The hash code for this object.
no setterinherited
- initialPickerType → PickerType
-
The initial display of the calendar picker.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- maxDate → DateTime
-
The latest date the user is permitted to pick.
final
- minDate → DateTime
-
The earliest date the user is permitted to pick.
final
-
onDateSelected
→ ValueChanged<
DateTime> ? -
Called when the user picks a date.
final
-
onDisplayedMonthChanged
→ ValueChanged<
DateTime> ? -
Called when the displayed month changes in the days grid.
final
- padding → EdgeInsets
-
The amount of padding to be added around the DatePicker.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectedDate → DateTime?
-
The initially selected date when the picker is first opened.
final
- theme → DatePickerPlusTheme?
-
The theme to apply to the DatePicker.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< DatePicker> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited