Skip to content

Commit

Permalink
✨ Mark Today date in TableCalendar (#107)
Browse files Browse the repository at this point in the history
The current date is now marked in calendar

Co-authored-by: Felix <[email protected]>
  • Loading branch information
Mindmax-dev and strifel authored Aug 18, 2020
1 parent a7d7610 commit b25fc24
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/Views/Calendar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ class _TableCalendarState extends State<_TableCalendar> with TickerProviderState
if (_selectedEvents.length == 1) {
Navigator.push(context,
MaterialPageRoute(builder: (context) => CalendarDetail(_selectedEvents[0])));
} else {
} else if (_selectedEvents.length > 1) {
_showEventListModal();
}
});
Expand Down Expand Up @@ -503,9 +503,6 @@ class _TableCalendarState extends State<_TableCalendar> with TickerProviderState
dayBuilder: (context, date, list) {
return _buildDay(date, list);
},
selectedDayBuilder: (context, date, list) {
return _buildDay(date, list, selected: true);
},
markersBuilder: (context, date, hlist, dlist) {
return [new Container(), new Container()];
},
Expand All @@ -528,16 +525,19 @@ class _TableCalendarState extends State<_TableCalendar> with TickerProviderState
);
}


Widget _buildDay(date, events, {today=false, selected=false}) {
Widget _buildDay(date, events, {today=false}) {
return Container(
margin: const EdgeInsets.all(4.0),
padding: const EdgeInsets.only(top: 5.0, left: 6.0),
child: Column(
children: [
Container(
padding: const EdgeInsets.all(3.0),
decoration: today ? new BoxDecoration(borderRadius: new BorderRadius.circular(16.0), color: Theme.of(context).accentColor) : null,
child:
Text(
'${date.day}',
style: (today ? TextStyle().copyWith(fontSize: 16.0, color: Colors.red) : TextStyle().copyWith(fontSize: 16.0))
style: TextStyle().copyWith(fontSize: 16.0)),
),
_buildEventsList(events)
],
Expand Down

0 comments on commit b25fc24

Please sign in to comment.