TableCalendar<T> constructor
- {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.
Implementation
TableCalendar({
Key? key,
required DateTime focusedDay,
required DateTime firstDay,
required DateTime lastDay,
DateTime? currentDay,
this.locale,
this.rangeStartDay,
this.rangeEndDay,
this.weekendDays = const [DateTime.saturday, DateTime.sunday],
this.calendarFormat = CalendarFormat.month,
this.availableCalendarFormats = const {
CalendarFormat.month: 'Month',
CalendarFormat.twoWeeks: '2 weeks',
CalendarFormat.week: 'Week',
},
this.headerVisible = true,
this.daysOfWeekVisible = true,
this.pageJumpingEnabled = false,
this.pageAnimationEnabled = true,
this.sixWeekMonthsEnforced = false,
this.shouldFillViewport = false,
this.weekNumbersVisible = false,
this.rowHeight = 52.0,
this.daysOfWeekHeight = 16.0,
this.formatAnimationDuration = const Duration(milliseconds: 200),
this.formatAnimationCurve = Curves.linear,
this.pageAnimationDuration = const Duration(milliseconds: 300),
this.pageAnimationCurve = Curves.easeOut,
this.startingDayOfWeek = StartingDayOfWeek.sunday,
this.dayHitTestBehavior = HitTestBehavior.opaque,
this.availableGestures = AvailableGestures.all,
this.simpleSwipeConfig = const SimpleSwipeConfig(
verticalThreshold: 25.0,
swipeDetectionBehavior: SwipeDetectionBehavior.continuousDistinct,
),
this.headerStyle = const HeaderStyle(),
this.daysOfWeekStyle = const DaysOfWeekStyle(),
this.calendarStyle = const CalendarStyle(),
this.calendarBuilders = const CalendarBuilders(),
this.rangeSelectionMode = RangeSelectionMode.toggledOff,
this.eventLoader,
this.enabledDayPredicate,
this.selectedDayPredicate,
this.holidayPredicate,
this.onRangeSelected,
this.onDaySelected,
this.onDayLongPressed,
this.onDisabledDayTapped,
this.onDisabledDayLongPressed,
this.onHeaderTapped,
this.onHeaderLongPressed,
this.onPageChanged,
this.onFormatChanged,
this.onCalendarCreated,
}) : assert(availableCalendarFormats.keys.contains(calendarFormat)),
assert(availableCalendarFormats.length <= CalendarFormat.values.length),
assert(weekendDays.isNotEmpty
? weekendDays.every(
(day) => day >= DateTime.monday && day <= DateTime.sunday)
: true),
focusedDay = normalizeDate(focusedDay),
firstDay = normalizeDate(firstDay),
lastDay = normalizeDate(lastDay),
currentDay = currentDay ?? DateTime.now(),
super(key: key);