improved performance and battery usage on older devices
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import 'package:rrule/rrule.dart';
|
||||
import 'package:syncfusion_flutter_calendar/calendar.dart';
|
||||
|
||||
import '../../../../extensions/date_time.dart';
|
||||
import '../../../../utils/recurrence_occurrences.dart';
|
||||
import 'arbitrary_appointment.dart';
|
||||
import 'calendar_layout.dart';
|
||||
import 'lesson_period_schedule.dart';
|
||||
@@ -103,7 +103,6 @@ partitionAppointmentsForWeek(
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
final parsed = RecurrenceRule.fromString(rule);
|
||||
final anchorUtc = a.startTime.toUtc();
|
||||
final duration = a.endTime.difference(a.startTime);
|
||||
// Day-keyed set of exception dates so occurrences scheduled for one
|
||||
@@ -112,9 +111,12 @@ partitionAppointmentsForWeek(
|
||||
final exceptionDayKeys = (a.recurrenceExceptionDates ?? const <DateTime>[])
|
||||
.map((d) => '${d.year}-${d.month}-${d.day}')
|
||||
.toSet();
|
||||
for (final occUtc in parsed.getInstances(start: anchorUtc)) {
|
||||
if (!occUtc.isBefore(weekEndUtc)) break;
|
||||
if (occUtc.isBefore(weekStartUtc)) continue;
|
||||
for (final occUtc in RecurrenceOccurrences.between(
|
||||
rule,
|
||||
anchorUtc,
|
||||
weekStartUtc,
|
||||
weekEndUtc,
|
||||
)) {
|
||||
final occLocal = occUtc.toLocal();
|
||||
if (exceptionDayKeys.contains(
|
||||
'${occLocal.year}-${occLocal.month}-${occLocal.day}',
|
||||
|
||||
Reference in New Issue
Block a user