fixed end-year average
This commit is contained in:
parent
acdd47a49a
commit
3317472773
@ -12,6 +12,7 @@ import 'package:filcnaplo_mobile_ui/screens/summary/summary_screen.i18n.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:auto_size_text/auto_size_text.dart';
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
|
import 'package:i18n_extension/i18n_widget.dart';
|
||||||
|
|
||||||
List<String> faces = [
|
List<String> faces = [
|
||||||
"(·.·)",
|
"(·.·)",
|
||||||
@ -39,6 +40,8 @@ class _GradesBodyState extends State<GradesBody> {
|
|||||||
late SettingsProvider settings;
|
late SettingsProvider settings;
|
||||||
|
|
||||||
late double subjectAvg;
|
late double subjectAvg;
|
||||||
|
late double endYearAvg;
|
||||||
|
late String endYearAvgText;
|
||||||
|
|
||||||
List<Widget> subjectTiles5 = [];
|
List<Widget> subjectTiles5 = [];
|
||||||
List<Widget> subjectTiles3 = [];
|
List<Widget> subjectTiles3 = [];
|
||||||
@ -136,7 +139,7 @@ class _GradesBodyState extends State<GradesBody> {
|
|||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: "\nno_grades".i18n,
|
text: "\n${'no_grades'.i18n}",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.0,
|
fontSize: 18.0,
|
||||||
height: 2.0,
|
height: 2.0,
|
||||||
@ -155,6 +158,15 @@ class _GradesBodyState extends State<GradesBody> {
|
|||||||
subjectAvgs.length
|
subjectAvgs.length
|
||||||
: 0.0;
|
: 0.0;
|
||||||
|
|
||||||
|
List<Grade> endYearGrades = gradeProvider.grades
|
||||||
|
.where((grade) => grade.type == GradeType.endYear)
|
||||||
|
.toList();
|
||||||
|
endYearAvg = AverageHelper.averageEvals(endYearGrades, finalAvg: true);
|
||||||
|
endYearAvgText = endYearAvg.toStringAsFixed(1);
|
||||||
|
if (I18n.of(context).locale.languageCode != "en") {
|
||||||
|
endYearAvgText = endYearAvgText.replaceAll(".", ",");
|
||||||
|
}
|
||||||
|
|
||||||
if (filter == 5) {
|
if (filter == 5) {
|
||||||
subjectTiles5 = List.castFrom(tiles);
|
subjectTiles5 = List.castFrom(tiles);
|
||||||
if (subjectTiles5.length > 4) {
|
if (subjectTiles5.length > 4) {
|
||||||
@ -316,10 +328,10 @@ class _GradesBodyState extends State<GradesBody> {
|
|||||||
padding:
|
padding:
|
||||||
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 4.0),
|
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 4.0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: gradeColor(context: context, value: subjectAvg)
|
color: gradeColor(context: context, value: endYearAvg)
|
||||||
.withOpacity(.2),
|
.withOpacity(.2),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: (gradeColor(context: context, value: subjectAvg))
|
color: (gradeColor(context: context, value: endYearAvg))
|
||||||
.withOpacity(0.0),
|
.withOpacity(0.0),
|
||||||
width: 2.0,
|
width: 2.0,
|
||||||
),
|
),
|
||||||
@ -327,13 +339,13 @@ class _GradesBodyState extends State<GradesBody> {
|
|||||||
),
|
),
|
||||||
child: AutoSizeText.rich(
|
child: AutoSizeText.rich(
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: subjectAvg.toStringAsFixed(2),
|
text: endYearAvgText,
|
||||||
),
|
),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
minFontSize: 5,
|
minFontSize: 5,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: gradeColor(context: context, value: subjectAvg),
|
color: gradeColor(context: context, value: endYearAvg),
|
||||||
fontWeight: FontWeight.w800,
|
fontWeight: FontWeight.w800,
|
||||||
fontSize: 32.0,
|
fontSize: 32.0,
|
||||||
),
|
),
|
||||||
|
@ -3,9 +3,15 @@ import 'package:i18n_extension/i18n_extension.dart';
|
|||||||
extension SettingsLocalization on String {
|
extension SettingsLocalization on String {
|
||||||
static final _t = Translations.byLocale("hu_hu") +
|
static final _t = Translations.byLocale("hu_hu") +
|
||||||
{
|
{
|
||||||
"en_en": {},
|
"en_en": {
|
||||||
"hu_hu": {},
|
"no_grades": "No grades found",
|
||||||
"de_de": {},
|
},
|
||||||
|
"hu_hu": {
|
||||||
|
"no_grades": "Nincsenek jegyek",
|
||||||
|
},
|
||||||
|
"de_de": {
|
||||||
|
"no_grades": "No grades found",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
String get i18n => localize(this, _t);
|
String get i18n => localize(this, _t);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user