dataSource property
Used to set the Appointment or custom event collection through the CalendarDataSource class.
If it is not null
the collection of appointments set to the
CalendarDataSource.appointments property will be set to SfCalendar and
rendered on view.
Defaults to null.
see also:
- CalendarDataSource, to add and handle the appointments and resource on the calendar.
- Appointment, the object which holds the details of the appointment.
- CalendarResource, the object which holds the details of the resource in the calendar.
- loadMoreWidgetBuilder, allows to build an widget which will display when appointments loaded on demand in the calendar.
- resourceViewHeaderBuilder, to set custom widget for the resource view in the calendar.
- resourceViewSettings, to customize the resource view in the calendar.
- appointmentBuilder, to set custom widget for the appointment view in the calendar.
- appointmentTextStyle, to customize the text style for the appointments in calendar.
- appointmentTimeTextFormat, to customize the time format for the appointment view in calendar.
- Knowledge base: How to perform the crud operations using firestore database
- Knowledge base: How to load appointments on demand
- Knowledge base: How to load google calendar events in iOS
- Knowledge base: How to get the appointments between the given start and end date
- Knowledge base: How to get the current month appointments
- Knowledge base: How to load data from offline sqlite database
- Knowledge base: How to create time table
- Knowledge base: How to add google calendar events
- Knowledge base: How to add a custom appointments of business objects
- Knowledge base: How to delete an appointment
Widget build(BuildContext context) {
return Container(
child: SfCalendar(
view: CalendarView.week,
dataSource: _getCalendarDataSource(),
timeSlotViewSettings: TimeSlotViewSettings(
timeTextStyle: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: Colors.blue,
fontStyle: FontStyle.italic)
),
),
);
}
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 CalendarDataSource? dataSource;