FCalendar constructor

FCalendar({
  1. required FCalendarController controller,
  2. FCalendarStyle style(
    1. FCalendarStyle style
    )?,
  3. ValueWidgetBuilder<FCalendarDayData> dayBuilder = defaultDayBuilder,
  4. ValueChanged<DateTime>? onMonthChange,
  5. ValueChanged<DateTime>? onPress,
  6. ValueChanged<DateTime>? onLongPress,
  7. FCalendarPickerType initialType = FCalendarPickerType.day,
  8. DateTime? start,
  9. DateTime? end,
  10. DateTime? today,
  11. DateTime? initialMonth,
  12. Key? key,
})

Creates a FCalendar.

Subsequently changing initialType has no effect.

initialMonth defaults to today. It is truncated to the nearest date. Subsequently changing initialMonth has no effect. To change the selected date, change the key to create a new FCalendar, and provide that widget the new initialMonth. This will reset the widget's interactive state.

Implementation

FCalendar({
  required this.controller,
  this.style,
  this.dayBuilder = defaultDayBuilder,
  this.onMonthChange,
  this.onPress,
  this.onLongPress,
  FCalendarPickerType initialType = FCalendarPickerType.day,
  DateTime? start,
  DateTime? end,
  DateTime? today,
  DateTime? initialMonth,
  super.key,
}) : start = start ?? DateTime(1900),
     end = end ?? DateTime(2100),
     today = today ?? DateTime.now(),
     _initialType = initialType,
     _initialMonth = (initialMonth ?? today ?? DateTime.now()).toLocalDate().truncate(to: DateUnit.months) {
  assert(this.start.toLocalDate() < this.end.toLocalDate(), 'start ($start) must be < end ($end)');
}