Calendar class

A month-view date picker with single or multiple selection.

Renders a month grid with prev/next navigation and an inline year picker. Selection is controlled by value/onChanged in CalendarSelectionMode.single or multipleValue/onMultipleChanged in multiple mode. focusedValue controls the initially displayed month and follows updates; minValue/maxValue plus isDateUnavailable disable days, and readOnly freezes the current selection.

Calendar(
  value: selected,
  minValue: DateTime.now(),
  onChanged: (d) => setState(() => selected = d),
)
Inheritance

Constructors

Calendar({Key? key, CalendarSelectionMode selectionMode = CalendarSelectionMode.single, DateTime? value, List<DateTime>? multipleValue, ValueChanged<DateTime>? onChanged, ValueChanged<List<DateTime>>? onMultipleChanged, DateTime? focusedValue, ValueChanged<DateTime>? onFocusChange, DateTime? minValue, DateTime? maxValue, bool disabled = false, bool readOnly = false, bool isDateUnavailable(DateTime)?})
Creates a Calendar.
const

Properties

disabled → bool
Disables the whole calendar.
final
focusedValue → DateTime?
A date in the month to show. When null the calendar keeps track of the month itself.
final
hashCode → int
The hash code for this object.
no setterinherited
isDateUnavailable → bool Function(DateTime)?
Returns true for dates that cannot be selected.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxValue → DateTime?
Latest selectable date.
final
minValue → DateTime?
Earliest selectable date.
final
multipleValue → List<DateTime>?
The selected dates in multiple-selection mode.
final
onChanged → ValueChanged<DateTime>?
Called with the date the user picked in single-selection mode.
final
onFocusChange → ValueChanged<DateTime>?
Called with the first day of the shown month when it changes.
final
onMultipleChanged → ValueChanged<List<DateTime>>?
Called with the selected dates in multiple-selection mode.
final
readOnly → bool
Shows the selection but ignores taps on days.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectionMode → CalendarSelectionMode
Whether one or several dates can be selected.
final
value → DateTime?
The selected date in single-selection mode.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<Calendar>
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