We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Appointments overlaps behave differently


When I open the calendar with date x for the first time it draws appointment in correct way:

but when I open the same date for the second time one appointment overlaps another:

It looks like the calendar component holds appointment data inside the component and this causes the issue because from what I see the appointments are drawn incorrectly right after opening the screen and stays incorrectly after data reload:

I can see the same behavior on week and work week views.

My code looks here:

SfCalendar _createCalendar() {
return SfCalendar(
view: widget._calendarView,
//controller: _calendarController,
firstDayOfWeek: 1,
showDatePickerButton: true,
allowViewNavigation: true,
initialDisplayDate: widget._initialDate,
dataSource: TimetableDataSource([]),
loadMoreWidgetBuilder: (context, loadMoreAppointments) {
return FutureBuilder<void>(
future: loadMoreAppointments(),
builder: (context, snapShot) {
return const LoadingIndicator();
// appointmentBuilder: (context, calendarAppointmentDetails) {
// TimetableData timetableCellData = calendarAppointmentDetails.appointments.first;
// CellStyle cellStyle = CellStyle(timetableCellData);
// if (_calendarController.view == CalendarView.day) {
// return _buildDailyLesson(timetableCellData, cellStyle, _calendarController.view!);
// }
// return _buildWeeklyLesson(timetableCellData, cellStyle, _calendarController.view!);
// },
allowedViews: const [CalendarView.day, CalendarView.workWeek, CalendarView.week, CalendarView.month],
monthViewSettings: const MonthViewSettings(showAgenda: true),
showCurrentTimeIndicator: true,
showWeekNumber: true,
timeSlotViewSettings: const TimeSlotViewSettings(
timeIntervalHeight: 50,
timeTextStyle: TextStyle(color: Colors.black, fontWeight: FontWeight.bold, fontSize: 14),
timeFormat: DateFormat.HOUR24,
startHour: 7,
endHour: 18,
nonWorkingDays: [DateTime.saturday, DateTime.sunday]),

In TimetableDataSource I override the handleLoadMore

Future<void> handleLoadMore(DateTime startDate, DateTime endDate) async {
List timetableElements = await timetableService.getTimetableElements(startDate, endDate);
for (final TimetableData timetableElement in timetableElements) {
if (appointments!.contains(timetableElement)) {
notifyListeners(CalendarDataSourceAction.add, appointments!);

Is it a bug in the component or have I implemented something incorrectly?

//EDIT My goal is to paginate data, I don't want to get a few years data and put it in the calendar but load data on view change.

Thank you in advance for help.


3 Replies 1 reply marked as answer

MS Muniappan Subramanian Syncfusion Team January 6, 2023 12:53 PM UTC


As per the instruction we have followed to check the reported issue and we are unable to replicate the issue from our end. We have checked the scenarios of loading the appointments using HandleLoadmore in the calendar. We have prepared a simple sample, please find the attached sample and tested video for the same.

Additional information

SfCalendar version: 20.4.42


Please check our sample and let us know if you still facing the same issue. if not, please modify our sample and revert us back with the following details which would be helpful for us to check on it and provide you the solution as soon as possible,

  • Share the issue replicate video.

  • Share the calendar code snippets

  • Share the issue reproducible sample

Attachment: Sample_and_Video_fcf156a0.zip

Marked as answer

SS Szymon Slowinski January 9, 2023 10:06 AM UTC

Hello Muniappan Subramanian

Thank you for your help. I debugged your code and it helped me a lot.

It turned out that I made a mistake in handleLoadMore method.

My code was:

notifyListeners(CalendarDataSourceAction.add, appointments!);

but it should be:

notifyListeners(CalendarDataSourceAction.add, meetings);

I was passing appointments to notifyListeners instaed of meeting. After opening a screen for the second time I was passing the same appointments instaed of the empty meetings list.

Best Regards


MS Muniappan Subramanian Syncfusion Team January 10, 2023 12:26 PM UTC

We are glad that our solution meets your requirement. Please let us know if you need any further update. As always, we are happy to help you out.

Live Chat Icon For mobile
Up arrow icon