forked from firka/student-legacy
finished personalities map
This commit is contained in:
parent
f9e14349b7
commit
fe0a7d81ae
BIN
filcnaplo/assets/images/card_border.png
Normal file
BIN
filcnaplo/assets/images/card_border.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
@ -35,8 +35,7 @@ class _PersonalityCardState extends State<PersonalityCard> {
|
|||||||
late Map<Subject, double> subjectAvgs = {};
|
late Map<Subject, double> subjectAvgs = {};
|
||||||
late double subjectAvg;
|
late double subjectAvg;
|
||||||
late List<Grade> classWorkGrades;
|
late List<Grade> classWorkGrades;
|
||||||
late int mostCommonGrade;
|
late Map<int, int> mostCommonGrade;
|
||||||
late int onesCount;
|
|
||||||
late List<Absence> absences = [];
|
late List<Absence> absences = [];
|
||||||
late List<Absence> delays = [];
|
late List<Absence> delays = [];
|
||||||
final Map<Subject, Lesson> _lessonCount = {};
|
final Map<Subject, Lesson> _lessonCount = {};
|
||||||
@ -129,8 +128,7 @@ class _PersonalityCardState extends State<PersonalityCard> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mostCommonGrade = maxKey;
|
mostCommonGrade = {maxKey: maxValue};
|
||||||
onesCount = counts.values.toList()[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void getAbsences() {
|
void getAbsences() {
|
||||||
@ -154,7 +152,8 @@ class _PersonalityCardState extends State<PersonalityCard> {
|
|||||||
finalPersonality = PersonalityType.cheater;
|
finalPersonality = PersonalityType.cheater;
|
||||||
} else if (subjectAvg > 4.7) {
|
} else if (subjectAvg > 4.7) {
|
||||||
finalPersonality = PersonalityType.geek;
|
finalPersonality = PersonalityType.geek;
|
||||||
} else if (onesCount > 1) {
|
} else if (mostCommonGrade.keys.toList()[0] == 1 &&
|
||||||
|
mostCommonGrade.values.toList()[0] > 1) {
|
||||||
finalPersonality = PersonalityType.fallible;
|
finalPersonality = PersonalityType.fallible;
|
||||||
} else if (absences.length < 10) {
|
} else if (absences.length < 10) {
|
||||||
finalPersonality = PersonalityType.healthy;
|
finalPersonality = PersonalityType.healthy;
|
||||||
@ -171,9 +170,9 @@ class _PersonalityCardState extends State<PersonalityCard> {
|
|||||||
finalPersonality = PersonalityType.late;
|
finalPersonality = PersonalityType.late;
|
||||||
} else if (absences.length >= 100) {
|
} else if (absences.length >= 100) {
|
||||||
finalPersonality = PersonalityType.sick;
|
finalPersonality = PersonalityType.sick;
|
||||||
} else if (mostCommonGrade == 2) {
|
} else if (mostCommonGrade.keys.toList()[0] == 2) {
|
||||||
finalPersonality = PersonalityType.acceptable;
|
finalPersonality = PersonalityType.acceptable;
|
||||||
} else if (mostCommonGrade == 3) {
|
} else if (mostCommonGrade.keys.toList()[0] == 3) {
|
||||||
finalPersonality = PersonalityType.average;
|
finalPersonality = PersonalityType.average;
|
||||||
} else if (classWorkGrades.length >= 5) {
|
} else if (classWorkGrades.length >= 5) {
|
||||||
finalPersonality = PersonalityType.diligent;
|
finalPersonality = PersonalityType.diligent;
|
||||||
@ -182,11 +181,134 @@ class _PersonalityCardState extends State<PersonalityCard> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget cardInnerBuilder() {
|
||||||
|
Map<PersonalityType, String> emoji = {PersonalityType.geek: '🤓'};
|
||||||
|
Map<PersonalityType, Map<String, String>> 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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
doEverything();
|
doEverything();
|
||||||
getPersonality();
|
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(),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user