handleLoadMore method
Called when loadMoreAppointments function is called from the
loadMoreWidgetBuilder.
Call the notifyListeners
to notify the calendar for data source changes.
See also:
SfCalendar.loadMoreWidgetBuilder
, which used to set custom widget, which will be displayed when the appointment is loading on view.notifyListeners
, to add, remove or reset the appointment and resource collection.- Knowledge base: How to load appointments on demand
@override
Future<void> handleLoadMore(DateTime startDate, DateTime endDate) async {
await Future.delayed(Duration(seconds: 5));
List<Appointment> newColl = <Appointment>[];
for (DateTime date = startDate;
date.isBefore(endDate);
date = date.add(Duration(days: 1))) {
newColl.add(Appointment(
startTime: date,
endTime: date.add(Duration(hours: 2)),
subject: 'Meeting',
color: Colors.red,
));
}
appointments!.addAll(newColl);
notifyListeners(CalendarDataSourceAction.add, newColl);
}
Implementation
@protected
Future<void> handleLoadMore(DateTime startDate, DateTime endDate) async {}