initializeMonth method

void initializeMonth(
  1. DateTime selectedMonth,
  2. Day startDay,
  3. List<MarkedDaysModel>? customList,
  4. bool isRange, {
  5. void onUserPicked(
    1. List<DateTime>
    )?,
})

Initializes the month and other settings for the calendar.

Takes the selected month, start day, a list of custom marked dates, and a flag for range selection. Also, an optional callback is provided to handle user-picked dates.

Implementation

void initializeMonth(
  DateTime selectedMonth,
  Day startDay,
  List<MarkedDaysModel>? customList,
  bool isRange, {
  void Function(List<DateTime>)? onUserPicked,
}) {
  _selectedMonth = selectedMonth;
  final firstDay = DateTime(selectedMonth.year, selectedMonth.month, 1);
  startedDay = startDay;
  _startOffset = (firstDay.weekday % 7);
  _totalDays = DateUtils.getDaysInMonth(
    selectedMonth.year,
    selectedMonth.month,
  );
  isRangeSelection = isRange;
  _onUserPickedCallback = onUserPicked;
  selectedDaysList = customList ?? [];
  _userPicked = null;
  notifyListeners();
}