fetchWeekEvents method
Fetches the calendar events for a specific week.
Implementation
@override
Future<List<CalendarMonthEvent>> fetchWeekEvents({
String? templateId,
required DateTime displayDate,
required bool parentElementsOnly,
}) async {
await Future.delayed(
const Duration(milliseconds: 500)); // Simulate network delay
final startOfWeek = displayDate.subtract(Duration(
days: displayDate.weekday %
7)); // Assuming Sunday is the first day of the week
final endOfWeek = startOfWeek.add(const Duration(days: 7));
return allDummyEvents.where((event) {
return event.startDate.isBefore(endOfWeek) &&
event.endDate.isAfter(startOfWeek);
}).toList();
}