CsCalendar class

Cloudscape's Calendar: a month grid (or a year of months) for picking one date, shown inline. For a field with a calendar dropdown use CsDatePicker.

It is controlled: value is YYYY-MM-DD (YYYY-MM with CsDateGranularity.month) or an empty string, and onChange receives the picked date in the same format.

CsCalendar(
  value: launchDate,
  isDateEnabled: (d) => d.weekday != DateTime.saturday && d.weekday != DateTime.sunday,
  dateDisabledReason: (d) => 'Launches run on weekdays only.',
  onChange: (v) => setState(() => launchDate = v),
)
  • The grid always shows six weeks; days of the next month are dimmed but can be picked, as in Cloudscape.
  • Today has the color-background-calendar-current-date fill and bold text; the selected day is color-background-control-checked with color-text-calendar-date-selected text.
  • Days rejected by isDateEnabled can not be picked. With a dateDisabledReason they stay focusable and show the reason in a tooltip.
  • Keyboard: the grid is one Tab stop. Arrows move by day and week (by month and quarter in a month calendar), Page Up and Page Down by month (with Shift, by year), Home and End to the start and end of the row, Enter and Space pick. Disabled days are skipped.
  • On touch, a horizontal swipe changes the month.
Inheritance

Constructors

CsCalendar({Key? key, required String value, ValueChanged<String>? onChange, CsIsDateEnabled? isDateEnabled, CsDateDisabledReason? dateDisabledReason, int? startOfWeek, CsDateGranularity granularity = CsDateGranularity.day, String? ariaLabel, CsCalendarI18nStrings? i18nStrings, bool autofocus = false, bool stretch = false})
const

Properties

ariaLabel → String?
Accessible name of the calendar (Cloudscape ariaLabel).
final
autofocus → bool
Focus the selected day (or today) when the calendar appears. Date pickers set this when they open.
final
dateDisabledReason → CsDateDisabledReason?
Why a disabled date can not be picked. A reason keeps the date focusable and shows it in a tooltip.
final
granularity → CsDateGranularity
Days or months.
final
hashCode → int
The hash code for this object.
no setterinherited
i18nStrings → CsCalendarI18nStrings?
final
isDateEnabled → CsIsDateEnabled?
Days (or months) that can be picked. All of them by default.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onChange → ValueChanged<String>?
Called with the picked date, formatted like value.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
startOfWeek → int?
First day of the week, 0 (Sunday) to 6 (Saturday). Defaults to CsStrings.firstDayOfWeek.
final
stretch → bool
Fill the available width instead of Cloudscape's 238px grid. Pickers set it in bottom sheets on phones.
final
value → String
The selected date: YYYY-MM-DD, YYYY-MM for months, or empty.
final

Methods

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