1
0
forked from firka/firka

firka_wear: use kreta_api for API models

This commit is contained in:
2026-03-01 14:57:24 +01:00
parent bd53ba6c9b
commit 9fc73e3c5c
28 changed files with 227 additions and 1237 deletions

View File

@@ -1,22 +0,0 @@
/*
Firka, alternative e-Kréta client.
Copyright (C) 2025 QwIT Development
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/// Watch no longer calls Kréta API; data comes from phone via init_data/sync_data.
class Constants {
static const clientId = "kreta-ellenorzo-student-mobile-ios";
}

View File

@@ -1,64 +0,0 @@
class NameUidDesc {
final String uid;
final String? name;
final String? description;
NameUidDesc({
required this.uid,
required this.name,
required this.description,
});
factory NameUidDesc.fromJson(Map<String, dynamic> json) {
return NameUidDesc(
uid: json['Uid'],
name: json['Nev'],
description: json['Leiras'],
);
}
Map<String, dynamic> toJson() {
return {'Uid': uid, 'Nev': name, 'Leiras': description};
}
@override
String toString() {
return 'NameUidDesc('
'uid: "$uid", '
'name: "$name", '
'description: "$description"'
')';
}
}
class NameUid {
final String uid;
final String name;
NameUid({required this.uid, required this.name});
factory NameUid.fromJson(Map<String, dynamic> json) {
return NameUid(uid: json['Uid'], name: json['Nev']);
}
Map<String, dynamic> toJson() {
return {'Uid': uid, 'Nev': name};
}
}
class UidObj {
final String uid;
UidObj({required this.uid});
factory UidObj.fromJson(Map<String, dynamic> json) {
return UidObj(uid: json['Uid']);
}
@override
String toString() {
return 'UidObj('
'uid: "$uid"'
')';
}
}

View File

@@ -1,123 +0,0 @@
import 'package:firka_wear/helpers/api/model/generic.dart';
import 'package:firka_wear/helpers/api/model/subject.dart';
class Grade {
final String uid;
final DateTime recordDate;
final DateTime creationDate;
final DateTime? ackDate;
final Subject subject;
final String? topic;
final NameUidDesc type;
final NameUidDesc? mode;
NameUidDesc valueType;
final String teacher;
final String? kind;
int? numericValue;
final String strValue;
final int? weightPercentage;
final String? shortStrValue;
final UidObj? classGroup;
final int sortIndex;
Grade({
required this.uid,
required this.recordDate,
required this.creationDate,
this.ackDate,
required this.subject,
this.topic,
required this.type,
this.mode,
required this.valueType,
required this.teacher,
this.kind,
this.numericValue,
required this.strValue,
this.weightPercentage,
this.shortStrValue,
this.classGroup,
required this.sortIndex,
});
factory Grade.fromJson(Map<String, dynamic> json) {
return Grade(
uid: json['Uid'],
recordDate: DateTime.parse(json['RogzitesDatuma']).toLocal(),
creationDate: DateTime.parse(json['KeszitesDatuma']).toLocal(),
ackDate: json['LattamozasDatuma'] != null
? DateTime.parse(json['LattamozasDatuma']).toLocal()
: null,
subject: Subject.fromJson(
Map<String, dynamic>.from(json['Tantargy'] as Map),
),
topic: json['Tema'],
type: NameUidDesc.fromJson(
Map<String, dynamic>.from(json['Tipus'] as Map),
),
mode: json['Mod'] != null
? NameUidDesc.fromJson(Map<String, dynamic>.from(json['Mod'] as Map))
: null,
valueType: NameUidDesc.fromJson(
Map<String, dynamic>.from(json['ErtekFajta'] as Map),
),
teacher: json['ErtekeloTanarNeve'],
kind: json['Kind'],
numericValue: json['SzamErtek'],
strValue: json['SzovegesErtek'],
weightPercentage: json['SulySzazalekErteke'],
shortStrValue: json['SzovegesErtekelesRovidNev'],
classGroup: json['OsztalyCsoport'] != null
? UidObj.fromJson(
Map<String, dynamic>.from(json['OsztalyCsoport'] as Map),
)
: null,
sortIndex: json['SortIndex'],
);
}
Map<String, dynamic> toJson() {
return {
'Uid': uid,
'RogzitesDatuma': recordDate.toUtc().toIso8601String(),
'KeszitesDatuma': creationDate.toUtc().toIso8601String(),
'LattamozasDatuma': ackDate?.toUtc().toIso8601String(),
'Tantargy': subject.toJson(),
'Tema': topic,
'Tipus': type.toJson(),
'Mod': mode?.toJson(),
'ErtekFajta': valueType.toJson(),
'ErtekeloTanarNeve': teacher,
'Kind': kind,
'SzamErtek': numericValue,
'SzovegesErtek': strValue,
'SulySzazalekErteke': weightPercentage,
'SzovegesErtekelesRovidNev': shortStrValue,
'OsztalyCsoport': classGroup != null ? {'Uid': classGroup!.uid} : null,
'SortIndex': sortIndex,
};
}
@override
String toString() {
return 'Grade('
'uid: "$uid", '
'recordDate: "$recordDate", '
'creationDate: "$creationDate", '
'ackDate: "${ackDate ?? 'null'}", '
'subject: $subject, '
'topic: "${topic ?? 'null'}", '
'type: $type, '
'mode: ${mode ?? 'null'}, '
'valueType: $valueType, '
'teacher: "$teacher", '
'kind: "${kind ?? 'null'}", '
'numericValue: ${numericValue ?? 'null'}, '
'strValue: "$strValue", '
'weightPercentage: ${weightPercentage ?? 'null'}, '
'shortStrValue: "${shortStrValue ?? 'null'}", '
'classGroup: ${classGroup ?? 'null'}, '
'sortIndex: $sortIndex'
')';
}
}

View File

@@ -1,52 +0,0 @@
/*
Firka, alternative e-Kréta client.
Copyright (C) 2025 QwIT Development
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
class Guardian {
final String? email;
final bool isLegalRepresentative;
final String? name;
final String? phoneNumber;
final String uid;
Guardian(
{required this.email,
required this.isLegalRepresentative,
required this.name,
required this.phoneNumber,
required this.uid});
factory Guardian.fromJson(Map<String, dynamic> json) {
return Guardian(
email: json['EmailCim'],
isLegalRepresentative: json['IsTorvenyesKepviselo'],
name: json['Nev'],
phoneNumber: json['Telefonszam'],
uid: json['Uid']);
}
@override
String toString() {
return 'Guardian('
'email: "$email", '
'isLegalRepresentative: $isLegalRepresentative, '
'name: "$name", '
'phoneNumber: "$phoneNumber", '
'uid: "$uid"'
')';
}
}

View File

@@ -1,70 +0,0 @@
import 'package:firka_wear/helpers/api/model/subject.dart';
import 'generic.dart';
class Homework {
final String uid;
final Subject subject;
final String subjectName;
final String teacherName;
final String description;
final DateTime startDate;
final DateTime dueDate;
final DateTime creationDate;
final bool isCreatedByTeacher;
final bool isDone;
final bool canBeSubmitted;
final UidObj classGroup;
final bool canAttach;
Homework(
{required this.uid,
required this.subject,
required this.subjectName,
required this.teacherName,
required this.description,
required this.startDate,
required this.dueDate,
required this.creationDate,
required this.isCreatedByTeacher,
required this.isDone,
required this.canBeSubmitted,
required this.classGroup,
required this.canAttach});
factory Homework.fromJson(Map<String, dynamic> json) {
return Homework(
uid: json["Uid"],
subject: Subject.fromJson(json["Tantargy"]),
subjectName: json["TantargyNeve"],
teacherName: json["RogzitoTanarNeve"],
description: json["Szoveg"],
startDate: DateTime.parse(json["FeladasDatuma"]).toLocal(),
dueDate: DateTime.parse(json["HataridoDatuma"]).toLocal(),
creationDate: DateTime.parse(json["RogzitesIdopontja"]).toLocal(),
isCreatedByTeacher: json["IsTanarRogzitette"],
isDone: json["IsMegoldva"],
canBeSubmitted: json["IsBeadhato"],
classGroup: UidObj.fromJson(json["OsztalyCsoport"]),
canAttach: json["IsCsatolasEngedelyezes"]);
}
@override
String toString() {
return 'Homework('
'uid: "$uid", '
'subject: $subject, '
'subjectName: "$subjectName", '
'teacherName: "$teacherName", '
'description: "$description", '
'startDate: $startDate, '
'dueDate: $dueDate, '
'creationDate: $creationDate, '
'isCreatedByTeacher: $isCreatedByTeacher, '
'isDone: $isDone, '
'canBeSubmitted: $canBeSubmitted, '
'classGroup: $classGroup, '
'canAttach: $canAttach'
')';
}
}

View File

@@ -1,100 +0,0 @@
/*
Firka, alternative e-Kréta client.
Copyright (C) 2025 QwIT Development
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
class Institution {
final CustomizationSettings customizationSettings;
final String shortName;
final List<SystemModule> systemModuleList;
final String uid;
Institution(
{required this.customizationSettings,
required this.shortName,
required this.systemModuleList,
required this.uid});
factory Institution.fromJson(Map<String, dynamic> json) {
var systemModuleList = List<SystemModule>.empty(growable: true);
for (var item in json['Rendszermodulok']) {
systemModuleList.add(SystemModule.fromJson(item));
}
return Institution(
customizationSettings:
CustomizationSettings.fromJson(json['TestreszabasBeallitasok']),
shortName: json['RovidNev'],
systemModuleList: systemModuleList,
uid: json['Uid'],
);
}
}
class CustomizationSettings {
final int delayForNotifications;
final bool isClassAverageVisible;
final bool isLessonsThemeVisible;
final String nextServerDeployAsString;
CustomizationSettings(
{required this.delayForNotifications,
required this.isClassAverageVisible,
required this.isLessonsThemeVisible,
required this.nextServerDeployAsString});
factory CustomizationSettings.fromJson(Map<String, dynamic> json) {
return CustomizationSettings(
delayForNotifications:
json['ErtekelesekMegjelenitesenekKesleltetesenekMerteke'],
isClassAverageVisible: json['IsOsztalyAtlagMegjeleniteseEllenorzoben'],
isLessonsThemeVisible: json['IsTanorakTemajaMegtekinthetoEllenorzoben'],
nextServerDeployAsString: json['KovetkezoTelepitesDatuma']);
}
@override
String toString() {
return 'CustomizationSettings('
'delayForNotifications: $delayForNotifications, '
'isClassAverageVisible: $isClassAverageVisible, '
'isLessonsThemeVisible: $isLessonsThemeVisible, '
'nextServerDeployAsString: "$nextServerDeployAsString"'
')';
}
}
class SystemModule {
final bool isActive;
final String type;
final String? url;
SystemModule({required this.isActive, required this.type, required this.url});
factory SystemModule.fromJson(Map<String, dynamic> json) {
return SystemModule(
isActive: json['IsAktiv'], type: json['Tipus'], url: json['Url']);
}
@override
String toString() {
return 'SystemModule('
'isActive: $isActive, '
'type: "$type", '
'url: "$url"'
')';
}
}

View File

@@ -1,42 +0,0 @@
class NoticeBoardItem {
final String uid;
final String author;
final DateTime validFrom;
final DateTime validTo;
final String title;
final String contentHTML;
final String contentText;
NoticeBoardItem(
{required this.uid,
required this.author,
required this.validFrom,
required this.validTo,
required this.title,
required this.contentHTML,
required this.contentText});
factory NoticeBoardItem.fromJson(Map<String, dynamic> json) {
return NoticeBoardItem(
uid: json['Uid'],
author: json['RogzitoNeve'],
validFrom: DateTime.parse(json['ErvenyessegKezdete']),
validTo: DateTime.parse(json['ErvenyessegVege']),
title: json['Cim'],
contentHTML: json['Tartalom'],
contentText: json['TartalomText']);
}
@override
String toString() {
return 'NoticeBoardItem('
'uid: "$uid", '
'author: "$author", '
'validFrom: "$validFrom", '
'validTo: "$validTo", '
'title: "$title", '
'contentHTML: "$contentHTML", '
'contentText: "$contentText"'
')';
}
}

View File

@@ -1,98 +0,0 @@
import 'package:firka_wear/helpers/api/model/generic.dart';
import 'package:firka_wear/helpers/api/model/subject.dart';
class Omission {
final String uid;
final Subject subject;
final Class? c;
final DateTime date;
final String teacher;
final NameUidDesc? type;
final NameUidDesc? mode;
final int? lateForMin;
final DateTime createdAt;
final String state;
final NameUidDesc proofType;
final UidObj? classGroup;
Omission({
required this.uid,
required this.subject,
required this.c,
required this.date,
required this.teacher,
this.type,
this.mode,
this.lateForMin,
required this.createdAt,
required this.state,
required this.proofType,
this.classGroup,
});
factory Omission.fromJson(Map<String, dynamic> json) {
return Omission(
uid: json['Uid'],
subject: Subject.fromJson(json['Tantargy']),
c: json['Osztaly'] != null ? Class.fromJson(json['Osztaly']) : null,
date: DateTime.parse(json['Datum']),
teacher: json['RogzitoTanarNeve'],
type: json['Tipus'] != null ? NameUidDesc.fromJson(json['Tipus']) : null,
mode: json['Mod'] != null ? NameUidDesc.fromJson(json['Mod']) : null,
lateForMin: json['KesesPercben'],
createdAt: DateTime.parse(json['KeszitesDatuma']),
state: json['IgazolasAllapota'],
proofType: NameUidDesc.fromJson(json['IgazolasTipusa']),
classGroup: json['OsztalyCsoport'] != null
? UidObj.fromJson(json['OsztalyCsoport'])
: null,
);
}
@override
String toString() {
return 'Omission('
'uid: "$uid", '
'subject: $subject, '
'c: $c, '
'date: $date, '
'teacher: "$teacher", '
'type: $type, '
'mode: $mode, '
'lateForMin: $lateForMin, '
'createdAt: $createdAt, '
'state: "$state", '
'proofType: $proofType, '
'classGroup: $classGroup'
')';
}
}
class Class {
final DateTime start;
final DateTime end;
final int classNo;
Class({
required this.start,
required this.end,
required this.classNo,
});
factory Class.fromJson(Map<String, dynamic> json) {
return Class(
start: DateTime.parse(json['KezdoDatum']),
end: DateTime.parse(json['VegDatum']),
classNo: json['Oraszam'],
);
}
@override
String toString() {
return 'Class('
'start: "$start", '
'end: "$end", '
'classNo: $classNo'
')';
}
}

View File

@@ -1,133 +0,0 @@
/*
Firka, alternative e-Kréta client.
Copyright (C) 2025 QwIT Development
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import 'package:firka_wear/helpers/api/model/guardian.dart';
import 'package:firka_wear/helpers/api/model/institution.dart';
import 'package:firka_wear/helpers/json_helper.dart';
import 'package:intl/intl.dart';
class Student {
final List<String> addressDataList;
final BankAccount bankAccount;
// final int yearOfBirth;
// final int monthOfBirth;
// final int dayOfBirth;
final DateTime birthdate;
final String? emailAddress;
final String name;
final String? phoneNumber;
final String schoolYearUID;
final String uid;
final List<Guardian> guardianList;
final String instituteCode;
final String instituteName;
final Institution institution;
Student(
{required this.addressDataList,
required this.bankAccount,
// required this.yearOfBirth,
// required this.monthOfBirth,
// required this.dayOfBirth,
required this.birthdate,
required this.emailAddress,
required this.name,
required this.phoneNumber,
required this.schoolYearUID,
required this.uid,
required this.guardianList,
required this.instituteCode,
required this.instituteName,
required this.institution});
factory Student.fromJson(Map<String, dynamic> json) {
var guardianList = List<Guardian>.empty(growable: true);
for (var item in json['Gondviselok']) {
guardianList.add(Guardian.fromJson(item));
}
return Student(
addressDataList: listToTyped<String>(json['Cimek']),
bankAccount: BankAccount.fromJson(json['Bankszamla']),
birthdate: DateFormat('yyyy-M-d').parse(
"${json['SzuletesiEv']}-${json['SzuletesiHonap']}-${json['SzuletesiNap']}"),
emailAddress: json['EmailCim'],
name: json['Nev'],
phoneNumber: json['Telefonszam'],
schoolYearUID: json['TanevUid'],
uid: json['Uid'],
guardianList: guardianList,
instituteCode: json['IntezmenyAzonosito'],
instituteName: json['IntezmenyNev'],
institution: Institution.fromJson(json['Intezmeny']));
}
@override
String toString() {
return 'Student('
'addressDataList: [$addressDataList], '
'bankAccount: $bankAccount, '
'birthDate: $birthdate, '
'emailAddress: "$emailAddress", '
'name: "$name", '
'phoneNumber: "$phoneNumber", '
'schoolYearUID: "$schoolYearUID", '
'uid: "$uid", '
'guardianList: [$guardianList], '
'instituteCode: "$instituteCode", '
'instituteName: "$instituteName", '
')';
}
}
class BankAccount {
final String? accountNumber;
final bool? isReadOnly;
final String? ownerName;
final int? ownerType;
BankAccount(
{required this.accountNumber,
required this.isReadOnly,
required this.ownerName,
required this.ownerType});
factory BankAccount.fromJson(Map<String, dynamic> json) {
return BankAccount(
accountNumber: json['BankszamlaSzam'],
isReadOnly: json['IsReadOnly'],
ownerName: json['BankszamlaTulajdonosNeve'],
ownerType: json['BankszamlaTulajdonosTipusId']);
}
@override
String toString() {
return 'BankAccount('
'accountNumber: "$accountNumber", '
'isReadOnly: "$isReadOnly", '
'ownerName: "$ownerName", '
'ownerType: "$ownerType"'
')';
}
}

View File

@@ -1,50 +0,0 @@
import 'package:firka_wear/helpers/api/model/generic.dart';
class Subject {
final String uid;
final String name;
final NameUidDesc category;
final int sortIndex;
final String? teacherName;
Subject({
required this.uid,
required this.name,
required this.category,
required this.sortIndex,
this.teacherName,
});
factory Subject.fromJson(Map<String, dynamic> json) {
return Subject(
uid: json['Uid'],
name: json['Nev'],
category: NameUidDesc.fromJson(
Map<String, dynamic>.from(json['Kategoria'] as Map),
),
sortIndex: json['SortIndex'],
teacherName: json['alkalmazottNev'],
);
}
Map<String, dynamic> toJson() {
return {
'Uid': uid,
'Nev': name,
'Kategoria': category.toJson(),
'SortIndex': sortIndex,
'alkalmazottNev': teacherName,
};
}
@override
String toString() {
return 'Subject('
'uid: "$uid", '
'name: "$name", '
'category: $category, '
'sortIndex: $sortIndex, '
'teacherName: $teacherName'
')';
}
}

View File

@@ -1,60 +0,0 @@
import 'package:firka_wear/helpers/api/model/subject.dart';
import 'generic.dart';
class Test {
final String uid;
final DateTime date;
final DateTime reportDate;
final String teacherName;
final int lessonNumber;
final Subject subject;
final String subjectName;
final String theme;
final NameUidDesc method;
final UidObj classGroup;
Test({
required this.uid,
required this.date,
required this.reportDate,
required this.teacherName,
required this.lessonNumber,
required this.subject,
required this.subjectName,
required this.theme,
required this.method,
required this.classGroup,
});
factory Test.fromJson(Map<String, dynamic> json) {
return Test(
uid: json['Uid'],
date: DateTime.parse(json['Datum']),
reportDate: DateTime.parse(json['BejelentesDatuma']),
teacherName: json['RogzitoTanarNeve'],
lessonNumber: json['OrarendiOraOraszama'],
subject: Subject.fromJson(json['Tantargy']),
subjectName: json['TantargyNeve'],
theme: json['Temaja'],
method: NameUidDesc.fromJson(json['Modja']),
classGroup: UidObj.fromJson(json['OsztalyCsoport']),
);
}
@override
String toString() {
return 'Test('
'uid: "$uid", '
'date: $date, '
'reportDate: $reportDate, '
'teacherName: "$teacherName", '
'lessonNumber: $lessonNumber, '
'subject: $subject, '
'subjectName: "$subjectName", '
'theme: "$theme", '
'method: $method, '
'classGroup: $classGroup'
')';
}
}

View File

@@ -1,195 +0,0 @@
import 'package:firka_wear/helpers/api/model/generic.dart';
import 'package:firka_wear/helpers/api/model/subject.dart';
class Lesson {
final String uid;
final String date;
final DateTime start;
final DateTime end;
final String name;
final int? lessonNumber;
final int? lessonSeqNumber;
final NameUid? classGroup;
final String? teacher;
final Subject? subject;
final String? theme;
final String? roomName;
final NameUidDesc type;
final NameUidDesc? studentPresence;
final NameUidDesc state;
final String? substituteTeacher;
final String? homeworkUid;
final String? taskGroupUid;
final String? languageTaskGroupUid;
final String? assessmentUid;
final bool canStudentEditHomework;
final bool isHomeworkComplete;
final List<NameUid> attachments;
final bool isDigitalLesson;
final String? digitalDeviceList;
final String? digitalPlatformType;
final List<String> digitalSupportDeviceTypeList;
final DateTime createdAt;
final DateTime lastModifiedAt;
Lesson({
required this.uid,
required this.date,
required this.start,
required this.end,
required this.name,
this.lessonNumber,
this.lessonSeqNumber,
this.classGroup,
this.teacher,
this.subject,
this.theme,
this.roomName,
required this.type,
this.studentPresence,
required this.state,
this.substituteTeacher,
this.homeworkUid,
this.taskGroupUid,
this.languageTaskGroupUid,
this.assessmentUid,
required this.canStudentEditHomework,
required this.isHomeworkComplete,
required this.attachments,
required this.isDigitalLesson,
this.digitalDeviceList,
this.digitalPlatformType,
required this.digitalSupportDeviceTypeList,
required this.createdAt,
required this.lastModifiedAt,
});
factory Lesson.fromJson(Map<String, dynamic> json) {
var attachments = List<NameUid>.empty(growable: true);
var rawAttachments = json['Csatolmanyok'] as List<dynamic>? ?? [];
for (var attachment in rawAttachments) {
attachments.add(
NameUid.fromJson(Map<String, dynamic>.from(attachment as Map)),
);
}
return Lesson(
uid: json['Uid'],
date: json['Datum'],
start: DateTime.parse(json['KezdetIdopont']).toLocal(),
end: DateTime.parse(json['VegIdopont']).toLocal(),
name: json['Nev'],
lessonNumber: json['Oraszam'],
lessonSeqNumber: json['OraEvesSorszama'],
classGroup: json['OsztalyCsoport'] != null
? NameUid.fromJson(
Map<String, dynamic>.from(json['OsztalyCsoport'] as Map),
)
: null,
teacher: json['TanarNeve'],
subject: json['Tantargy'] != null
? Subject.fromJson(Map<String, dynamic>.from(json['Tantargy'] as Map))
: null,
theme: json['Tema'],
roomName: json['TeremNeve'],
type: NameUidDesc.fromJson(
Map<String, dynamic>.from(json['Tipus'] as Map),
),
studentPresence: json['TanuloJelenlet'] != null
? NameUidDesc.fromJson(
Map<String, dynamic>.from(json['TanuloJelenlet'] as Map),
)
: null,
state: NameUidDesc.fromJson(
Map<String, dynamic>.from(json['Allapot'] as Map),
),
substituteTeacher: json['HelyettesTanarNeve'],
homeworkUid: json['HaziFeladatUid'],
taskGroupUid: json['FeladatGroupUid'],
languageTaskGroupUid: json['NyelviFeladatGroupUid'],
assessmentUid: json['BejelentettSzamonkeresUid'],
canStudentEditHomework: json['IsTanuloHaziFeladatEnabled'],
isHomeworkComplete: json['IsHaziFeladatMegoldva'],
attachments: attachments,
isDigitalLesson: json['IsDigitalisOra'],
digitalDeviceList: json['DigitalisEszkozTipus'],
digitalPlatformType: json['DigitalisPlatformTipus'],
digitalSupportDeviceTypeList:
json['DigitalisTamogatoEszkozTipusList'] != null
? List<String>.from(json['DigitalisTamogatoEszkozTipusList'])
: List<String>.empty(),
createdAt: DateTime.parse(json['Letrehozas']).toLocal(),
lastModifiedAt: DateTime.parse(json['UtolsoModositas']).toLocal(),
);
}
Map<String, dynamic> toJson() {
final rawAttachments = attachments.map((e) => e.toJson()).toList();
return {
'Uid': uid,
'Datum': date,
'KezdetIdopont': start.toIso8601String(),
'VegIdopont': end.toIso8601String(),
'Nev': name,
'Oraszam': lessonNumber,
'OraEvesSorszama': lessonSeqNumber,
'OsztalyCsoport': classGroup?.toJson(),
'TanarNeve': teacher,
'Tantargy': subject?.toJson(),
'Tema': theme,
'TeremNeve': roomName,
'Tipus': type.toJson(),
'TanuloJelenlet': studentPresence?.toJson(),
'Allapot': state.toJson(),
'HelyettesTanarNeve': substituteTeacher,
'HaziFeladatUid': homeworkUid,
'FeladatGroupUid': taskGroupUid,
'NyelviFeladatGroupUid': languageTaskGroupUid,
'BejelentettSzamonkeresUid': assessmentUid,
'IsTanuloHaziFeladatEnabled': canStudentEditHomework,
'IsHaziFeladatMegoldva': isHomeworkComplete,
'Csatolmanyok': rawAttachments,
'IsDigitalisOra': isDigitalLesson,
'DigitalisEszkozTipus': digitalDeviceList,
'DigitalisPlatformTipus': digitalPlatformType,
'DigitalisTamogatoEszkozTipusList': digitalSupportDeviceTypeList,
'Letrehozas': createdAt.toIso8601String(),
'UtolsoModositas': lastModifiedAt.toIso8601String(),
};
}
@override
String toString() {
return 'Lesson('
'uid: "$uid", '
'date: "$date", '
'start: $start, '
'end: $end, '
'name: "$name", '
'lessonNumber: $lessonNumber, '
'lessonSeqNumber: $lessonSeqNumber, '
'classGroup: $classGroup, '
'teacher: "$teacher", '
'subject: $subject, '
'theme: "$theme", '
'roomName: "$roomName", '
'type: $type, '
'studentPresence: $studentPresence, '
'state: $state, '
'substituteTeacher: "$substituteTeacher", '
'homeworkUid: "$homeworkUid", '
'taskGroupUid: "$taskGroupUid", '
'languageTaskGroupUid: "$languageTaskGroupUid", '
'assessmentUid: "$assessmentUid", '
'canStudentEditHomework: $canStudentEditHomework, '
'isHomeworkComplete: $isHomeworkComplete, '
'attachments: $attachments, '
'isDigitalLesson: $isDigitalLesson, '
'digitalDeviceList: "$digitalDeviceList", '
'digitalPlatformType: "$digitalPlatformType", '
'digitalSupportDeviceTypeList: $digitalSupportDeviceTypeList, '
'create: $createdAt, '
'lastModified: $lastModifiedAt'
')';
}
}

View File

@@ -1,54 +0,0 @@
/*
Firka, alternative e-Kréta client.
Copyright (C) 2025 QwIT Development
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
class TokenGrantResponse {
final String idToken;
final String accessToken;
final int expiresIn;
final String tokenType;
final String refreshToken;
final String scope;
TokenGrantResponse(
{required this.idToken,
required this.accessToken,
required this.expiresIn,
required this.tokenType,
required this.refreshToken,
required this.scope});
factory TokenGrantResponse.fromJson(Map<String, dynamic> json) {
return TokenGrantResponse(
idToken: json['id_token'],
accessToken: json['access_token'],
expiresIn: json['expires_in'],
tokenType: json['token_type'],
refreshToken: json['refresh_token'],
scope: json['scope']);
}
@override
String toString() {
return 'TokenGrant(idToken: "$idToken", accessToken: "$accessToken", '
'expiresIn: $expiresIn, '
'tokenType: "$tokenType", '
'refreshToken: "$refreshToken", '
'scope: "$scope"'
')';
}
}

View File

@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import '../l10n/app_localizations.dart';
import 'api/model/timetable.dart';
import 'package:kreta_api/kreta_api.dart';
import 'debug_helper.dart';
extension IterableExtensionMap on Iterable<MapEntry<String, dynamic>> {
@@ -41,11 +41,14 @@ enum Cycle { morning, day, afternoon, night }
extension DateExtension on DateTime {
String format(BuildContext context, FormatMode mode) {
var today = timeNow();
today = today.subtract(Duration(
today = today.subtract(
Duration(
hours: today.hour,
minutes: today.minute,
seconds: today.second,
milliseconds: today.millisecond));
milliseconds: today.millisecond,
),
);
var tomorrowLim = today.add(Duration(days: 2));
var tomorrow = today.add(Duration(days: 1));
@@ -86,11 +89,14 @@ extension DateExtension on DateTime {
}
DateTime getMidnight() {
return subtract(Duration(
return subtract(
Duration(
hours: hour,
minutes: minute,
seconds: second,
milliseconds: millisecond));
milliseconds: millisecond,
),
);
}
Cycle getDayCycle() {
@@ -117,22 +123,28 @@ extension DateGrouper<T> on Iterable<T> {
Map<DateTime, List<T>> newList = {};
var today = timeNow();
today = today.subtract(Duration(
today = today.subtract(
Duration(
hours: today.hour,
minutes: today.minute,
seconds: today.second,
milliseconds: today.millisecond));
milliseconds: today.millisecond,
),
);
var tomorrow = today.add(Duration(days: 1));
var yesterday = today.subtract(Duration(days: 1));
for (var elem in this) {
var date = getDate(elem);
var day = date.subtract(Duration(
var day = date.subtract(
Duration(
hours: date.hour,
minutes: date.minute,
seconds: date.second,
milliseconds: date.millisecond));
milliseconds: date.millisecond,
),
);
if (date.isAfter(tomorrow.add(Duration(days: 1)))) {
if (newList[day] == null) {
@@ -178,16 +190,19 @@ extension LessonExtension on List<Lesson> {
Lesson? getCurrentLesson(DateTime now) {
return firstWhereOrNull(
(lesson) => now.isAfter(lesson.start) && now.isBefore(lesson.end));
(lesson) => now.isAfter(lesson.start) && now.isBefore(lesson.end),
);
}
Lesson? getPrevLesson(DateTime now) {
return firstWhereOrNull(
(lesson) => lesson.end.isBefore(now.add(Duration(milliseconds: 1))));
(lesson) => lesson.end.isBefore(now.add(Duration(milliseconds: 1))),
);
}
Lesson? getNextLesson(DateTime now) {
return firstWhereOrNull(
(lesson) => lesson.start.isAfter(now.add(Duration(milliseconds: 1))));
(lesson) => lesson.start.isAfter(now.add(Duration(milliseconds: 1))),
);
}
}

View File

@@ -34,7 +34,7 @@ enum ClassIcon {
linux,
database,
applications,
project
project,
}
Map<ClassIcon, RegExp> _descriptors = {
@@ -49,8 +49,9 @@ Map<ClassIcon, RegExp> _descriptors = {
ClassIcon.pe: RegExp(r'^tes(i|tneveles)|sport|edzeselmelet'),
ClassIcon.chemistry: RegExp(r'kemia'),
ClassIcon.biology: RegExp(r'biologia'),
ClassIcon.env:
RegExp(r'kornyezet|termeszet ?(tudomany|ismeret)|hon( es nep)?ismeret'),
ClassIcon.env: RegExp(
r'kornyezet|termeszet ?(tudomany|ismeret)|hon( es nep)?ismeret',
),
ClassIcon.religion: RegExp(r'(hit|erkolcs)tan|vallas|etika|bibliaismeret'),
ClassIcon.economics: RegExp(r'penzugy|gazdasag'),
ClassIcon.it: RegExp(r'informatika|szoftver|iroda|digitalis'),
@@ -66,12 +67,13 @@ Map<ClassIcon, RegExp> _descriptors = {
ClassIcon.ofo: RegExp(r'osztaly(fonoki|kozosseg)|kozossegi|neveles'),
ClassIcon.diligence: RegExp(r'szorgalom'),
ClassIcon.attitude: RegExp(r'magatartas'),
ClassIcon.language:
RegExp(r'angol|nemet|francia|olasz|orosz|spanyol|latin|kinai|nyelv'),
ClassIcon.language: RegExp(
r'angol|nemet|francia|olasz|orosz|spanyol|latin|kinai|nyelv',
),
ClassIcon.linux: RegExp(r'linux'),
ClassIcon.database: RegExp(r'adatbazis.*'),
ClassIcon.applications: RegExp(r'asztali alkalmazasok'),
ClassIcon.project: RegExp(r'projekt')
ClassIcon.project: RegExp(r'projekt'),
};
Map<ClassIcon, Uint8List> _iconMap = {
@@ -117,17 +119,19 @@ ClassIcon? getIconType(String uid, String className, String category) {
if (icon == null) {
for (var desc in _descriptors.entries) {
if (desc.value.hasMatch(className
.replaceAll("ö", "o")
.replaceAll("ü", "u")
.replaceAll("ó", "o")
.replaceAll("ő", "o")
.replaceAll("ú", "u")
.replaceAll("é", "e")
.replaceAll("á", "a")
.replaceAll("ű", "u")
.replaceAll("í", "i")
.toLowerCase())) {
if (desc.value.hasMatch(
className
.replaceAll("ö", "o")
.replaceAll("ü", "u")
.replaceAll("ó", "o")
.replaceAll("ő", "o")
.replaceAll("ú", "u")
.replaceAll("é", "e")
.replaceAll("á", "a")
.replaceAll("ű", "u")
.replaceAll("í", "i")
.toLowerCase(),
)) {
icon = desc.key;
break;

View File

@@ -3,8 +3,7 @@ import 'dart:io';
import 'package:path_provider/path_provider.dart';
import 'package:firka_wear/helpers/api/model/grade.dart';
import 'package:firka_wear/helpers/api/model/timetable.dart';
import 'package:kreta_api/kreta_api.dart';
const String _syncFileName = 'wear_sync_data.json';

View File

@@ -1,4 +1,4 @@
import 'package:firka_wear/helpers/api/model/grade.dart';
import 'package:kreta_api/kreta_api.dart';
import 'package:flutter/material.dart';
import '../../ui/model/style.dart';
@@ -18,8 +18,9 @@ class GradeWidget extends StatelessWidget {
if (grade.valueType.name == "Szazalekos") {
gradeStr = grade.strValue.replaceAll("%", "");
if (grade.numericValue != null) {
gradeColor =
getGradeColor(percentageToGrade(grade.numericValue!).toDouble());
gradeColor = getGradeColor(
percentageToGrade(grade.numericValue!).toDouble(),
);
}
if (grade.numericValue != null && grade.numericValue == 100) {
@@ -29,10 +30,14 @@ class GradeWidget extends StatelessWidget {
color: gradeColor.withAlpha(38),
child: Padding(
padding: EdgeInsets.only(left: 8, right: 8),
child: Row(children: [
Text("100", // TODO: Make this curved
style: appStyle.fonts.P_14.copyWith(color: gradeColor))
]),
child: Row(
children: [
Text(
"100", // TODO: Make this curved
style: appStyle.fonts.P_14.copyWith(color: gradeColor),
),
],
),
),
);
} else {
@@ -42,11 +47,18 @@ class GradeWidget extends StatelessWidget {
color: gradeColor.withAlpha(38),
child: Padding(
padding: EdgeInsets.only(left: 8, right: 8),
child: Row(children: [
Text(gradeStr,
style: appStyle.fonts.P_14.copyWith(color: gradeColor)),
Text("%", style: appStyle.fonts.P_12.copyWith(color: gradeColor))
]),
child: Row(
children: [
Text(
gradeStr,
style: appStyle.fonts.P_14.copyWith(color: gradeColor),
),
Text(
"%",
style: appStyle.fonts.P_12.copyWith(color: gradeColor),
),
],
),
),
);
}
@@ -60,10 +72,15 @@ class GradeWidget extends StatelessWidget {
shadowColor: Colors.transparent,
color: gradeColor.withAlpha(38),
child: Padding(
padding: EdgeInsets.only(left: 8, right: 8),
child: Text(gradeStr,
style: appStyle.fonts.H_H1
.copyWith(fontSize: 24, color: gradeColor))),
padding: EdgeInsets.only(left: 8, right: 8),
child: Text(
gradeStr,
style: appStyle.fonts.H_H1.copyWith(
fontSize: 24,
color: gradeColor,
),
),
),
);
}
}

View File

@@ -1,8 +1,7 @@
import 'dart:ui';
import '../../ui/model/style.dart';
import '../api/model/grade.dart';
import '../api/model/subject.dart';
import 'package:kreta_api/kreta_api.dart';
int roundGrade(double grade) {
if (grade < 2) {

View File

@@ -9,15 +9,16 @@ abstract class StatelessAsyncWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return FutureBuilder<Widget>(
future: buildAsync(context),
builder: (BuildContext context, AsyncSnapshot<Widget> snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(child: DelayedSpinnerWidget());
} else if (snapshot.hasError) {
return Center(child: Text('Error: ${snapshot.error}'));
} else {
return snapshot.data!;
}
});
future: buildAsync(context),
builder: (BuildContext context, AsyncSnapshot<Widget> snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(child: DelayedSpinnerWidget());
} else if (snapshot.hasError) {
return Center(child: Text('Error: ${snapshot.error}'));
} else {
return snapshot.data!;
}
},
);
}
}

View File

@@ -155,27 +155,30 @@ final _defaultFonts = FirkaFonts(
fontVariations: [FontVariation("wght", 600)],
),
B_16R: TextStyle(
fontSize: 16,
fontFamily: 'Figtree',
fontVariations: [FontVariation("wght", 600)]),
fontSize: 16,
fontFamily: 'Figtree',
fontVariations: [FontVariation("wght", 600)],
),
B_16SB: TextStyle(
fontSize: 16,
fontFamily: 'Figtree',
fontVariations: [FontVariation("wght", 700)],
),
B_14R: TextStyle(
fontSize: 14,
fontFamily: 'Figtree',
fontVariations: [FontVariation("wght", 600)]),
fontSize: 14,
fontFamily: 'Figtree',
fontVariations: [FontVariation("wght", 600)],
),
B_14SB: TextStyle(
fontSize: 14,
fontFamily: 'Figtree',
fontVariations: [FontVariation("wght", 700)],
),
B_12R: TextStyle(
fontSize: 12,
fontFamily: 'Figtree',
fontVariations: [FontVariation("wght", 600)]),
fontSize: 12,
fontFamily: 'Figtree',
fontVariations: [FontVariation("wght", 600)],
),
B_12SB: TextStyle(
fontSize: 12,
fontFamily: 'Figtree',
@@ -194,70 +197,72 @@ final _defaultFonts = FirkaFonts(
);
final FirkaStyle lightStyle = FirkaStyle(
colors: FirkaColors(
background: Color(0xFFFAFFF0),
backgroundAmoled: Colors.black,
background0p: Color(0x00fafff0),
success: Color(0xFF92EA3B),
shadowBlur: 2,
textPrimary: Color(0xFF394C0A),
textSecondary: Color(0xCC394C0A),
textTertiary: Color(0x80394C0A),
card: Color(0xFFF3FBDE),
cardTranslucent: Color(0x80F3FBDE),
buttonSecondaryFill: Color(0xFFFEFFFD),
accent: Color(0xFFA7DC22),
secondary: Color(0xFF6E8F1B),
shadowColor: Color(0x33647e22),
a15p: Color(0x26a7dc22),
warningAccent: Color(0xFFFFA046),
warningText: Color(0xFF8F531B),
warning15p: Color(0x26FFA046),
warningCard: Color(0xFFFAEBDC),
errorAccent: Color(0xFFFF54A1),
errorText: Color(0xFF8F1B4F),
error15p: Color(0x26FF54A1),
errorCard: Color(0xFFFADCE9),
grade5: Color(0xFF22CCAD),
grade4: Color(0xFF92EA3B),
grade3: Color(0xFFF9CF00),
grade2: Color(0xFFFFA046),
grade1: Color(0xFFFF54A1),
),
fonts: _defaultFonts);
colors: FirkaColors(
background: Color(0xFFFAFFF0),
backgroundAmoled: Colors.black,
background0p: Color(0x00fafff0),
success: Color(0xFF92EA3B),
shadowBlur: 2,
textPrimary: Color(0xFF394C0A),
textSecondary: Color(0xCC394C0A),
textTertiary: Color(0x80394C0A),
card: Color(0xFFF3FBDE),
cardTranslucent: Color(0x80F3FBDE),
buttonSecondaryFill: Color(0xFFFEFFFD),
accent: Color(0xFFA7DC22),
secondary: Color(0xFF6E8F1B),
shadowColor: Color(0x33647e22),
a15p: Color(0x26a7dc22),
warningAccent: Color(0xFFFFA046),
warningText: Color(0xFF8F531B),
warning15p: Color(0x26FFA046),
warningCard: Color(0xFFFAEBDC),
errorAccent: Color(0xFFFF54A1),
errorText: Color(0xFF8F1B4F),
error15p: Color(0x26FF54A1),
errorCard: Color(0xFFFADCE9),
grade5: Color(0xFF22CCAD),
grade4: Color(0xFF92EA3B),
grade3: Color(0xFFF9CF00),
grade2: Color(0xFFFFA046),
grade1: Color(0xFFFF54A1),
),
fonts: _defaultFonts,
);
final FirkaStyle darkStyle = FirkaStyle(
colors: FirkaColors(
background: Color(0xFF0D1202),
backgroundAmoled: Colors.black,
background0p: Color(0x00fafff0),
success: Color(0xFF92EA3B),
shadowBlur: 0,
textPrimary: Color(0xFFEAF7CC),
textSecondary: Color(0xB3EAF7CC),
textTertiary: Color(0x80EAF7CC),
card: Color(0xFF141905),
cardTranslucent: Color(0x80141905),
buttonSecondaryFill: Color(0xFF20290B),
accent: Color(0xFFA7DC22),
secondary: Color(0xFFCBEE71),
shadowColor: Color(0x26CBEE71),
a15p: Color(0x26A7DC22),
warningAccent: Color(0xFFFFA046),
warningText: Color(0xFFF0B37A),
warning15p: Color(0x26FFA046),
warningCard: Color(0xFF201203),
errorAccent: Color(0xFFFF54A1),
errorText: Color(0xFFF59EC5),
error15p: Color(0x26FF54A1),
errorCard: Color(0xFF1E030F),
grade5: Color(0xFF22CCAD),
grade4: Color(0xFF92EA3B),
grade3: Color(0xFFF9CF00),
grade2: Color(0xFFFFA046),
grade1: Color(0xFFFF54A1),
),
fonts: _defaultFonts);
colors: FirkaColors(
background: Color(0xFF0D1202),
backgroundAmoled: Colors.black,
background0p: Color(0x00fafff0),
success: Color(0xFF92EA3B),
shadowBlur: 0,
textPrimary: Color(0xFFEAF7CC),
textSecondary: Color(0xB3EAF7CC),
textTertiary: Color(0x80EAF7CC),
card: Color(0xFF141905),
cardTranslucent: Color(0x80141905),
buttonSecondaryFill: Color(0xFF20290B),
accent: Color(0xFFA7DC22),
secondary: Color(0xFFCBEE71),
shadowColor: Color(0x26CBEE71),
a15p: Color(0x26A7DC22),
warningAccent: Color(0xFFFFA046),
warningText: Color(0xFFF0B37A),
warning15p: Color(0x26FFA046),
warningCard: Color(0xFF201203),
errorAccent: Color(0xFFFF54A1),
errorText: Color(0xFFF59EC5),
error15p: Color(0x26FF54A1),
errorCard: Color(0xFF1E030F),
grade5: Color(0xFF22CCAD),
grade4: Color(0xFF92EA3B),
grade3: Color(0xFFF9CF00),
grade2: Color(0xFFFFA046),
grade1: Color(0xFFFF54A1),
),
fonts: _defaultFonts,
);
FirkaStyle appStyle = lightStyle;
FirkaStyle wearStyle = darkStyle;

View File

@@ -1,8 +1,7 @@
import 'dart:async';
import 'dart:math';
import 'package:firka_wear/helpers/api/model/grade.dart';
import 'package:firka_wear/helpers/api/model/timetable.dart';
import 'package:kreta_api/kreta_api.dart';
import 'package:firka_wear/helpers/extensions.dart';
import 'package:firka_wear/ui/widget/class_icon.dart';
import 'package:firka_wear/main.dart';

View File

@@ -2,8 +2,7 @@
import 'dart:async';
import 'package:firka_wear/helpers/api/model/grade.dart';
import 'package:firka_wear/helpers/api/model/timetable.dart';
import 'package:kreta_api/kreta_api.dart';
import 'package:firka_wear/helpers/extensions.dart';
import 'package:flutter/material.dart';
import 'package:watch_connectivity/watch_connectivity.dart';

View File

@@ -34,8 +34,10 @@ class _CircularProgressIndicatorWidgetState
duration: const Duration(milliseconds: 500),
vsync: this,
);
_animation =
Tween<double>(begin: 0.0, end: widget.progress).animate(_controller);
_animation = Tween<double>(
begin: 0.0,
end: widget.progress,
).animate(_controller);
_controller.forward();
}

View File

@@ -10,22 +10,26 @@ class ClassIconWidget extends StatelessWidget {
final Color color;
final double? size;
const ClassIconWidget(
{super.key,
required String uid,
required String className,
required String category,
this.color = Colors.white,
this.size})
: _className = className,
_uid = uid,
_category = category;
const ClassIconWidget({
super.key,
required String uid,
required String className,
required String category,
this.color = Colors.white,
this.size,
}) : _className = className,
_uid = uid,
_category = category;
@override
Widget build(BuildContext context) {
var iconCategory = getIconType(_uid, _className, _category);
return FirkaIconWidget(FirkaIconType.Majesticons, getIconData(iconCategory),
color: color, size: size);
return FirkaIconWidget(
FirkaIconType.Majesticons,
getIconData(iconCategory),
color: color,
size: size,
);
}
}

View File

@@ -14,10 +14,7 @@ class CounterDigitWidget extends StatelessWidget {
color: appStyle.colors.buttonSecondaryFill,
child: Padding(
padding: EdgeInsets.only(left: 8, right: 8, top: 4, bottom: 4),
child: Text(
c,
style: style,
),
child: Text(c, style: style),
),
);
}

View File

@@ -4,10 +4,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:majesticons_flutter/majesticons_flutter.dart';
enum FirkaIconType {
Majesticons,
MajesticonsLocal,
}
enum FirkaIconType { Majesticons, MajesticonsLocal }
class FirkaIconWidget extends StatelessWidget {
final FirkaIconType iconType;
@@ -15,8 +12,13 @@ class FirkaIconWidget extends StatelessWidget {
final Color color;
final double? size;
const FirkaIconWidget(this.iconType, this.iconData,
{super.key, this.color = Colors.white, this.size});
const FirkaIconWidget(
this.iconType,
this.iconData, {
super.key,
this.color = Colors.white,
this.size,
});
@override
Widget build(BuildContext context) {

View File

@@ -1,5 +1,4 @@
import 'package:firka_wear/helpers/api/model/grade.dart';
import 'package:firka_wear/helpers/api/model/subject.dart';
import 'package:kreta_api/kreta_api.dart';
import 'package:firka_wear/helpers/ui/firka_card.dart';
import 'package:firka_wear/helpers/ui/grade_helpers.dart';
import 'package:firka_wear/ui/widget/class_icon.dart';
@@ -12,41 +11,50 @@ class GradeSmallCard extends FirkaCard {
final Subject subject;
GradeSmallCard(this.grades, this.subject, {super.key})
: super(left: [
: super(
left: [
ClassIconWidget(
uid: subject.uid,
className: subject.name,
category: subject.category.name!,
color: appStyle.colors.accent,
),
SizedBox(
width: 4,
),
SizedBox(width: 4),
SizedBox(
width: 200,
child: Text(
subject.name,
style: appStyle.fonts.B_16SB
.apply(color: appStyle.colors.textPrimary),
style: appStyle.fonts.B_16SB.apply(
color: appStyle.colors.textPrimary,
),
),
),
], right: [
],
right: [
grades.getAverageBySubject(subject).isNaN
? SizedBox()
: Card(
shadowColor: Colors.transparent,
color: getGradeColor(grades.getAverageBySubject(subject))
.withAlpha(38),
color: getGradeColor(
grades.getAverageBySubject(subject),
).withAlpha(38),
child: Padding(
padding:
EdgeInsets.only(left: 8, right: 8, top: 4, bottom: 4),
padding: EdgeInsets.only(
left: 8,
right: 8,
top: 4,
bottom: 4,
),
child: Text(
grades.getAverageBySubject(subject).toStringAsFixed(2),
style: appStyle.fonts.B_16SB.apply(
color: getGradeColor(
grades.getAverageBySubject(subject))),
color: getGradeColor(
grades.getAverageBySubject(subject),
),
),
),
),
),
]);
],
);
}

View File

@@ -33,6 +33,8 @@ environment:
dependencies:
flutter:
sdk: flutter
kreta_api:
path: ../kreta_api
cupertino_icons: ^1.0.8
flutter_launcher_icons: ^0.14.3