diff --git a/filcnaplo/assets/images/card_border.png b/filcnaplo/assets/images/card_border.png new file mode 100644 index 0000000..5df72be Binary files /dev/null and b/filcnaplo/assets/images/card_border.png differ diff --git a/filcnaplo_mobile_ui/lib/common/personality_card/personality_card.dart b/filcnaplo_mobile_ui/lib/common/personality_card/personality_card.dart index e166414..0f53014 100644 --- a/filcnaplo_mobile_ui/lib/common/personality_card/personality_card.dart +++ b/filcnaplo_mobile_ui/lib/common/personality_card/personality_card.dart @@ -35,8 +35,7 @@ class _PersonalityCardState extends State { late Map subjectAvgs = {}; late double subjectAvg; late List classWorkGrades; - late int mostCommonGrade; - late int onesCount; + late Map mostCommonGrade; late List absences = []; late List delays = []; final Map _lessonCount = {}; @@ -129,8 +128,7 @@ class _PersonalityCardState extends State { } }); - mostCommonGrade = maxKey; - onesCount = counts.values.toList()[0]; + mostCommonGrade = {maxKey: maxValue}; } void getAbsences() { @@ -154,7 +152,8 @@ class _PersonalityCardState extends State { finalPersonality = PersonalityType.cheater; } else if (subjectAvg > 4.7) { finalPersonality = PersonalityType.geek; - } else if (onesCount > 1) { + } else if (mostCommonGrade.keys.toList()[0] == 1 && + mostCommonGrade.values.toList()[0] > 1) { finalPersonality = PersonalityType.fallible; } else if (absences.length < 10) { finalPersonality = PersonalityType.healthy; @@ -171,9 +170,9 @@ class _PersonalityCardState extends State { finalPersonality = PersonalityType.late; } else if (absences.length >= 100) { finalPersonality = PersonalityType.sick; - } else if (mostCommonGrade == 2) { + } else if (mostCommonGrade.keys.toList()[0] == 2) { finalPersonality = PersonalityType.acceptable; - } else if (mostCommonGrade == 3) { + } else if (mostCommonGrade.keys.toList()[0] == 3) { finalPersonality = PersonalityType.average; } else if (classWorkGrades.length >= 5) { finalPersonality = PersonalityType.diligent; @@ -182,11 +181,134 @@ class _PersonalityCardState extends State { } } + Widget cardInnerBuilder() { + Map emoji = {PersonalityType.geek: '🤓'}; + Map> personality = { + PersonalityType.geek: { + 'emoji': '🤓', + 'title': 'Stréber', + 'description': + 'Sokat tanulsz, de ezzel semmi baj! Ez egyben áldás és átok, de legalább az életben sikeres leszel.', + 'subtitle': 'Év végi átlagod', + 'subvalue': subjectAvg.toStringAsFixed(2), + }, + PersonalityType.sick: { + 'emoji': '🤒', + 'title': 'Beteges', + 'description': + 'Jobbulást, tesó. Még akkor is, ha hazudtál arról, hogy beteg vagy, hogy ne kelljen suliba menned.', + 'subtitle': 'Hiányzásaid', + 'subvalue': absences.length.toString(), + }, + PersonalityType.late: { + 'emoji': '⌛', + 'title': 'Késős', + 'description': + 'Kilukadt a villamos kereke. Kisiklott a repülő. A kutyád megette a cipőd. Elhisszük.', + 'subtitle': 'Késésed (perc)', + 'subvalue': (absences.where( + (a) => a.state == Justification.unexcused && a.delay > 0)) + .map((e) => e.delay) + .reduce((a, b) => a + b) + .toString(), + }, + PersonalityType.quitter: { + 'emoji': '❓', + 'title': 'Lógós', + 'description': 'Osztályzóvizsga incoming.', + 'subtitle': 'Igazolatlan hiányzások', + 'subvalue': (absences.where( + (a) => a.state == Justification.unexcused && a.delay == 0)) + .length + .toString(), + }, + PersonalityType.healthy: { + 'emoji': '😷', + 'title': 'Makk', + 'description': + '...egészséges vagy! Egész évben alig hiányoztál az iskolából.', + 'subtitle': 'Hiányzásaid', + 'subvalue': absences.length.toString(), + }, + PersonalityType.acceptable: { + 'emoji': '🤏', + 'title': 'Elmegy', + 'description': + 'A kettes érettségi is érettségi. Nem egy jó érettségi, de biztos, hogy egy érettségi.', + 'subtitle': 'Kettesek', + 'subvalue': mostCommonGrade.values.toList()[0].toString(), + }, + PersonalityType.fallible: { + 'emoji': '📉', + 'title': 'Bukós', + 'description': 'Jövőre több sikerrel jársz.', + 'subtitle': 'Karók', + 'subvalue': mostCommonGrade.values.toList()[0].toString(), + }, + PersonalityType.average: { + 'emoji': '👌', + 'title': 'Közepes', + 'description': 'Se jó, se rossz. Az arany középút, if you will.', + 'subtitle': 'Hármasok', + 'subvalue': mostCommonGrade.values.toList()[0].toString(), + }, + PersonalityType.diligent: { + 'emoji': '💫', + 'title': 'Szorgalmas', + 'description': + 'Leírtad a jegyzetet, megcsináltad a prezentációt, és te vezetted a projektmunkát.', + 'subtitle': 'Órai munka ötösök', + 'subvalue': classWorkGrades.length.toString(), + }, + PersonalityType.cheater: { + 'emoji': '‍🧑‍💻', + 'title': 'Csaló', + 'description': + 'Bekapcsoltad a “Jó Tanuló” módot. Wow. Azt hitted, outsmartolhatsz, de outsmartingoltam az outsmartingolásod.', + 'subtitle': 'Bitches', + 'subvalue': '0', + }, + PersonalityType.npc: { + 'emoji': '⛰️', + 'title': 'NPC', + 'description': + 'Egy akkora nagy non-player character vagy, hogy neked semmilyen személyiség nem jutott ezen kívül.', + 'subtitle': 'In-game playtime (óra)', + 'subvalue': '69420', + } + }; + + for (var i in personality.keys) { + Widget w = Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + personality[i.name]?['emoji'] ?? '⛰️', + style: const TextStyle(fontSize: 128), + ) + ], + ); + } + return Container(); + } + @override Widget build(BuildContext context) { doEverything(); getPersonality(); - return Container(); + return Container( + decoration: const BoxDecoration(color: Color(0x600008FF)), + child: Container( + padding: const EdgeInsets.all(5), + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage('images/card_border.png'), + ), + ), + child: cardInnerBuilder(), + ), + ); } }