UCalendarDataSource constructor

UCalendarDataSource({
  1. required List<Appointment> appointments,
  2. bool useJalali = false,
})

Implementation

UCalendarDataSource({
  required List<Appointment> appointments,
  this.useJalali = false,
}) {
  this.appointments = appointments.map((Appointment appt) {
    if (useJalali) {
      final Jalali jalaliStart = Jalali.fromDateTime(appt.startTime);
      final Jalali jalaliEnd = Jalali.fromDateTime(appt.endTime);
      return Appointment(
        startTime: jalaliStart.toDateTime(),
        endTime: jalaliEnd.toDateTime(),
        subject: appt.subject,
        color: appt.color,
        isAllDay: appt.isAllDay,
        recurrenceRule: appt.recurrenceRule,
      );
    }
    return appt;
  }).toList();
}