From 08f691d55930c826ae71788d4493b1008c23a0d7 Mon Sep 17 00:00:00 2001 From: checkedear <271323618+checkedear@users.noreply.github.com> Date: Tue, 21 Apr 2026 22:36:30 +0200 Subject: [PATCH] fix: subject card design --- .../lib/ui/phone/pages/home/home_grades.dart | 8 +- .../lib/ui/shared/grade_small_card.dart | 80 ++++++++++--------- 2 files changed, 49 insertions(+), 39 deletions(-) diff --git a/firka/lib/ui/phone/pages/home/home_grades.dart b/firka/lib/ui/phone/pages/home/home_grades.dart index 331aa96..e93a0fa 100644 --- a/firka/lib/ui/phone/pages/home/home_grades.dart +++ b/firka/lib/ui/phone/pages/home/home_grades.dart @@ -285,7 +285,7 @@ class _HomeGradesScreen extends FirkaState { grades: gradesForCalculation, l10n: widget.data.l10n, ), - SizedBox(height: 12), + SizedBox(height: 20), Expanded( child: ListView( children: [ @@ -296,7 +296,11 @@ class _HomeGradesScreen extends FirkaState { ), ), SizedBox(height: 16), - ...gradeCards, + Column( + spacing: 16, + mainAxisSize: MainAxisSize.min, + children: gradeCards, + ), SizedBox(height: 16), Text( widget.data.l10n.data, diff --git a/firka_common/lib/ui/shared/grade_small_card.dart b/firka_common/lib/ui/shared/grade_small_card.dart index d4b0f51..b2a2ec7 100644 --- a/firka_common/lib/ui/shared/grade_small_card.dart +++ b/firka_common/lib/ui/shared/grade_small_card.dart @@ -16,49 +16,55 @@ class GradeSmallCard extends StatelessWidget { @override Widget build(BuildContext context) { - return FirkaCard( - left: [ - ClassIconWidget( - uid: subject.uid, - className: subject.name, - category: subject.category.name!, - color: appStyle.colors.accent, - ), - const SizedBox(width: 4), - SizedBox( - width: 200, - child: Text( - subject.name, - style: appStyle.fonts.B_16SB.apply( - color: appStyle.colors.textPrimary, + return FirkaCard.single( + height: 52, + padding: EdgeInsets.symmetric(horizontal: 16), + margin: EdgeInsets.all(0), + child: Row( + spacing: 8, + children: [ + ClassIconWidget( + uid: subject.uid, + className: subject.name, + category: subject.category.name!, + color: appStyle.colors.accent, + size: 20, + ), + Expanded( + child: Text( + subject.name, + style: appStyle.fonts.B_16SB.apply( + color: appStyle.colors.textPrimary, + ), + overflow: TextOverflow.ellipsis, ), ), - ), - ], - right: [ - grades.getAverageBySubject(subject).isNaN - ? const SizedBox() - : Card( - shadowColor: Colors.transparent, - color: getGradeColor( - grades.getAverageBySubject(subject), - ).withAlpha(38), - child: Padding( - padding: const EdgeInsets.only( - left: 8, - right: 8, - top: 4, - bottom: 4, + grades.getAverageBySubject(subject).isNaN + ? const SizedBox() + : Container( + width: 48, + height: 26, + decoration: ShapeDecoration( + color: getGradeColor( + grades.getAverageBySubject(subject), + ).withAlpha(38), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), ), - child: Text( - grades.getAverageBySubject(subject).toStringAsFixed(2), - style: appStyle.fonts.B_16SB.apply( - color: getGradeColor(grades.getAverageBySubject(subject)), + child: Center( + child: Text( + grades.getAverageBySubject(subject).toStringAsFixed(2), + style: appStyle.fonts.B_16R.apply( + color: getGradeColor( + grades.getAverageBySubject(subject), + ), + ), ), ), ), - ), - ], + ], + ), ); } }