Flutter Calendar widget selectedBuilder overwrite holidayBuilder

59 Views Asked by At

I am using table_calendar as my calendar widget in my Flutter app to show rest days and working days. I am using holidayBuilder and selectedBuilder in my app to customize the style I want on the calendar. But currently, the selectedBuilder seems to overwrite the holidayBuilder which I am expecting to be able to see both holidayBuilder style and selectedBuilder style when I select a rest day in the calendar. Can anyone help with how to achieve this?

The following is my sample code:

holidayBuilder:

holidayBuilder: (context, day, focusedDay) {
  if (_eventList
            .value[DateUtils.dateOnly(
                day)]![0]
            .daytype !=
        csWorkDay) {
      return Container(
          decoration: BoxDecoration(
              color: const Color(
                  0xFFEEF0FF),
              borderRadius:
                  BorderRadius.circular(
                      10)),
          child: Center(
              child: Text('${day.day}',
                  style:
                      const TextStyle(
                          color: Colors
                              .grey))));
    }
  };
}

selectedBuilder:

selectedBuilder: (context, day, focusedDay) {
  return Container(
      decoration: BoxDecoration(
          color: Colors.transparent,
          border: Border.all(
              color: Colors.blue),
          borderRadius:
              BorderRadius.circular(
                  10)),
      child: Center(
          child: Text('${day.day}',
              style: const TextStyle(
                  color:
                      Colors.grey))));
}
0

There are 0 best solutions below