updated calendar color cards and detection update to V1.0.1

This commit is contained in:
2025-11-07 22:57:09 +01:00
parent 11c9f043f1
commit 05044691b6
4 changed files with 306 additions and 16 deletions
+20 -1
View File
@@ -36,7 +36,26 @@ class GoogleCalendarService {
final response = await _httpClient.get(url);
if (response.statusCode == 200) {
return _parseICalendar(response.body);
final allEvents = _parseICalendar(response.body);
// Filter events by date range if provided
if (startDate != null || endDate != null) {
return allEvents.where((event) {
if (event.startTime == null) return false;
if (startDate != null && event.startTime!.isBefore(startDate)) {
return false;
}
if (endDate != null && event.startTime!.isAfter(endDate)) {
return false;
}
return true;
}).toList();
}
return allEvents;
} else {
throw Exception('Failed to load calendar: ${response.statusCode}');
}