color property
The color that fills the background of the Appointment view in SfCalendar.
Defaults to Colors.lightBlue
.
See also:
- CalendarDataSource.getColor, which maps the custom business objects corresponding property to this property.
- SfCalendar.appointmentTextStyle, to customize the appointment text, when the builder not added.
- SfCalendar.appointmentBuilder, to set custom widget for the appointment view in the calendar
- Knowledge base: How to style appointments
Widget build(BuildContext context) {
return Container(
child: SfCalendar(
view: CalendarView.day,
dataSource: _getCalendarDataSource(),
),
);
}
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
Color color;