forked from firka/student-legacy
fixed warnings
This commit is contained in:
parent
8bfbaee1f5
commit
b4be0f66dc
@ -161,8 +161,6 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
log("[ERROR] SettingsProvider.fromMap: $e");
|
log("[ERROR] SettingsProvider.fromMap: $e");
|
||||||
}
|
}
|
||||||
|
|
||||||
print(map['seen_news']);
|
|
||||||
|
|
||||||
return SettingsProvider(
|
return SettingsProvider(
|
||||||
database: database,
|
database: database,
|
||||||
language: map["language"],
|
language: map["language"],
|
||||||
@ -302,7 +300,7 @@ class SettingsProvider extends ChangeNotifier {
|
|||||||
renameSubjectsItalics: false,
|
renameSubjectsItalics: false,
|
||||||
renameTeachersEnabled: false,
|
renameTeachersEnabled: false,
|
||||||
renameTeachersItalics: false,
|
renameTeachersItalics: false,
|
||||||
liveActivityColor: Color(0xFF676767),
|
liveActivityColor: const Color(0xFF676767),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class LessonTile extends StatelessWidget {
|
|||||||
fillLeading = true;
|
fillLeading = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lesson.substituteTeacher != "") {
|
if (lesson.substituteTeacher?.name != "") {
|
||||||
fill = true;
|
fill = true;
|
||||||
accent = AppColors.of(context).yellow;
|
accent = AppColors.of(context).yellow;
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ class LessonTile extends StatelessWidget {
|
|||||||
if (lesson.isChanged) {
|
if (lesson.isChanged) {
|
||||||
if (lesson.status?.name == "Elmaradt") {
|
if (lesson.status?.name == "Elmaradt") {
|
||||||
description = 'cancelled'.i18n;
|
description = 'cancelled'.i18n;
|
||||||
} else if (lesson.substituteTeacher != "") {
|
} else if (lesson.substituteTeacher?.name != "") {
|
||||||
description = 'substitution'.i18n;
|
description = 'substitution'.i18n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,8 +161,10 @@ class LessonTile extends StatelessWidget {
|
|||||||
color: AppColors.of(context)
|
color: AppColors.of(context)
|
||||||
.text
|
.text
|
||||||
.withOpacity(!lesson.isEmpty ? 1.0 : 0.5),
|
.withOpacity(!lesson.isEmpty ? 1.0 : 0.5),
|
||||||
fontStyle:
|
fontStyle: lesson.subject.isRenamed &&
|
||||||
lesson.subject.isRenamed && settingsProvider.renamedSubjectsItalics ? FontStyle.italic : null),
|
settingsProvider.renamedSubjectsItalics
|
||||||
|
? FontStyle.italic
|
||||||
|
: null),
|
||||||
),
|
),
|
||||||
subtitle: description != ""
|
subtitle: description != ""
|
||||||
? Text(
|
? Text(
|
||||||
|
@ -66,10 +66,12 @@ class KretaClient {
|
|||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
if (autoHeader) {
|
if (autoHeader) {
|
||||||
if (!headerMap.containsKey("authorization") && accessToken != null)
|
if (!headerMap.containsKey("authorization") && accessToken != null) {
|
||||||
headerMap["authorization"] = "Bearer $accessToken";
|
headerMap["authorization"] = "Bearer $accessToken";
|
||||||
if (!headerMap.containsKey("user-agent") && userAgent != null)
|
}
|
||||||
|
if (!headerMap.containsKey("user-agent") && userAgent != null) {
|
||||||
headerMap["user-agent"] = "$userAgent";
|
headerMap["user-agent"] = "$userAgent";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res = await client.get(Uri.parse(url), headers: headerMap);
|
res = await client.get(Uri.parse(url), headers: headerMap);
|
||||||
@ -123,12 +125,15 @@ class KretaClient {
|
|||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
if (autoHeader) {
|
if (autoHeader) {
|
||||||
if (!headerMap.containsKey("authorization") && accessToken != null)
|
if (!headerMap.containsKey("authorization") && accessToken != null) {
|
||||||
headerMap["authorization"] = "Bearer $accessToken";
|
headerMap["authorization"] = "Bearer $accessToken";
|
||||||
if (!headerMap.containsKey("user-agent") && userAgent != null)
|
}
|
||||||
|
if (!headerMap.containsKey("user-agent") && userAgent != null) {
|
||||||
headerMap["user-agent"] = "$userAgent";
|
headerMap["user-agent"] = "$userAgent";
|
||||||
if (!headerMap.containsKey("content-type"))
|
}
|
||||||
|
if (!headerMap.containsKey("content-type")) {
|
||||||
headerMap["content-type"] = "application/json";
|
headerMap["content-type"] = "application/json";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res = await client.post(Uri.parse(url), headers: headerMap, body: body);
|
res = await client.post(Uri.parse(url), headers: headerMap, body: body);
|
||||||
@ -183,10 +188,12 @@ class KretaClient {
|
|||||||
));
|
));
|
||||||
|
|
||||||
if (loginRes != null) {
|
if (loginRes != null) {
|
||||||
if (loginRes.containsKey("access_token"))
|
if (loginRes.containsKey("access_token")) {
|
||||||
accessToken = loginRes["access_token"];
|
accessToken = loginRes["access_token"];
|
||||||
if (loginRes.containsKey("refresh_token"))
|
}
|
||||||
|
if (loginRes.containsKey("refresh_token")) {
|
||||||
refreshToken = loginRes["refresh_token"];
|
refreshToken = loginRes["refresh_token"];
|
||||||
|
}
|
||||||
|
|
||||||
// Update role
|
// Update role
|
||||||
loginUser.role =
|
loginUser.role =
|
||||||
@ -200,8 +207,9 @@ class KretaClient {
|
|||||||
refreshToken: refreshToken!,
|
refreshToken: refreshToken!,
|
||||||
instituteCode: loginUser.instituteCode));
|
instituteCode: loginUser.instituteCode));
|
||||||
if (refreshRes != null) {
|
if (refreshRes != null) {
|
||||||
if (refreshRes.containsKey("id_token"))
|
if (refreshRes.containsKey("id_token")) {
|
||||||
idToken = refreshRes["id_token"];
|
idToken = refreshRes["id_token"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,8 +119,9 @@ class TimetableController extends ChangeNotifier {
|
|||||||
if (id < 0) return true; // Min 1.
|
if (id < 0) return true; // Min 1.
|
||||||
|
|
||||||
// Set week start to Sept. 1 of first week
|
// Set week start to Sept. 1 of first week
|
||||||
if (!_differentDate(week.start, Week.fromId(0).start))
|
if (!_differentDate(week.start, Week.fromId(0).start)) {
|
||||||
week.start = TimetableController.getSchoolYearStart();
|
week.start = TimetableController.getSchoolYearStart();
|
||||||
|
}
|
||||||
|
|
||||||
currentWeek = week;
|
currentWeek = week;
|
||||||
previousWeekId = currentWeekId;
|
previousWeekId = currentWeekId;
|
||||||
|
@ -6,7 +6,8 @@ import 'package:flutter_feather_icons/flutter_feather_icons.dart';
|
|||||||
import 'changed_lesson_tile.i18n.dart';
|
import 'changed_lesson_tile.i18n.dart';
|
||||||
|
|
||||||
class ChangedLessonTile extends StatelessWidget {
|
class ChangedLessonTile extends StatelessWidget {
|
||||||
const ChangedLessonTile(this.lesson, {Key? key, this.onTap, this.padding}) : super(key: key);
|
const ChangedLessonTile(this.lesson, {Key? key, this.onTap, this.padding})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
final Lesson lesson;
|
final Lesson lesson;
|
||||||
final void Function()? onTap;
|
final void Function()? onTap;
|
||||||
@ -21,7 +22,7 @@ class ChangedLessonTile extends StatelessWidget {
|
|||||||
|
|
||||||
Color accent = Theme.of(context).colorScheme.secondary;
|
Color accent = Theme.of(context).colorScheme.secondary;
|
||||||
|
|
||||||
if (lesson.substituteTeacher != "") {
|
if (lesson.substituteTeacher?.name != '') {
|
||||||
accent = AppColors.of(context).yellow;
|
accent = AppColors.of(context).yellow;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,7 +39,8 @@ class ChangedLessonTile extends StatelessWidget {
|
|||||||
visualDensity: VisualDensity.compact,
|
visualDensity: VisualDensity.compact,
|
||||||
contentPadding: const EdgeInsets.only(left: 8.0, right: 12.0),
|
contentPadding: const EdgeInsets.only(left: 8.0, right: 12.0),
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14.0)),
|
shape:
|
||||||
|
RoundedRectangleBorder(borderRadius: BorderRadius.circular(14.0)),
|
||||||
leading: SizedBox(
|
leading: SizedBox(
|
||||||
width: 44.0,
|
width: 44.0,
|
||||||
height: 44.0,
|
height: 44.0,
|
||||||
@ -55,7 +57,9 @@ class ChangedLessonTile extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
lesson.substituteTeacher != "" ? "substituted".i18n : "cancelled".i18n,
|
lesson.substituteTeacher?.name != ""
|
||||||
|
? "substituted".i18n
|
||||||
|
: "cancelled".i18n,
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||||
@ -64,7 +68,9 @@ class ChangedLessonTile extends StatelessWidget {
|
|||||||
lesson.subject.renamedTo ?? lesson.subject.name.capital(),
|
lesson.subject.renamedTo ?? lesson.subject.name.capital(),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(fontWeight: FontWeight.w500, fontStyle: lesson.subject.isRenamed ? FontStyle.italic : null),
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontStyle: lesson.subject.isRenamed ? FontStyle.italic : null),
|
||||||
),
|
),
|
||||||
trailing: const Icon(FeatherIcons.arrowRight),
|
trailing: const Icon(FeatherIcons.arrowRight),
|
||||||
minLeadingWidth: 0,
|
minLeadingWidth: 0,
|
||||||
|
@ -22,7 +22,7 @@ class LessonView extends StatelessWidget {
|
|||||||
|
|
||||||
if (RegExp(r'\d').hasMatch(lesson.lessonIndex)) lessonIndexTrailing = ".";
|
if (RegExp(r'\d').hasMatch(lesson.lessonIndex)) lessonIndexTrailing = ".";
|
||||||
|
|
||||||
if (lesson.substituteTeacher != "") {
|
if (lesson.substituteTeacher?.name != "") {
|
||||||
accent = AppColors.of(context).yellow;
|
accent = AppColors.of(context).yellow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,6 @@ class _ModifyTeacherNamesState extends State<ModifyTeacherNames> {
|
|||||||
.toSet()
|
.toSet()
|
||||||
.toList()
|
.toList()
|
||||||
..sort((a, b) => a.name.compareTo(b.name)));
|
..sort((a, b) => a.name.compareTo(b.name)));
|
||||||
print(teachers.map((e) => e.name));
|
|
||||||
user = Provider.of<UserProvider>(context, listen: false);
|
user = Provider.of<UserProvider>(context, listen: false);
|
||||||
dbProvider = Provider.of<DatabaseProvider>(context, listen: false);
|
dbProvider = Provider.of<DatabaseProvider>(context, listen: false);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user