setPreSelected method

void setPreSelected()

Implementation

void setPreSelected() {
  if (widget.isRange) {
    calendarInfo.dates.asMap().forEach((index, value) {
      List<DateInfo> preSelectedStartEndDates = calendarInfo.dates
          .where((date) =>
              date.isSelected == SelectType.start ||
              date.isSelected == SelectType.end)
          .toList();

      for (var element in preSelectedStartEndDates) {
        element.singleSelectedAniCtrl!.forward(from: 1);
      }

      if (value.isSelected == SelectType.between ||
          value.isSelected == SelectType.start ||
          value.isSelected == SelectType.end) {
        betweenControllerList[index].forward(from: 1);
      }
    });
  } else {
    List<DateInfo> preSelectedDates = calendarInfo.dates
        .where((date) => date.isSelected == SelectType.selected)
        .toList();
    for (var element in preSelectedDates) {
      element.singleSelectedAniCtrl!.forward(from: 1);
    }
  }
}