|
|
|
@@ -157,8 +157,8 @@ class _TimetableState extends State<Timetable> {
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
@@ -333,7 +333,7 @@ class _TimetableState extends State<Timetable> {
|
|
|
|
|
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<Timetable> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|