Skip to content
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

Open
ndevanthery opened this issue Dec 1, 2023 · 2 comments
Open

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

ndevanthery opened this issue Dec 1, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@ndevanthery
Copy link

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.

@ndevanthery ndevanthery added the bug Something isn't working label Dec 1, 2023
@ndevanthery 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
@aleksanderwozniak
Copy link
Owner

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
Copy link

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
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants