initial method

void initial(
  1. BuildContext context,
  2. DateTime firstDate,
  3. DateTime? endDate
)

Implementation

void initial(BuildContext context, DateTime firstDate, DateTime? endDate) {
  this.firstDate = firstDate;
  this.lastDate = endDate;
  if (isMultiple) {
    // ignore: unnecessary_null_comparison
    if(_selectedDates == null){
      _selectedDates = SplayTreeSet();
    }
  } else {
    // ignore: unnecessary_null_comparison
    if(_selectedDates == null){
      _selectedDates = SplayTreeSet.of([
        DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day)
      ]);
    }
  }
  displayedMonthDate = selectedDate ?? DateTime.now();
  final int monthPage =
      RCalendarUtils.monthDelta(firstDate, displayedMonthDate!);
  monthController = PageController(initialPage: monthPage);
  _localizations = DefaultMaterialLocalizations();

  final int weekPage = RCalendarUtils.weekDelta(
      firstDate, displayedMonthDate!, _localizations);
  weekController = PageController(initialPage: weekPage);
//    controller.addListener(() {
//      displayMonth = _addMonthsToMonthDate(firstDate, controller.page ~/ 1);
//      notifyListeners();
//    });
}