From f89ac87c513e46e2a5759680ff6a13c01da14d13 Mon Sep 17 00:00:00 2001 From: lars Date: Mon, 4 May 2026 09:45:24 +0200 Subject: [PATCH 1/2] added opacity to past custom events --- .../pages/timetable/appointmenetComponent.dart | 2 +- lib/view/pages/timetable/timetable.dart | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/view/pages/timetable/appointmenetComponent.dart b/lib/view/pages/timetable/appointmenetComponent.dart index 6db2a72..0f2d3e4 100644 --- a/lib/view/pages/timetable/appointmenetComponent.dart +++ b/lib/view/pages/timetable/appointmenetComponent.dart @@ -30,7 +30,7 @@ class _AppointmentComponentState extends State { decoration: BoxDecoration( shape: BoxShape.rectangle, borderRadius: const BorderRadius.all(Radius.circular(5)), - color: meeting.color, + color: meeting.color.withAlpha(meeting.endTime.isBefore(DateTime.now()) ? 100 : 255), ), child: SingleChildScrollView( child: Column( diff --git a/lib/view/pages/timetable/timetable.dart b/lib/view/pages/timetable/timetable.dart index 715ede1..1e8b71d 100644 --- a/lib/view/pages/timetable/timetable.dart +++ b/lib/view/pages/timetable/timetable.dart @@ -159,7 +159,7 @@ class _TimetableState extends State { appointmentBuilder: (BuildContext context, CalendarAppointmentDetails details) => AppointmentComponent( details: details, crossedOut: _isCrossedOut(details) - ), + ), headerHeight: 0, selectionDecoration: const BoxDecoration(), @@ -333,7 +333,7 @@ class _TimetableState extends State { subject: 'Änderung', notes: element.info, location: 'Unbekannt', - color: const Color(0xff404040).withAlpha(endTime.isBefore(DateTime.now()) ? 100 : 255), + color: const Color(0xff404040), startTimeZone: '', endTimeZone: '', ); @@ -361,26 +361,23 @@ class _TimetableState extends State { } Color _getEventColor(GetTimetableResponseObject webuntisElement, DateTime startTime, DateTime endTime) { - // Make element darker, when it already took place - var alpha = endTime.isBefore(DateTime.now()) ? 100 : 255; - // Cancelled - if(webuntisElement.code == 'cancelled') return const Color(0xff000000).withAlpha(alpha); + if(webuntisElement.code == 'cancelled') return const Color(0xff000000); // Any changes or no teacher at this element - if(webuntisElement.code == 'irregular' || webuntisElement.te.first.id == 0) return const Color(0xff8F19B3).withAlpha(alpha); + if(webuntisElement.code == 'irregular' || webuntisElement.te.first.id == 0) return const Color(0xff8F19B3); // Teacher has changed - if(webuntisElement.te.any((element) => element.orgname != null)) return const Color(0xFF29639B).withAlpha(alpha); + if(webuntisElement.te.any((element) => element.orgname != null)) return const Color(0xFF29639B); // Event was in the past - if(endTime.isBefore(DateTime.now())) return Theme.of(context).primaryColor.withAlpha(alpha); + if(endTime.isBefore(DateTime.now())) return Theme.of(context).primaryColor; // Event takes currently place if(endTime.isAfter(DateTime.now()) && startTime.isBefore(DateTime.now())) return Theme.of(context).primaryColor.withRed(200); // Fallback - return Theme.of(context).primaryColor.withAlpha(alpha); + return Theme.of(context).primaryColor; } bool _isCrossedOut(CalendarAppointmentDetails calendarEntry) { From 278fed52f17b7a4d81d1df9e3820b528348b66c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20M=C3=BCller?= Date: Mon, 4 May 2026 12:19:43 +0200 Subject: [PATCH 2/2] fixed indention --- lib/view/pages/timetable/timetable.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/view/pages/timetable/timetable.dart b/lib/view/pages/timetable/timetable.dart index 1e8b71d..208551c 100644 --- a/lib/view/pages/timetable/timetable.dart +++ b/lib/view/pages/timetable/timetable.dart @@ -157,9 +157,9 @@ class _TimetableState extends State { timeRegionBuilder: (BuildContext context, TimeRegionDetails timeRegionDetails) => TimeRegionComponent(details: timeRegionDetails), appointmentBuilder: (BuildContext context, CalendarAppointmentDetails details) => AppointmentComponent( - details: details, - crossedOut: _isCrossedOut(details) - ), + details: details, + crossedOut: _isCrossedOut(details) + ), headerHeight: 0, selectionDecoration: const BoxDecoration(),