JonasWanke/timetable

Display WeekdayIndicatorStyle only for current month

Opened this issue · 2 comments

How to apply style to WeekdayIndicatorStyle so that style is applied only to current month and not previous/next months?

Expecting style for WeekdayIndicator to display differently only for current month (August) and not other months)
image

But style for weekday is applied to all months not only current month:
image

That's not possible using only the style provider. You can, however, override MonthWidget's weekDayBuilder and return a WeekdayIndicator with any style you want (not tested):

MonthWidget(
  month,
  // This is always called with days in the current week. By adding a week
  // when we're not showing the current month, the current week day is not
  // highlighted.
  weekDayBuilder: (context, weekDay) => WeekdayIndicator(
    month == DateTimeTimetable.currentMonth()
        ? weekDay
        : weekDay + DateTime.daysPerWeek.days,
  ),
)

@JonasWanke Thank you this worked great!