updated project linter-rules and enforced them

This commit is contained in:
2024-03-29 18:22:55 +01:00
parent 21e11b6c2a
commit 75846750f7
113 changed files with 553 additions and 554 deletions

View File

@ -2,7 +2,7 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:marianum_mobile/extensions/dateTime.dart';
import '../../../extensions/dateTime.dart';
import 'package:provider/provider.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart';
@ -57,7 +57,7 @@ class _TimetableState extends State<Timetable> {
return Scaffold(
appBar: AppBar(
title: const Text("Stunden & Vertretungsplan"),
title: const Text('Stunden & Vertretungsplan'),
actions: [
IconButton(
icon: const Icon(Icons.home_outlined),
@ -74,11 +74,11 @@ class _TimetableState extends State<Timetable> {
Icon icon;
switch(e) {
case CalendarActions.addEvent:
title = "Kalendereintrag hinzufügen";
title = 'Kalendereintrag hinzufügen';
icon = const Icon(Icons.add);
case CalendarActions.viewEvents:
default:
title = "Kalendereinträge anzeigen";
title = 'Kalendereinträge anzeigen';
icon = const Icon(Icons.perm_contact_calendar_outlined);
}
return PopupMenuItem<CalendarActions>(
@ -112,9 +112,9 @@ class _TimetableState extends State<Timetable> {
if(value.hasError) {
return PlaceholderView(
icon: Icons.calendar_month,
text: "Webuntis error: ${value.error.toString()}",
text: 'Webuntis error: ${value.error.toString()}',
button: TextButton(
child: const Text("Neu laden"),
child: const Text('Neu laden'),
onPressed: () {
controller.displayDate = DateTime.now().add(const Duration(days: 2));
Provider.of<TimetableProps>(context, listen: false).resetWeek();
@ -155,8 +155,8 @@ class _TimetableState extends State<Timetable> {
startHour: 07.5,
endHour: 16.5,
timeInterval: Duration(minutes: 30),
timeFormat: "HH:mm",
dayFormat: "EE",
timeFormat: 'HH:mm',
dayFormat: 'EE',
timeIntervalHeight: 40,
),
@ -259,10 +259,10 @@ class _TimetableState extends State<Timetable> {
startTime: startTime,
endTime: endTime,
subject: subjects.result.firstWhere((subject) => subject.id == element.su[0].id).name,
location: ""
"${rooms.result.firstWhere((room) => room.id == element.ro[0].id).name}"
"\n"
"${element.te.first.longname}",
location: ''
'${rooms.result.firstWhere((room) => room.id == element.ro[0].id).name}'
'\n'
'${element.te.first.longname}',
notes: element.activityType,
color: _getEventColor(element, startTime, endTime),
);
@ -272,7 +272,7 @@ class _TimetableState extends State<Timetable> {
id: ArbitraryAppointment(webuntis: element),
startTime: _parseWebuntisTimestamp(element.date, element.startTime),
endTime: endTime,
subject: "Änderung",
subject: 'Änderung',
notes: element.info,
location: 'Unbekannt',
color: endTime.isBefore(DateTime.now()) ? Theme.of(context).primaryColor.withAlpha(100) : Theme.of(context).primaryColor,
@ -309,10 +309,10 @@ class _TimetableState extends State<Timetable> {
int 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).withAlpha(alpha);
// 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).withAlpha(alpha);
// Event was in the past
if(endTime.isBefore(DateTime.now())) return Theme.of(context).primaryColor.withAlpha(alpha);
@ -327,7 +327,7 @@ class _TimetableState extends State<Timetable> {
bool _isCrossedOut(CalendarAppointmentDetails calendarEntry) {
ArbitraryAppointment appointment = calendarEntry.appointments.first.id as ArbitraryAppointment;
if(appointment.hasWebuntis()) {
return appointment.webuntis!.code == "cancelled";
return appointment.webuntis!.code == 'cancelled';
}
return false;
}