diff --git a/lib/classes/multiple_marked_dates.dart b/lib/classes/multiple_marked_dates.dart index 70994aa..3984d11 100644 --- a/lib/classes/multiple_marked_dates.dart +++ b/lib/classes/multiple_marked_dates.dart @@ -11,6 +11,49 @@ class MultipleMarkedDates{ markedDates.add(markedDate); } + 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; + } + } + } + + void addAll(List markedDates){ this.markedDates.addAll(markedDates); }