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, DateTime? initialDate, DateTime? selectedDate, DateTime? currentDate, EdgeInsets padding = const EdgeInsets.all(16), PickerType initialPickerType = PickerType.days, TextStyle? daysOfTheWeekTextStyle, TextStyle? enabledCellsTextStyle, BoxDecoration enabledCellsDecoration = const BoxDecoration(), TextStyle? disabledCellsTextStyle, BoxDecoration disabledCellsDecoration = const BoxDecoration(), TextStyle? currentDateTextStyle, BoxDecoration? currentDateDecoration, TextStyle? selectedCellTextStyle, BoxDecoration? selectedCellDecoration, TextStyle? leadingDateTextStyle, Color? slidersColor, double? slidersSize, Color? highlightColor, Color? splashColor, double? splashRadius, bool centerLeadingDate = false, String? previousPageSemanticLabel, String? nextPageSemanticLabel, DatePredicate? disabledDayPredicate}) - Creates a calendar date picker.
Properties
- centerLeadingDate → bool
-
Centring the leading date. e.g:
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 - currentDateDecoration → BoxDecoration?
-
The cell decoration of the current date.
final
- currentDateTextStyle → TextStyle?
-
The text style of the current date.
final
- daysOfTheWeekTextStyle → TextStyle?
-
The text style of the days of the week in the header.
final
- disabledCellsDecoration → BoxDecoration
-
The cell decoration of cells which are not selectable.
final
- disabledCellsTextStyle → TextStyle?
-
The text style of cells which are not selectable.
final
- disabledDayPredicate → DatePredicate?
-
A predicate function used to determine if a given day should be disabled.
final
- enabledCellsDecoration → BoxDecoration
-
The cell decoration of cells which are selectable.
final
- enabledCellsTextStyle → TextStyle?
-
The text style of cells which are selectable.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- highlightColor → Color?
-
The highlight color of the ink response when pressed.
final
- initialDate → 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 - initialPickerType → PickerType
-
The initial display of the calendar picker.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- leadingDateTextStyle → TextStyle?
-
The text style of leading date showing in the header.
final
- maxDate → DateTime
-
The latest date the user is permitted to pick.
final
- minDate → DateTime
-
The earliest date the user is permitted to pick.
final
- nextPageSemanticLabel → String?
-
Semantic label for button to go to the next page.
final
-
onDateSelected
→ ValueChanged<
DateTime> ? -
Called when the user picks a date.
final
- padding → EdgeInsets
-
The amount of padding to be added around the DatePicker.
final
- previousPageSemanticLabel → String?
-
Semantic label for button to go to the previous page.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectedCellDecoration → BoxDecoration?
-
The cell decoration of selected cell.
final
- selectedCellTextStyle → TextStyle?
-
The text style of selected cell.
final
- selectedDate → DateTime?
-
The initially selected date when the picker is first opened.
final
- slidersColor → Color?
-
The color of the page sliders.
final
- slidersSize → double?
-
The size of the page sliders.
final
- splashColor → Color?
-
The splash color of the ink response.
final
- splashRadius → double?
-
The radius of the ink splash.
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}) → 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