VisibleDateRange.weekAligned constructor
VisibleDateRange.weekAligned(})
A visible range that shows visibleDayCount consecutive days, aligned to
firstDay.
When set, swiping is limited from minDate to maxDate so that both can
still be seen.
Implementation
factory VisibleDateRange.weekAligned(
int visibleDayCount, {
int firstDay = DateTime.monday,
DateTime? minDate,
DateTime? maxDate,
}) {
return VisibleDateRange.days(
visibleDayCount,
swipeRange: DateTime.daysPerWeek,
// This just has to be any date fitting `firstDay`. The addition results
// in a correct value because 2021-01-03 was a Sunday and
// `DateTime.monday = 1`.
alignmentDate: DateTimeTimetable.date(2021, 1, 3) + firstDay.days,
minDate: minDate,
maxDate: maxDate,
);
}