diff --git a/example/lib/widgets/add_event_form.dart b/example/lib/widgets/add_event_form.dart index f6f2b46c..dbdf31c9 100644 --- a/example/lib/widgets/add_event_form.dart +++ b/example/lib/widgets/add_event_form.dart @@ -550,13 +550,20 @@ class _AddOrEditEventFormState extends State { if (!(_form.currentState?.validate() ?? true)) return; _form.currentState?.save(); - final occurrences = int.tryParse(_occurrenceController.text); + var occurrences = int.tryParse(_occurrenceController.text); DateTime? endDate; - if (widget.event?.recurrenceSettings?.occurrences != occurrences) { + + // On event edit recurrence end is selected "Never" + // Remove any previous end date & occurrences stored. + if (_selectedRecurrenceEnd == RecurrenceEnd.never) { endDate = null; - } else { + occurrences = null; + } + + if (_selectedRecurrenceEnd == RecurrenceEnd.onDate) { endDate = _recurrenceEndDate; } + final recurrenceSettings = RecurrenceSettings.withCalculatedEndDate( startDate: _startDate, endDate: endDate,