PrismCalendar class
A month-grid calendar with optional range and multi-day selection.
Built as a grid of real buttons rather than a gesture surface, because a calendar is unusable by keyboard or screen reader otherwise. Each day announces its full date, its selection state, and — in range mode — that it is a range start, end or middle. Days outside firstDate and lastDate are disabled rather than hidden, so the grid stays stable.
Deliberately dependency-free: no intl, so month and weekday names come from
monthNames and weekdayLabels, both of which you can override for
localisation.
PrismCalendar(
month: focusedMonth,
selected: selectedDays,
onDaySelected: (day) => setState(() => selectedDays = {day}),
onMonthChanged: (m) => setState(() => focusedMonth = m),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- PrismCalendar
Constructors
-
PrismCalendar({Key? key, required DateTime month, required Set<
DateTime> selected, required ValueChanged<DateTime> onDaySelected, ValueChanged<DateTime> ? onMonthChanged, PrismDateSelection selection = PrismDateSelection.single, DateTime? firstDate, DateTime? lastDate, DateTime? today, List<String> monthNames = defaultMonthNames, List<String> weekdayLabels = defaultWeekdayLabels, int firstWeekday = DateTime.monday, Set<DateTime> markers = const {}, String? semanticLabel}) -
Creates a calendar.
const
Properties
- firstDate → DateTime?
-
Earliest selectable day. Defaults to ten years before month.
final
- firstWeekday → int
-
Which weekday starts the week.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- lastDate → DateTime?
-
Latest selectable day. Defaults to ten years after month.
final
-
markers
→ Set<
DateTime> -
Days to draw a dot under, e.g. days with events.
final
- month → DateTime
-
The month to display. Only the year and month are significant.
final
-
monthNames
→ List<
String> -
Month names, January first. Override for localisation.
final
-
onDaySelected
→ ValueChanged<
DateTime> -
Called with the day the user chose. In range mode it is called once per
endpoint, with the running selection in selected.
final
-
onMonthChanged
→ ValueChanged<
DateTime> ? -
Called when the user navigates to another month.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
selected
→ Set<
DateTime> -
Currently selected days.
final
- selection → PrismDateSelection
-
How many days may be selected at once.
final
- semanticLabel → String?
-
Accessible name for the grid.
final
- today → DateTime?
-
Overrides what counts as "today" — useful in tests.
final
-
weekdayLabels
→ List<
String> -
Weekday column headers, in firstWeekday order.
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
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
Static Methods
Constants
-
defaultMonthNames
→ const List<
String> - English month names, used when monthNames is not supplied.
-
defaultWeekdayLabels
→ const List<
String> - Short weekday labels, Monday first.