Merge pull request 'added opacity to past custom events' (#94) from develop-customEventOpacity into develop
Reviewed-on: #94
This commit was merged in pull request #94.
This commit is contained in:
@@ -30,7 +30,7 @@ class _AppointmentComponentState extends State<AppointmentComponent> {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.rectangle,
|
shape: BoxShape.rectangle,
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(5)),
|
borderRadius: const BorderRadius.all(Radius.circular(5)),
|
||||||
color: meeting.color,
|
color: meeting.color.withAlpha(meeting.endTime.isBefore(DateTime.now()) ? 100 : 255),
|
||||||
),
|
),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ class _TimetableState extends State<Timetable> {
|
|||||||
subject: 'Änderung',
|
subject: 'Änderung',
|
||||||
notes: element.info,
|
notes: element.info,
|
||||||
location: 'Unbekannt',
|
location: 'Unbekannt',
|
||||||
color: const Color(0xff404040).withAlpha(endTime.isBefore(DateTime.now()) ? 100 : 255),
|
color: const Color(0xff404040),
|
||||||
startTimeZone: '',
|
startTimeZone: '',
|
||||||
endTimeZone: '',
|
endTimeZone: '',
|
||||||
);
|
);
|
||||||
@@ -361,26 +361,23 @@ class _TimetableState extends State<Timetable> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Color _getEventColor(GetTimetableResponseObject webuntisElement, DateTime startTime, DateTime endTime) {
|
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
|
// 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
|
// 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
|
// 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
|
// 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
|
// Event takes currently place
|
||||||
if(endTime.isAfter(DateTime.now()) && startTime.isBefore(DateTime.now())) return Theme.of(context).primaryColor.withRed(200);
|
if(endTime.isAfter(DateTime.now()) && startTime.isBefore(DateTime.now())) return Theme.of(context).primaryColor.withRed(200);
|
||||||
|
|
||||||
// Fallback
|
// Fallback
|
||||||
return Theme.of(context).primaryColor.withAlpha(alpha);
|
return Theme.of(context).primaryColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _isCrossedOut(CalendarAppointmentDetails calendarEntry) {
|
bool _isCrossedOut(CalendarAppointmentDetails calendarEntry) {
|
||||||
|
|||||||
Reference in New Issue
Block a user