dayFormat property
Formats the text in the SfCalendar month view view header.
Defaults to EE
.
See also:
- ViewHeaderStyle, which is used to customize the view header view of the calendar.
- Knowledge base: How to format the view header day and date format
Widget build(BuildContext context) {
return Container(
child: SfCalendar(
view: CalendarView.month,
dataSource: _getCalendarDataSource(),
monthViewSettings: MonthViewSettings(
dayFormat: 'EEE',
numberOfWeeksInView: 4,
appointmentDisplayCount: 2,
appointmentDisplayMode: MonthAppointmentDisplayMode.appointment,
showAgenda: false,
navigationDirection: MonthNavigationDirection.horizontal,
monthCellStyle
: MonthCellStyle(textStyle: TextStyle(fontStyle: FontStyle.
normal, fontSize: 15, color: Colors.black),
trailingDatesTextStyle: TextStyle(
fontStyle: FontStyle.normal,
fontSize: 15,
color: Colors.black),
leadingDatesTextStyle: TextStyle(
fontStyle: FontStyle.normal,
fontSize: 15,
color: Colors.black),
backgroundColor: Colors.red,
todayBackgroundColor: Colors.blue,
leadingDatesBackgroundColor: Colors.grey,
trailingDatesBackgroundColor: Colors.grey)),
),
);
}
class DataSource extends CalendarDataSource {
DataSource(List<Appointment> source) {
appointments = source;
}
}
DataSource _getCalendarDataSource() {
List<Appointment> appointments = <Appointment>[];
appointments.add(Appointment(
startTime: DateTime.now(),
endTime: DateTime.now().add(Duration(hours: 2)),
isAllDay: true,
subject: 'Meeting',
color: Colors.blue,
startTimeZone: '',
endTimeZone: '',
));
return DataSource(appointments);
}
Implementation
final String dayFormat;