From e2812fb5843cbb3fa8d8d32c90f190b22c109c90 Mon Sep 17 00:00:00 2001 From: Liplum Date: Tue, 11 Jun 2024 18:36:10 +0800 Subject: [PATCH] [exam arrange] disqualified exam card --- lib/school/exam_arrange/widgets/exam.dart | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/school/exam_arrange/widgets/exam.dart b/lib/school/exam_arrange/widgets/exam.dart index ff00d1c12..10f92aa96 100644 --- a/lib/school/exam_arrange/widgets/exam.dart +++ b/lib/school/exam_arrange/widgets/exam.dart @@ -20,15 +20,19 @@ class ExamCardContent extends StatelessWidget { @override Widget build(BuildContext context) { final time = exam.time; - final titleColor = exam.disqualified ? context.$red$ : null; + final disqualifiedColor = exam.disqualified ? context.$red$ : null; return [ [ - exam.courseName.text(style: context.textTheme.titleMedium?.copyWith(color: titleColor)), + "${exam.courseName}${exam.disqualified ? " | Disqualified" : ""}" + .text(style: context.textTheme.titleMedium?.copyWith(color: disqualifiedColor)), if (exam.isRetake) Chip(label: i18n.retake.text(), elevation: 2), ].row(maa: MainAxisAlignment.spaceBetween), - Divider(color: context.colorScheme.onSurfaceVariant), + Divider(color: disqualifiedColor ?? context.colorScheme.onSurfaceVariant), ExamEntryDetailsTable(exam), - if (enableAddEvent && time != null && (UniversalPlatform.isAndroid || UniversalPlatform.isIOS)) ...[ + if (!exam.disqualified && + enableAddEvent && + time != null && + (UniversalPlatform.isAndroid || UniversalPlatform.isIOS)) ...[ Divider(color: context.colorScheme.onSurfaceVariant), buildAddToCalenderAction(), ], @@ -56,7 +60,8 @@ class ExamEntryDetailsTable extends StatelessWidget { @override Widget build(BuildContext context) { - final style = context.textTheme.bodyMedium; + final disqualifiedColor = exam.disqualified ? context.$red$ : null; + final style = context.textTheme.bodyMedium?.copyWith(color: disqualifiedColor); final time = exam.time; return Table( children: [