SfCalendar constructor
SfCalendar({
- Key? key,
- CalendarView view = CalendarView.day,
- int firstDayOfWeek = 7,
- double headerHeight = 40,
- double viewHeaderHeight = -1,
- Color? todayHighlightColor,
- TextStyle? todayTextStyle,
- Color? cellBorderColor,
- Color? backgroundColor,
- CalendarDataSource<
Object?> ? dataSource, - String? timeZone,
- Decoration? selectionDecoration,
- ViewChangedCallback? onViewChanged,
- CalendarTapCallback? onTap,
- CalendarLongPressCallback? onLongPress,
- CalendarSelectionChangedCallback? onSelectionChanged,
- CalendarController? controller,
- String? appointmentTimeTextFormat,
- List<
DateTime> ? blackoutDates, - ScheduleViewMonthHeaderBuilder? scheduleViewMonthHeaderBuilder,
- MonthCellBuilder? monthCellBuilder,
- CalendarAppointmentBuilder? appointmentBuilder,
- TimeRegionBuilder? timeRegionBuilder,
- String? headerDateFormat,
- CalendarHeaderStyle headerStyle = const CalendarHeaderStyle(),
- ViewHeaderStyle viewHeaderStyle = const ViewHeaderStyle(),
- TimeSlotViewSettings timeSlotViewSettings = const TimeSlotViewSettings(),
- ResourceViewSettings resourceViewSettings = const ResourceViewSettings(),
- MonthViewSettings monthViewSettings = const MonthViewSettings(),
- DateTime? initialDisplayDate,
- DateTime? initialSelectedDate,
- ScheduleViewSettings scheduleViewSettings = const ScheduleViewSettings(),
- DateTime? minDate,
- DateTime? maxDate,
- TextStyle appointmentTextStyle = const TextStyle(color: Colors.white, fontSize: -1, fontWeight: FontWeight.w500),
- bool showDatePickerButton = false,
- bool showTodayButton = false,
- bool showCurrentTimeIndicator = true,
- double cellEndPadding = -1,
- List<
CalendarView> ? allowedViews, - List<
TimeRegion> ? specialRegions, - LoadMoreWidgetBuilder? loadMoreWidgetBuilder,
- TextStyle? blackoutDatesTextStyle,
- bool showWeekNumber = false,
- WeekNumberStyle weekNumberStyle = const WeekNumberStyle(),
- ResourceViewHeaderBuilder? resourceViewHeaderBuilder,
- bool allowAppointmentResize = false,
- AppointmentResizeStartCallback? onAppointmentResizeStart,
- AppointmentResizeUpdateCallback? onAppointmentResizeUpdate,
- AppointmentResizeEndCallback? onAppointmentResizeEnd,
- bool allowDragAndDrop = false,
- DragAndDropSettings dragAndDropSettings = const DragAndDropSettings(),
- AppointmentDragStartCallback? onDragStart,
- AppointmentDragUpdateCallback? onDragUpdate,
- AppointmentDragEndCallback? onDragEnd,
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: -1, fontWeight: FontWeight.w500),
this.showNavigationArrow = false,
this.showDatePickerButton = false,
this.showTodayButton = false,
this.allowViewNavigation = false,
this.showCurrentTimeIndicator = true,
this.cellEndPadding = -1,
this.viewNavigationMode = ViewNavigationMode.snap,
this.allowedViews,
this.specialRegions,
this.loadMoreWidgetBuilder,
this.blackoutDatesTextStyle,
this.showWeekNumber = false,
this.weekNumberStyle = const WeekNumberStyle(),
this.resourceViewHeaderBuilder,
this.allowAppointmentResize = false,
this.onAppointmentResizeStart,
this.onAppointmentResizeUpdate,
this.onAppointmentResizeEnd,
this.allowDragAndDrop = false,
this.dragAndDropSettings = const DragAndDropSettings(),
this.onDragStart,
this.onDragUpdate,
this.onDragEnd,
}) : assert(firstDayOfWeek >= 1 && firstDayOfWeek <= 7),
assert(headerHeight >= 0),
assert(viewHeaderHeight >= -1),
assert(minDate == null || maxDate == null || minDate.isBefore(maxDate)),
assert(minDate == null || maxDate == null || maxDate.isAfter(minDate)),
assert(cellEndPadding >= -1),
initialDisplayDate = initialDisplayDate ??
DateTime(DateTime.now().year, DateTime.now().month,
DateTime.now().day, 08, 45),
minDate = minDate ?? DateTime(01),
maxDate = maxDate ?? DateTime(9999, 12, 31),
super(key: key);