diff --git a/lib/view/pages/timetable/timetable.dart b/lib/view/pages/timetable/timetable.dart index bd0d9bb..6556593 100644 --- a/lib/view/pages/timetable/timetable.dart +++ b/lib/view/pages/timetable/timetable.dart @@ -208,14 +208,15 @@ class _TimetableState extends State { color: _getEventColor(element, startTime, endTime), ); } catch(e) { + DateTime endTime = _parseWebuntisTimestamp(element.date, element.endTime); return Appointment( id: element, startTime: _parseWebuntisTimestamp(element.date, element.startTime), - endTime: _parseWebuntisTimestamp(element.date, element.endTime), + endTime: endTime, subject: "Änderung", notes: element.info, location: 'Unbekannt', - color: Theme.of(context).primaryColor, + color: endTime.isBefore(DateTime.now()) ? Theme.of(context).primaryColor.withAlpha(100) : Theme.of(context).primaryColor, startTimeZone: '', endTimeZone: '', ); @@ -232,16 +233,16 @@ class _TimetableState extends State { Color _getEventColor(GetTimetableResponseObject webuntisElement, DateTime startTime, DateTime endTime) { // Make element darker, when it already took place - int opacity = endTime.isBefore(DateTime.now()) ? 100 : 255; + int alpha = endTime.isBefore(DateTime.now()) ? 100 : 255; // Cancelled - if(webuntisElement.code == "cancelled") return const Color(0xff000000).withAlpha(opacity); + if(webuntisElement.code == "cancelled") return const Color(0xff000000).withAlpha(alpha); // Any changes or no teacher at this element - if(webuntisElement.code == "irregular" || webuntisElement.te.first.id == 0) return const Color(0xff8F19B3).withAlpha(opacity); + if(webuntisElement.code == "irregular" || webuntisElement.te.first.id == 0) return const Color(0xff8F19B3).withAlpha(alpha); // Event was in the past - if(endTime.isBefore(DateTime.now())) return Theme.of(context).primaryColor.withAlpha(opacity); + if(endTime.isBefore(DateTime.now())) return Theme.of(context).primaryColor.withAlpha(alpha); // Event takes currently place if(endTime.isAfter(DateTime.now()) && startTime.isBefore(DateTime.now())) return Theme.of(context).primaryColor.withRed(100);