limitCalendar method

void limitCalendar({
  1. required int number,
})

Implementation

void limitCalendar({required int number}) {
  int currentYearIndex = findIndex(list: widget.years, target: yearValue);
  int currentMonthIndex =
      findIndex(list: widget.monthLabelList, target: monthValue);
  if (number == -1) {
    if ((currentYearIndex != widget.years.length - 1) ||
        (currentMonthIndex != 0)) {
      controlCalendar(number: number);
    }
  } else if (number == 1) {
    if ((currentYearIndex != 0) ||
        (currentMonthIndex != widget.monthLabelList.length - 1)) {
      controlCalendar(number: number);
    }
  }
}