setLeftIndex method

void setLeftIndex(
  1. int index
)

Implementation

void setLeftIndex(int index) {
  int destYear = index + minTime.year;
  int minMonth = _minMonthOfCurrentYear();
  DateTime newTime;
  if (currentTime.month == 2 && currentTime.day == 29) {
    newTime = currentTime.isUtc
        ? DateTime.utc(
            destYear, currentTime.month, calcDateCount(destYear, 2))
        : DateTime(destYear, currentTime.month, calcDateCount(destYear, 2));
  } else {
    newTime = currentTime.isUtc
        ? DateTime.utc(destYear, currentTime.month, currentTime.day)
        : DateTime(destYear, currentTime.month, currentTime.day);
  }
  //min/max check
  if (newTime.isAfter(maxTime)) {
    currentTime = maxTime;
  } else if (newTime.isBefore(minTime)) {
    currentTime = minTime;
  } else {
    currentTime = newTime;
  }

  _fillMiddleLists();
  _fillRightLists();
  minMonth = _minMonthOfCurrentYear();
  int minDay = _minDayOfCurrentMonth();
  _currentIndex[1] = currentTime.month - minMonth;
  _currentIndex[2] = currentTime.day - minDay;
}