I am using TableCalendar for showing all data and i am using customWidget for each date.
its showing my customwidget to all dates except current date. i mean to today’s date.
what should i change to my code to show my customwidget for today also.
class CalendarWidget extends StatelessWidget {
final int month;
final int year;
CalendarWidget({Key? key,required this.month,required this.year}) : super(key: key);
@override
Widget build(BuildContext context) {
return TableCalendar(
headerVisible: false,
availableGestures: AvailableGestures.none,
focusedDay: DateTime(year,month,1),
firstDay: DateTime(year,month,1),
lastDay: DateTime(year,month + 1, 0), // This will return last day of current month
startingDayOfWeek: StartingDayOfWeek.monday,
//availableGestures: AvailableGestures.none,
daysOfWeekHeight: 30,
rowHeight: 80,
calendarBuilders: CalendarBuilders(
defaultBuilder: (context, day, focusedDay) {
return CustomWidget();// this is not showing on current date
},
),
);
}
}
2
Answers
You can use todayBuilder
Use for current day
todayBuilder
, like this: