DesignCalendarController class

A calendar's state: the shown month, the keyboard's day and the selection.

The caller makes it (a State's field, say), keeps it across rebuilds and disposes it; a widget it is given to only listens to it.

DesignCalendarController(firstDate: DateTime(2026), lastDate: DateTime(2027))
Inheritance

Constructors

DesignCalendarController({required DateTime firstDate, required DateTime lastDate, DesignCalendarMode mode = DesignCalendarMode.single, DateTime? initialMonth, DateTime? selectedDate, DesignDateRange? selectedRange, Iterable<DateTime> selectedDates = const [], bool selectable(DateTime day)?, DateTime? currentDate})
A calendar between firstDate and lastDate. It opens on the month of initialMonth, else of the selection (its earliest day), else of currentDate.

Properties

canGoBack → bool
Whether an earlier month can be shown.
no setter
currentDate → DateTime
Today, marked in the grid.
final
firstDate → DateTime
The earliest day it offers.
final
focusedDay → DateTime
The day the keyboard is on.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
hovered ↔ DateTime?
The day a pointer rests on while a range waits for its end.
getter/setter pair
lastDate → DateTime
The latest day it offers.
final
mode → DesignCalendarMode
How it selects.
final
month → DateTime
The first shown month (its first day).
no setter
preview → DesignDateRange?
The range a waiting start and a resting pointer preview, or null.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectable → bool Function(DateTime day)?
Which days can be chosen, beside the bounds; null for all.
final
selectedDate → DateTime?
The chosen day (DesignCalendarMode.single).
no setter
selectedDates → List<DateTime>
The chosen days (DesignCalendarMode.multiple), in order.
no setter
selectedRange → DesignDateRange?
The chosen range (DesignCalendarMode.range).
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
canGoForward([int months = 1]) → bool
Whether a later month can be shown (months shown at once).
clear() → void
Clears the selection.
dayOf(DateTime day, {required DateTime inMonth}) → DesignCalendarDay
day as the grid paints it.
dispose() → void
Discards any resources used by the object.
inherited
focus(DateTime day, {int months = 1}) → void
Puts the keyboard on day, turning to its month when it is not shown (months shown at once).
isSelectable(DateTime day) → bool
Whether day is inside the bounds and selectable.
moveFocus(int days, {int months = 1}) → void
Moves the keyboard's day by days.
moveFocusMonths(int delta, {int months = 1}) → void
Moves the keyboard's day by delta months.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
select(DateTime day) → void
Selects day as the mode says: the day; the range's start, then its end (a day before the start starts again there); or a day toggled.
toString() → String
A string representation of this object.
inherited
turn(int delta) → void
Shows the month delta months on, the keyboard's day moving with it.
weeksOf(DateTime month, int firstWeekday) → List<List<DateTime>>
The weeks of month as the grid shows them, each seven days, starting on firstWeekday (DateTime.monday … DateTime.sunday).

Operators

operator ==(Object other) → bool
The equality operator.
inherited