forked from firka/student-legacy
fix weird code
This commit is contained in:
parent
11d99a4cf9
commit
c6633be301
@ -251,17 +251,11 @@ Widget filterItemBuilder(
|
||||
: const EdgeInsets.symmetric(vertical: 4.0),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: index == 0
|
||||
borderRadius: BorderRadius.vertical(
|
||||
top: index == 0
|
||||
? const Radius.circular(16.0)
|
||||
: const Radius.circular(8.0),
|
||||
topRight: index == 0
|
||||
? const Radius.circular(16.0)
|
||||
: const Radius.circular(8.0),
|
||||
bottomLeft: index + 1 == len
|
||||
? const Radius.circular(16.0)
|
||||
: const Radius.circular(8.0),
|
||||
bottomRight: index + 1 == len
|
||||
bottom: index + 1 == len
|
||||
? const Radius.circular(16.0)
|
||||
: const Radius.circular(8.0),
|
||||
),
|
||||
|
@ -1,18 +1,23 @@
|
||||
import 'package:filcnaplo/ui/date_widget.dart';
|
||||
import 'package:filcnaplo_kreta_api/models/grade.dart';
|
||||
import 'package:filcnaplo_mobile_ui/common/widgets/cretification/certification_card.dart' as mobile;
|
||||
import 'package:filcnaplo_mobile_ui/common/widgets/cretification/certification_card.dart'
|
||||
as mobile;
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
List<DateWidget> getWidgets(List<Grade> providerGrades) {
|
||||
List<DateWidget> items = [];
|
||||
for (var gradeType in GradeType.values) {
|
||||
if ([GradeType.midYear, GradeType.unknown, GradeType.levelExam].contains(gradeType)) continue;
|
||||
if ([GradeType.midYear, GradeType.unknown, GradeType.levelExam]
|
||||
.contains(gradeType)) continue;
|
||||
|
||||
List<Grade> grades = providerGrades.where((grade) => grade.type == gradeType).toList();
|
||||
List<Grade> grades =
|
||||
providerGrades.where((grade) => grade.type == gradeType).toList();
|
||||
if (grades.isNotEmpty) {
|
||||
grades.sort((a, b) => -a.date.compareTo(b.date));
|
||||
|
||||
items.add(DateWidget(
|
||||
date: grades.first.date,
|
||||
key: 'certification${const Uuid().v4()}',
|
||||
widget: mobile.CertificationCard(
|
||||
grades,
|
||||
gradeType: gradeType,
|
||||
|
@ -8,7 +8,8 @@ import 'package:flutter_feather_icons/flutter_feather_icons.dart';
|
||||
import 'certification_card.i18n.dart';
|
||||
|
||||
class CertificationCard extends StatelessWidget {
|
||||
const CertificationCard(this.grades, {super.key, required this.gradeType, this.padding});
|
||||
const CertificationCard(this.grades,
|
||||
{super.key, required this.gradeType, this.padding});
|
||||
|
||||
final List<Grade> grades;
|
||||
final GradeType gradeType;
|
||||
@ -19,7 +20,9 @@ class CertificationCard extends StatelessWidget {
|
||||
String title = getGradeTypeTitle(gradeType);
|
||||
double average = AverageHelper.averageEvals(grades, finalAvg: true);
|
||||
String averageText = average.toStringAsFixed(1);
|
||||
if (I18n.of(context).locale.languageCode != "en") averageText = averageText.replaceAll(".", ",");
|
||||
if (I18n.of(context).locale.languageCode != "en") {
|
||||
averageText = averageText.replaceAll(".", ",");
|
||||
}
|
||||
Color color = gradeColor(context: context, value: average);
|
||||
Color textColor;
|
||||
|
||||
@ -30,7 +33,8 @@ class CertificationCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: padding ?? const EdgeInsets.symmetric(vertical: 2.0, horizontal: 8.0),
|
||||
padding:
|
||||
padding ?? const EdgeInsets.symmetric(vertical: 2.0, horizontal: 6.0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
@ -42,8 +46,10 @@ class CertificationCard extends StatelessWidget {
|
||||
type: MaterialType.transparency,
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
child: ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 4.0, horizontal: 16.0),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)),
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(vertical: 4.0, horizontal: 16.0),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12.0)),
|
||||
leading: Text(
|
||||
averageText,
|
||||
style: TextStyle(
|
||||
@ -73,7 +79,8 @@ class CertificationCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
trailing: Icon(FeatherIcons.arrowRight, color: textColor),
|
||||
onTap: () => CertificationView.show(grades, context: context, gradeType: gradeType),
|
||||
onTap: () => CertificationView.show(grades,
|
||||
context: context, gradeType: gradeType),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
Loading…
x
Reference in New Issue
Block a user