From 3c4c1d90efffc107ab9a20b489b1bb395b7303a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20T=C3=B6gel?= <71888952+TobiTgl@users.noreply.github.com> Date: Sun, 14 Apr 2024 20:54:11 +0200 Subject: [PATCH] Farbmarkierung richtig/falsch --- .../elements/quiz/single_choice_quiz.dart | 8 ++++++-- .../elements/quiz/single_choice_quiz_result.dart | 4 ++-- .../components/elements/quiz/yes_no_quiz.dart | 16 ++++++++++++---- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/frontend/lib/components/elements/quiz/single_choice_quiz.dart b/frontend/lib/components/elements/quiz/single_choice_quiz.dart index 80e2e8e..ea66e90 100644 --- a/frontend/lib/components/elements/quiz/single_choice_quiz.dart +++ b/frontend/lib/components/elements/quiz/single_choice_quiz.dart @@ -103,7 +103,9 @@ class _SingleChoiceQuizState extends State { side: BorderSide( color: widget.correctAnswers[0] == index.toString() ? Colors.green - : Colors.red, + : widget.correctAnswers[0] == _selection.toString() + ? Colors.grey + : Colors.red, width: selected ? 3.0 : 1.0, ), ), @@ -116,7 +118,9 @@ class _SingleChoiceQuizState extends State { decoration: BoxDecoration( color: widget.correctAnswers[0] == index.toString() ? Colors.green - : Colors.red, + : widget.correctAnswers[0] == _selection.toString() + ? Colors.grey + : Colors.red, shape: BoxShape.circle, ), child: Center( diff --git a/frontend/lib/components/elements/quiz/single_choice_quiz_result.dart b/frontend/lib/components/elements/quiz/single_choice_quiz_result.dart index 49d340c..9b5fb3b 100644 --- a/frontend/lib/components/elements/quiz/single_choice_quiz_result.dart +++ b/frontend/lib/components/elements/quiz/single_choice_quiz_result.dart @@ -88,7 +88,7 @@ class _SingleChoiceQuizResultState extends State { child: Text( optionDerivation.option, style: TextStyle( - color: correctAnswer ? Colors.green : Colors.red, + color: correctAnswer ? Colors.green : colors.onBackground, fontWeight: correctAnswer ? FontWeight.bold : FontWeight.normal, fontSize: 20, @@ -117,7 +117,7 @@ class _SingleChoiceQuizResultState extends State { value: optionDerivation.normalizedPercentage, backgroundColor: colors.secondary.withOpacity(0.1), valueColor: AlwaysStoppedAnimation( - correctAnswer ? Colors.green : Colors.red, + correctAnswer ? Colors.green : colors.tertiary, ), ), ), diff --git a/frontend/lib/components/elements/quiz/yes_no_quiz.dart b/frontend/lib/components/elements/quiz/yes_no_quiz.dart index 14d2f50..b41e994 100644 --- a/frontend/lib/components/elements/quiz/yes_no_quiz.dart +++ b/frontend/lib/components/elements/quiz/yes_no_quiz.dart @@ -145,7 +145,9 @@ class _YesNoQuizState extends State { side: BorderSide( color: widget.correctAnswers[0] == "yes" ? Colors.green - : Colors.red, + : widget.correctAnswers[0] == "no" && _selection == 0 + ? Colors.grey + : Colors.red, width: _selection == 1 ? 3.0 : 1.0, ), ), @@ -166,7 +168,9 @@ class _YesNoQuizState extends State { decoration: BoxDecoration( color: widget.correctAnswers[0] == "yes" ? Colors.green - : Colors.red, + : widget.correctAnswers[0] == "no" && _selection == 0 + ? Colors.grey + : Colors.red, shape: BoxShape.circle, ), child: const Center( @@ -195,7 +199,9 @@ class _YesNoQuizState extends State { side: BorderSide( color: widget.correctAnswers[0] == "no" ? Colors.green - : Colors.red, + : widget.correctAnswers[0] == "yes" && _selection == 1 + ? Colors.grey + : Colors.red, width: _selection == 0 ? 3.0 : 1.0, ), ), @@ -216,7 +222,9 @@ class _YesNoQuizState extends State { decoration: BoxDecoration( color: widget.correctAnswers[0] == "no" ? Colors.green - : Colors.red, + : widget.correctAnswers[0] == "yes" && _selection == 1 + ? Colors.grey + : Colors.red, shape: BoxShape.circle, ), child: const Center(