SfCalendar constructor Null safety

SfCalendar(
  1. {Key? key,
  2. CalendarView view = CalendarView.day,
  3. int firstDayOfWeek = 7,
  4. double headerHeight = 40,
  5. double viewHeaderHeight = -1,
  6. Color? todayHighlightColor,
  7. TextStyle? todayTextStyle,
  8. Color? cellBorderColor,
  9. Color? backgroundColor,
  10. CalendarDataSource? dataSource,
  11. String? timeZone,
  12. Decoration? selectionDecoration,
  13. ViewChangedCallback? onViewChanged,
  14. CalendarTapCallback? onTap,
  15. CalendarLongPressCallback? onLongPress,
  16. CalendarSelectionChangedCallback? onSelectionChanged,
  17. CalendarController? controller,
  18. String? appointmentTimeTextFormat,
  19. List<DateTime>? blackoutDates,
  20. ScheduleViewMonthHeaderBuilder? scheduleViewMonthHeaderBuilder,
  21. MonthCellBuilder? monthCellBuilder,
  22. CalendarAppointmentBuilder? appointmentBuilder,
  23. TimeRegionBuilder? timeRegionBuilder,
  24. String? headerDateFormat,
  25. CalendarHeaderStyle headerStyle = const CalendarHeaderStyle(),
  26. ViewHeaderStyle viewHeaderStyle = const ViewHeaderStyle(),
  27. TimeSlotViewSettings timeSlotViewSettings = const TimeSlotViewSettings(),
  28. ResourceViewSettings resourceViewSettings = const ResourceViewSettings(),
  29. MonthViewSettings monthViewSettings = const MonthViewSettings(),
  30. DateTime? initialDisplayDate,
  31. DateTime? initialSelectedDate,
  32. ScheduleViewSettings scheduleViewSettings = const ScheduleViewSettings(),
  33. DateTime? minDate,
  34. DateTime? maxDate,
  35. TextStyle appointmentTextStyle = const TextStyle(color: Colors.white, fontSize: 10, fontWeight: FontWeight.w500, fontFamily: 'Roboto'),
  36. bool showNavigationArrow = false,
  37. bool showDatePickerButton = false,
  38. bool allowViewNavigation = false,
  39. bool showCurrentTimeIndicator = true,
  40. double cellEndPadding = 1,
  41. ViewNavigationMode viewNavigationMode = ViewNavigationMode.snap,
  42. List<CalendarView>? allowedViews,
  43. List<TimeRegion>? specialRegions,
  44. LoadMoreWidgetBuilder? loadMoreWidgetBuilder,
  45. TextStyle? blackoutDatesTextStyle}
)

Creates a SfCalendar widget, which used to scheduling and managing events.

By default it displays CalendarView.day view with current date visible.

To navigate to different views set view property with a desired CalendarView.

Use DataSource property to set the appointments to the scheduler.

Implementation

SfCalendar({
  Key? key,
  this.view = CalendarView.day,
  this.firstDayOfWeek = 7,
  this.headerHeight = 40,
  this.viewHeaderHeight = -1,
  this.todayHighlightColor,
  this.todayTextStyle,
  this.cellBorderColor,
  this.backgroundColor,
  this.dataSource,
  this.timeZone,
  this.selectionDecoration,
  this.onViewChanged,
  this.onTap,
  this.onLongPress,
  this.onSelectionChanged,
  this.controller,
  this.appointmentTimeTextFormat,
  this.blackoutDates,
  this.scheduleViewMonthHeaderBuilder,
  this.monthCellBuilder,
  this.appointmentBuilder,
  this.timeRegionBuilder,
  this.headerDateFormat,
  this.headerStyle = const CalendarHeaderStyle(),
  this.viewHeaderStyle = const ViewHeaderStyle(),
  this.timeSlotViewSettings = const TimeSlotViewSettings(),
  this.resourceViewSettings = const ResourceViewSettings(),
  this.monthViewSettings = const MonthViewSettings(),
  DateTime? initialDisplayDate,
  this.initialSelectedDate,
  this.scheduleViewSettings = const ScheduleViewSettings(),
  DateTime? minDate,
  DateTime? maxDate,
  this.appointmentTextStyle = const TextStyle(
      color: Colors.white,
      fontSize: 10,
      fontWeight: FontWeight.w500,
      fontFamily: 'Roboto'),
  this.showNavigationArrow = false,
  this.showDatePickerButton = false,
  this.allowViewNavigation = false,
  this.showCurrentTimeIndicator = true,
  this.cellEndPadding = 1,
  this.viewNavigationMode = ViewNavigationMode.snap,
  this.allowedViews,
  this.specialRegions,
  this.loadMoreWidgetBuilder,
  this.blackoutDatesTextStyle,
})  : initialDisplayDate = initialDisplayDate ??
          DateTime(DateTime.now().year, DateTime.now().month,
              DateTime.now().day, 08, 45, 0),
      minDate = minDate ?? DateTime(01, 01, 01),
      maxDate = maxDate ?? DateTime(9999, 12, 31),
      super(key: key);