addRange method

void addRange(
  1. MarkedDate markedDate, {
  2. int plus = 0,
  3. int minus = 0,
})

Implementation

void addRange(MarkedDate markedDate, {int plus = 0, int minus = 0}) {
  this.add(markedDate);

  if (plus > 0) {
    int start = 1;
    MarkedDate newAddMarkedDate;

    while (start <= plus) {
      newAddMarkedDate = new MarkedDate(
        color: markedDate.color,
        date: markedDate.date.add(Duration(days: start)),
        textStyle: markedDate.textStyle,
      );

      this.add(newAddMarkedDate);

      start += 1;
    }
  }

  if (minus > 0) {
    int start = 1;
    MarkedDate newSubMarkedDate;

    while (start <= minus) {
      newSubMarkedDate = new MarkedDate(
        color: markedDate.color,
        date: markedDate.date.subtract(Duration(days: start)),
        textStyle: markedDate.textStyle,
      );

      this.add(newSubMarkedDate);

      start += 1;
    }
  }
}