Skip to content

Commit

Permalink
Merge pull request #41 from msi-se/fixes-abstimmung
Browse files Browse the repository at this point in the history
Farbmarkierung richtig/falsch
  • Loading branch information
TobiTgl authored Apr 14, 2024
2 parents e0271ce + 3c4c1d9 commit f0732e7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
8 changes: 6 additions & 2 deletions frontend/lib/components/elements/quiz/single_choice_quiz.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ class _SingleChoiceQuizState extends State<SingleChoiceQuiz> {
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,
),
),
Expand All @@ -116,7 +118,9 @@ class _SingleChoiceQuizState extends State<SingleChoiceQuiz> {
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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class _SingleChoiceQuizResultState extends State<SingleChoiceQuizResult> {
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,
Expand Down Expand Up @@ -117,7 +117,7 @@ class _SingleChoiceQuizResultState extends State<SingleChoiceQuizResult> {
value: optionDerivation.normalizedPercentage,
backgroundColor: colors.secondary.withOpacity(0.1),
valueColor: AlwaysStoppedAnimation<Color>(
correctAnswer ? Colors.green : Colors.red,
correctAnswer ? Colors.green : colors.tertiary,
),
),
),
Expand Down
16 changes: 12 additions & 4 deletions frontend/lib/components/elements/quiz/yes_no_quiz.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ class _YesNoQuizState extends State<YesNoQuiz> {
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,
),
),
Expand All @@ -166,7 +168,9 @@ class _YesNoQuizState extends State<YesNoQuiz> {
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(
Expand Down Expand Up @@ -195,7 +199,9 @@ class _YesNoQuizState extends State<YesNoQuiz> {
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,
),
),
Expand All @@ -216,7 +222,9 @@ class _YesNoQuizState extends State<YesNoQuiz> {
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(
Expand Down

0 comments on commit f0732e7

Please sign in to comment.