MonthPicker class

Displays a grid of months for a given year and allows the user to select a date.

Months are arranged in a rectangular grid with one column for each month of the year. Controls are provided to change the year that the grid is showing.

The month picker widget is rarely used directly. Instead, consider using showDatePickerDialog, which will create a dialog that uses this.

See also:

Inheritance

Constructors

MonthPicker({Key? key, required DateTime minDate, required DateTime maxDate, DateTime? initialDate, DateTime? currentDate, DateTime? selectedDate, TextStyle? enabledCellsTextStyle, BoxDecoration enabledCellsDecoration = const BoxDecoration(), TextStyle? disabledCellsTextStyle, BoxDecoration disabledCellsDecoration = const BoxDecoration(), TextStyle? currentDateTextStyle, BoxDecoration? currentDateDecoration, TextStyle? selectedCellTextStyle, BoxDecoration? selectedCellDecoration, VoidCallback? onLeadingDateTap, ValueChanged<DateTime>? onDateSelected, TextStyle? leadingDateTextStyle, Color? slidersColor, double? slidersSize, Color? highlightColor, Color? splashColor, double? splashRadius, bool centerLeadingDate = false, String? previousPageSemanticLabel = 'Previous Month', String? nextPageSemanticLabel = 'Next Month'})
Creates a month 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
disabledCellsDecoration BoxDecoration
The cell decoration of cells which are not selectable.
final
disabledCellsTextStyle TextStyle?
The text style of cells which are not selectable.
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(). If DateTime.now() does not fall within the valid range of minDate and maxDate, it will automatically adjust to the nearest valid date, selecting maxDate if DateTime.now() is after the valid range, or minDate if it is before.
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
onLeadingDateTap VoidCallback?
Called when the user tap on the leading date.
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<MonthPicker>
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