TableCalendar<T> class

Highly customizable, feature-packed Flutter calendar with gestures, animations and multiple formats.

Inheritance

Constructors

TableCalendar({Key? key, required DateTime focusedDay, required DateTime firstDay, required DateTime lastDay, DateTime? currentDay, dynamic locale, DateTime? rangeStartDay, DateTime? rangeEndDay, List<int> weekendDays = const [DateTime.saturday, DateTime.sunday], CalendarFormat calendarFormat = CalendarFormat.month, Map<CalendarFormat, String> availableCalendarFormats = const {CalendarFormat.month : 'Month', CalendarFormat.twoWeeks : '2 weeks', CalendarFormat.week : 'Week'}, bool headerVisible = true, bool daysOfWeekVisible = true, bool pageJumpingEnabled = false, bool pageAnimationEnabled = true, bool sixWeekMonthsEnforced = false, bool shouldFillViewport = false, bool weekNumbersVisible = false, double rowHeight = 52.0, double daysOfWeekHeight = 16.0, Duration formatAnimationDuration = const Duration(milliseconds: 200), Curve formatAnimationCurve = Curves.linear, Duration pageAnimationDuration = const Duration(milliseconds: 300), Curve pageAnimationCurve = Curves.easeOut, StartingDayOfWeek startingDayOfWeek = StartingDayOfWeek.sunday, HitTestBehavior dayHitTestBehavior = HitTestBehavior.opaque, AvailableGestures availableGestures = AvailableGestures.all, SimpleSwipeConfig simpleSwipeConfig = const SimpleSwipeConfig(verticalThreshold: 25.0, swipeDetectionBehavior: SwipeDetectionBehavior.continuousDistinct), HeaderStyle headerStyle = const HeaderStyle(), DaysOfWeekStyle daysOfWeekStyle = const DaysOfWeekStyle(), CalendarStyle calendarStyle = const CalendarStyle(), CalendarBuilders<T> calendarBuilders = const CalendarBuilders(), RangeSelectionMode rangeSelectionMode = RangeSelectionMode.toggledOff, List<T> eventLoader(DateTime day)?, bool enabledDayPredicate(DateTime day)?, bool selectedDayPredicate(DateTime day)?, bool holidayPredicate(DateTime day)?, OnRangeSelected? onRangeSelected, OnDaySelected? onDaySelected, OnDaySelected? onDayLongPressed, void onDisabledDayTapped(DateTime day)?, void onDisabledDayLongPressed(DateTime day)?, void onHeaderTapped(DateTime focusedDay)?, void onHeaderLongPressed(DateTime focusedDay)?, void onPageChanged(DateTime focusedDay)?, void onFormatChanged(CalendarFormat format)?, void onCalendarCreated(PageController pageController)?})
Creates a TableCalendar widget.

Properties

availableCalendarFormats Map<CalendarFormat, String>
Map of CalendarFormats and String names associated with them. Those CalendarFormats will be used by internal logic to manage displayed format.
final
availableGestures AvailableGestures
Specifies swipe gestures available to TableCalendar. If AvailableGestures.none is used, the calendar will only be interactive via buttons.
final
calendarBuilders CalendarBuilders<T>
Set of custom builders for TableCalendar to work with. Use those to fully tailor the UI.
final
calendarFormat CalendarFormat
Specifies TableCalendar's current format.
final
calendarStyle CalendarStyle
Style for TableCalendar's content.
final
currentDay DateTime?
DateTime that will be treated as today. Defaults to DateTime.now().
final
dayHitTestBehavior HitTestBehavior
HitTestBehavior for every day cell inside TableCalendar.
final
daysOfWeekHeight double
Used for setting the height of TableCalendar's days of week row.
final
daysOfWeekStyle DaysOfWeekStyle
Style for days of week displayed between TableCalendar's header and content.
final
daysOfWeekVisible bool
Determines the visibility of the row of days of the week.
final
enabledDayPredicate → (bool Function(DateTime day)?)
Function deciding whether given day should be enabled or not. If false is returned, this day will be disabled.
final
eventLoader → (List<T> Function(DateTime day)?)
Function that assigns a list of events to a specified day.
final
firstDay DateTime
The first active day of TableCalendar. Blocks swiping to days before it.
final
focusedDay DateTime
DateTime that determines which days are currently visible and focused.
final
formatAnimationCurve Curve
Specifies the curve of size animation that takes place whenever calendarFormat is changed.
final
formatAnimationDuration Duration
Specifies the duration of size animation that takes place whenever calendarFormat is changed.
final
hashCode int
The hash code for this object.
no setterinherited
headerStyle HeaderStyle
Style for TableCalendar's header.
final
headerVisible bool
Determines the visibility of calendar header.
final
holidayPredicate → (bool Function(DateTime day)?)
Function deciding whether given day is treated as a holiday.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
lastDay DateTime
The last active day of TableCalendar. Blocks swiping to days after it.
final
locale → dynamic
Locale to format TableCalendar dates with, for example: 'en_US'.
final
onCalendarCreated → (void Function(PageController pageController)?)
Called when the calendar is created. Exposes its PageController.
final
onDayLongPressed OnDaySelected?
Called whenever any day gets long pressed.
final
onDaySelected OnDaySelected?
Called whenever any day gets tapped.
final
onDisabledDayLongPressed → (void Function(DateTime day)?)
Called whenever any disabled day gets long pressed.
final
onDisabledDayTapped → (void Function(DateTime day)?)
Called whenever any disabled day gets tapped.
final
onFormatChanged → (void Function(CalendarFormat format)?)
Called whenever calendarFormat is changed.
final
onHeaderLongPressed → (void Function(DateTime focusedDay)?)
Called whenever header gets long pressed.
final
onHeaderTapped → (void Function(DateTime focusedDay)?)
Called whenever header gets tapped.
final
onPageChanged → (void Function(DateTime focusedDay)?)
Called whenever currently visible calendar page is changed.
final
onRangeSelected OnRangeSelected?
Called whenever a day range gets selected.
final
pageAnimationCurve Curve
Specifies the curve of scrolling animation that takes place whenever the visible calendar page is changed.
final
pageAnimationDuration Duration
Specifies the duration of scrolling animation that takes place whenever the visible calendar page is changed.
final
pageAnimationEnabled bool
When set to true, updating the focusedDay will display a scrolling animation if the currently visible calendar page is changed.
final
pageJumpingEnabled bool
When set to true, tapping on an outside day in CalendarFormat.month format will jump to the calendar page of the tapped month.
final
rangeEndDay DateTime?
The end of the selected day range.
final
rangeSelectionMode RangeSelectionMode
Current mode of range selection.
final
rangeStartDay DateTime?
The start of the selected day range.
final
rowHeight double
Used for setting the height of TableCalendar's rows.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedDayPredicate → (bool Function(DateTime day)?)
Function deciding whether given day should be marked as selected.
final
shouldFillViewport bool
When set to true, TableCalendar will fill available height.
final
simpleSwipeConfig → SimpleSwipeConfig
Configuration for vertical swipe detector.
final
sixWeekMonthsEnforced bool
When set to true, CalendarFormat.month will always display six weeks, even if the content would fit in less.
final
startingDayOfWeek StartingDayOfWeek
TableCalendar will start weeks with provided day.
final
weekendDays List<int>
List of days treated as weekend days. Use built-in DateTime weekday constants (e.g. DateTime.monday) instead of int literals (e.g. 1).
final
weekNumbersVisible bool
Whether to display week numbers on calendar.
final

Methods

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