New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Today style is not applied if the tile is disabled #837
Labels
bug
Something isn't working
Comments
ndevanthery
changed the title
Today stile is not applied if the tile is disabled
Today style is not applied if the tile is disabled
Dec 2, 2023
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. |
Bro, totally random but, any idea on how to implement day to day swiping? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The text was updated successfully, but these errors were encountered: