TableCalendar<T> constructor

TableCalendar<T>(
  1. {Key? key,
  2. required DateTime focusedDay,
  3. required DateTime firstDay,
  4. required DateTime lastDay,
  5. DateTime? currentDay,
  6. dynamic locale,
  7. DateTime? rangeStartDay,
  8. DateTime? rangeEndDay,
  9. List<int> weekendDays = const [DateTime.saturday, DateTime.sunday],
  10. CalendarFormat calendarFormat = CalendarFormat.month,
  11. Map<CalendarFormat, String> availableCalendarFormats = const {CalendarFormat.month : 'Month', CalendarFormat.twoWeeks : '2 weeks', CalendarFormat.week : 'Week'},
  12. bool headerVisible = true,
  13. bool daysOfWeekVisible = true,
  14. bool pageJumpingEnabled = false,
  15. bool pageAnimationEnabled = true,
  16. bool sixWeekMonthsEnforced = false,
  17. bool shouldFillViewport = false,
  18. bool weekNumbersVisible = false,
  19. double rowHeight = 52.0,
  20. double daysOfWeekHeight = 16.0,
  21. Duration formatAnimationDuration = const Duration(milliseconds: 200),
  22. Curve formatAnimationCurve = Curves.linear,
  23. Duration pageAnimationDuration = const Duration(milliseconds: 300),
  24. Curve pageAnimationCurve = Curves.easeOut,
  25. StartingDayOfWeek startingDayOfWeek = StartingDayOfWeek.sunday,
  26. HitTestBehavior dayHitTestBehavior = HitTestBehavior.opaque,
  27. AvailableGestures availableGestures = AvailableGestures.all,
  28. SimpleSwipeConfig simpleSwipeConfig = const SimpleSwipeConfig(verticalThreshold: 25.0, swipeDetectionBehavior: SwipeDetectionBehavior.continuousDistinct),
  29. HeaderStyle headerStyle = const HeaderStyle(),
  30. DaysOfWeekStyle daysOfWeekStyle = const DaysOfWeekStyle(),
  31. CalendarStyle calendarStyle = const CalendarStyle(),
  32. CalendarBuilders<T> calendarBuilders = const CalendarBuilders(),
  33. RangeSelectionMode rangeSelectionMode = RangeSelectionMode.toggledOff,
  34. List<T> eventLoader(
    1. DateTime day
    )?,
  35. bool enabledDayPredicate(
    1. DateTime day
    )?,
  36. bool selectedDayPredicate(
    1. DateTime day
    )?,
  37. bool holidayPredicate(
    1. DateTime day
    )?,
  38. OnRangeSelected? onRangeSelected,
  39. OnDaySelected? onDaySelected,
  40. OnDaySelected? onDayLongPressed,
  41. void onDisabledDayTapped(
    1. DateTime day
    )?,
  42. void onDisabledDayLongPressed(
    1. DateTime day
    )?,
  43. void onHeaderTapped(
    1. DateTime focusedDay
    )?,
  44. void onHeaderLongPressed(
    1. DateTime focusedDay
    )?,
  45. void onPageChanged(
    1. DateTime focusedDay
    )?,
  46. void onFormatChanged(
    1. CalendarFormat format
    )?,
  47. void onCalendarCreated(
    1. 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);