FCalendar constructor

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

Creates a FCalendar.

initialMonth defaults to today. It is truncated to the nearest date.

Implementation

FCalendar({
  required this.controller,
  required this.start,
  required this.end,
  this.style,
  this.onMonthChange,
  this.onPress,
  this.onLongPress,
  FCalendarPickerType initialType = FCalendarPickerType.day,
  DateTime? today,
  DateTime? initialMonth,
  super.key,
})  : assert(start.toLocalDate() < end.toLocalDate(), 'end date must be greater than start date'),
      today = today ?? DateTime.now(),
      _type = ValueNotifier(initialType),
      _month = ValueNotifier((initialMonth ?? today ?? DateTime.now()).toLocalDate().truncate(to: DateUnit.months));