weeks property
List<List<CalendarDayData> >
get
weeks
Implementation
List<List<CalendarDayData>> get weeks {
final res = <List<CalendarDayData>>[];
var firstDayMonth = DateTime(year, month, 1);
var firstDayOfWeek = firstDayMonth.subtract(Duration(days: firstDayOffset));
for (var w = 0; w < weeksCount; w++) {
final week = List<CalendarDayData>.generate(
7,
(index) {
final date = firstDayOfWeek.add(Duration(days: index));
final isActiveMonth = date.year == year && date.month == month;
return CalendarDayData(
date: date,
isActiveMonth: isActiveMonth,
isActiveDate: date.isToday,
);
},
);
res.add(week);
firstDayOfWeek = firstDayOfWeek.add(const Duration(days: 7));
}
return res;
}