daysMaker method
Implementation
List<Widget> daysMaker(BuildContext context) {
int currentMonth = CalendarUtils.getPartByInt(format: PartFormat.MONTH);
int currentYear = CalendarUtils.getPartByInt(format: PartFormat.YEAR);
final headersStyle = HeaderOptions.of(context);
List<Widget> days = [
SizedBox(
width: DayOptions.of(context).compactMode
? 40
: headersStyle.weekDayStringType == WeekDayStringTypes.FULL
? 80
: 60)
];
int day = dayIndex;
CalendarUtils.getDays(headersStyle.weekDayStringType, currentMonth)
.forEach((index, weekDay) {
var selected = index == day;
bool isBeforeToday =
CalendarUtils.isBeforeThanToday(currentYear, currentMonth, index);
bool isAfterToday =
CalendarUtils.isAfterToday(currentYear, currentMonth, index);
bool isToday = CalendarUtils.isToday(currentYear, currentMonth, index);
days.add(Day(
day: index,
isToday: isToday,
dayStyle: DayStyle(
compactMode: DayOptions.of(context).compactMode,
enabled: (DayOptions.of(context).disableDaysBeforeNow
? !isBeforeToday
: DayOptions.of(context).disableDaysAfterNow
? !isAfterToday
: true),
selected: selected,
useUnselectedEffect: false,
useDisabledEffect: DayOptions.of(context).disableDaysBeforeNow
? isBeforeToday
: DayOptions.of(context).disableDaysAfterNow
? isAfterToday
: false,
),
weekDay: weekDay,
onCalendarChanged: () {
CalendarUtils.goToDay(index);
onCalendarChanged?.call();
},
));
});
days.add(
SizedBox(
width: DayOptions.of(context).compactMode
? 40
: headersStyle.weekDayStringType == WeekDayStringTypes.FULL
? 80
: 60,
),
);
return days;
}