tried to fix timetable and handle kreten api error
This commit is contained in:
@@ -15,7 +15,8 @@ class MissedExamView extends StatelessWidget {
|
||||
|
||||
final List<Lesson> missedExams;
|
||||
|
||||
static show(List<Lesson> missedExams, {required BuildContext context}) => showRoundedModalBottomSheet(context, child: MissedExamView(missedExams));
|
||||
static show(List<Lesson> missedExams, {required BuildContext context}) =>
|
||||
showRoundedModalBottomSheet(context, child: MissedExamView(missedExams));
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -25,7 +26,8 @@ class MissedExamView extends StatelessWidget {
|
||||
}
|
||||
|
||||
class MissedExamViewTile extends StatelessWidget {
|
||||
const MissedExamViewTile(this.lesson, {Key? key, this.padding}) : super(key: key);
|
||||
const MissedExamViewTile(this.lesson, {Key? key, this.padding})
|
||||
: super(key: key);
|
||||
|
||||
final EdgeInsetsGeometry? padding;
|
||||
final Lesson lesson;
|
||||
@@ -33,23 +35,36 @@ class MissedExamViewTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SettingsProvider settingsProvider = Provider.of<SettingsProvider>(context);
|
||||
|
||||
String? teacherName = lesson.teacher.isRenamed
|
||||
? lesson.teacher.renamedTo
|
||||
: lesson.teacher.name;
|
||||
|
||||
return Material(
|
||||
type: MaterialType.transparency,
|
||||
child: Padding(
|
||||
padding: padding ?? const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
|
||||
padding: padding ??
|
||||
const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
|
||||
child: ListTile(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.0)),
|
||||
shape:
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.0)),
|
||||
leading: Icon(
|
||||
SubjectIcon.resolveVariant(subject: lesson.subject, context: context),
|
||||
SubjectIcon.resolveVariant(
|
||||
subject: lesson.subject, context: context),
|
||||
color: AppColors.of(context).text.withOpacity(.8),
|
||||
size: 32.0,
|
||||
),
|
||||
title: Text(
|
||||
"${lesson.subject.renamedTo ?? lesson.subject.name.capital()} • ${lesson.date.format(context)}",
|
||||
style: TextStyle(fontWeight: FontWeight.w600, fontStyle: lesson.subject.isRenamed && settingsProvider.renamedSubjectsItalics ? FontStyle.italic : null),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontStyle: lesson.subject.isRenamed &&
|
||||
settingsProvider.renamedSubjectsItalics
|
||||
? FontStyle.italic
|
||||
: null),
|
||||
),
|
||||
subtitle: Text(
|
||||
"missed_exam_contact".i18n.fill([lesson.teacher]),
|
||||
"missed_exam_contact".i18n.fill([teacherName ?? '']),
|
||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
||||
),
|
||||
trailing: const Icon(FeatherIcons.arrowRight),
|
||||
|
||||
@@ -39,7 +39,9 @@ class _StatusBarState extends State<StatusBar> {
|
||||
height: currentStatus != null ? 28.0 : 0,
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundColor,
|
||||
boxShadow: [BoxShadow(color: Theme.of(context).shadowColor, blurRadius: 8.0)],
|
||||
boxShadow: [
|
||||
BoxShadow(color: Theme.of(context).shadowColor, blurRadius: 8.0)
|
||||
],
|
||||
borderRadius: BorderRadius.circular(45.0),
|
||||
),
|
||||
),
|
||||
@@ -53,9 +55,12 @@ class _StatusBarState extends State<StatusBar> {
|
||||
height: currentStatus != null ? 28.0 : 0,
|
||||
duration: const Duration(milliseconds: 250),
|
||||
curve: Curves.easeInOut,
|
||||
width: MediaQuery.of(context).size.width * statusProvider.progress - 16.0,
|
||||
width: MediaQuery.of(context).size.width *
|
||||
statusProvider.progress -
|
||||
16.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.secondary.withOpacity(0.8),
|
||||
color:
|
||||
Theme.of(context).colorScheme.secondary.withOpacity(0.8),
|
||||
borderRadius: BorderRadius.circular(45.0),
|
||||
),
|
||||
),
|
||||
@@ -82,6 +87,8 @@ class _StatusBarState extends State<StatusBar> {
|
||||
return "Syncing data".i18n;
|
||||
case Status.maintenance:
|
||||
return "KRETA Maintenance".i18n;
|
||||
case Status.apiError:
|
||||
return "KRETA API error".i18n;
|
||||
case Status.network:
|
||||
return "No connection".i18n;
|
||||
default:
|
||||
@@ -93,10 +100,13 @@ class _StatusBarState extends State<StatusBar> {
|
||||
switch (status) {
|
||||
case Status.maintenance:
|
||||
return AppColors.of(context).red;
|
||||
case Status.apiError:
|
||||
return AppColors.of(context).red;
|
||||
case Status.network:
|
||||
case Status.syncing:
|
||||
default:
|
||||
HSLColor color = HSLColor.fromColor(Theme.of(context).scaffoldBackgroundColor);
|
||||
HSLColor color =
|
||||
HSLColor.fromColor(Theme.of(context).scaffoldBackgroundColor);
|
||||
if (color.lightness >= 0.5) {
|
||||
color = color.withSaturation(0.3);
|
||||
color = color.withLightness(color.lightness - 0.1);
|
||||
|
||||
@@ -6,16 +6,19 @@ extension Localization on String {
|
||||
"en_en": {
|
||||
"Syncing data": "Syncing data",
|
||||
"KRETA Maintenance": "KRETA Maintenance",
|
||||
"KRETA API error": "KRETA API Error",
|
||||
"No connection": "No connection",
|
||||
},
|
||||
"hu_hu": {
|
||||
"Syncing data": "Adatok frissítése",
|
||||
"KRETA Maintenance": "KRÉTA Karbantartás",
|
||||
"KRETA API error": "KRÉTA API Hiba",
|
||||
"No connection": "Nincs kapcsolat",
|
||||
},
|
||||
"de_de": {
|
||||
"Syncing data": "Daten aktualisieren",
|
||||
"KRETA Maintenance": "KRETA Wartung",
|
||||
"KRETA API error": "KRETA API Fehler",
|
||||
"No connection": "Keine Verbindung",
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user