aleksanderwozniak / table_calendar

Highly customizable, feature-packed calendar widget for Flutter
Apache License 2.0
1.77k stars 974 forks source link

Today style is not applied if the tile is disabled #837

Closed ndevanthery closed 1 month ago

ndevanthery commented 7 months ago

Describe the bug When you have a date that is disabled, the disabled style goes before everything. Which is not wanted if you want to have a specific style for today, or for holidays.

To reproduce

Code sample ` class BugExample extends StatefulWidget { const BugExample({Key? key}) : super(key: key); @override State createState() => _BugExampleState(); } class _BugExampleState extends State { DateTime? selected; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(automaticallyImplyLeading: true), body: TableCalendar( startingDayOfWeek: StartingDayOfWeek.monday, availableCalendarFormats: {CalendarFormat.month: "Months"}, firstDay: DateTime.now(), lastDay: DateTime.now().add(const Duration(days: 40)), focusedDay: selected ?? DateTime.now(), enabledDayPredicate: (day) => false, selectedDayPredicate: (day) { return isSameDay(day, selected); }, holidayPredicate: (day) => isSameDay(day, DateTime.now().add(Duration(days: 2))), onDaySelected: (selectedDay, focusedDay) { setState(() { selected = selectedDay; }); }, headerStyle: const HeaderStyle( titleCentered: true, leftChevronIcon: Icon( Icons.chevron_left, color: Colors.white, ), rightChevronIcon: Icon( Icons.chevron_right, color: Colors.white, ), ), calendarStyle: const CalendarStyle( isTodayHighlighted: true, selectedDecoration: BoxDecoration(shape: BoxShape.circle, color: Colors.yellow), todayDecoration: BoxDecoration(shape: BoxShape.circle, color: Colors.green), todayTextStyle: TextStyle(color: Colors.red)), ), ); } } `

Expected behavior The disabled style should be last to be applied.

aleksanderwozniak commented 3 months ago

I would say that's the expected behavior. If you explicitly disable a given day, then I would expect it to look and behave differently.

If you disable gestures for it, but keep the look of other specific styles, then user might wonder why tapping on this day does nothing, since there are no visual indicators to distinguish it from other days.

Somtobro commented 2 months ago

Bro, totally random but, any idea on how to implement day to day swiping?