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