werner-scholtz / kalender

An elegantly crafted Flutter calendar UI package.
MIT License
87 stars 23 forks source link

Getting issue in Editing Events #82

Open AniketStemmOne opened 1 month ago

AniketStemmOne commented 1 month ago

If there are multiple events on single day, if we edit any of it the first event will be also be updated by same value

how to fix it ??

eventController.updateEvent( modifiable: true, newDateTimeRange: DateTimeRange( start: task.startDate!, end: task.endDate!), newEventData: task, test: (calendarEvent) { return true; }, );

                                    its is always updating first event also 
werner-scholtz commented 1 month ago

Hi, so in the code you provided the test always returns true which means it will update the first event. see this for how the updateEvent works

You should have the test function return true for the event you want to update, ex. You want to update the event where the EventData matches someEvent.

eventController.updateEvent(
  modifiable: true,
  newDateTimeRange: DateTimeRange(
  start: task.startDate!,
  end: task.endDate!),
  newEventData: task,
  test: (calendarEvent) {
    return calendarEvent.eventData == someEvent.eventData;
  },
);