better colors

This commit is contained in:
jusax23 2023-06-01 16:45:42 +02:00
parent ea88aa0318
commit 2f5aaad3fc
Signed by: jusax23
GPG key ID: 499E2AA870C1CD41

View file

@ -70,7 +70,7 @@ class _QuizPageState extends State<QuizPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Learn App'),
title: Text('Learning: ${v.name}'),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
@ -89,24 +89,23 @@ class _QuizPageState extends State<QuizPage> {
(option) {
return Container(
margin: const EdgeInsets.symmetric(vertical: 8.0),
child: ElevatedButton(
onPressed: () => ask_state == -1
? _checkAnswer(
v.questions[_currentQuestionIndex].answers
.indexOf(option),
)
: _nextQuestion(),
child: Text(option),
style: ElevatedButton.styleFrom(
child: FilledButton(
onPressed: () => ask_state == -1
? _checkAnswer(
v.questions[_currentQuestionIndex].answers
.indexOf(option),
)
: _nextQuestion(),
child: Text(option),
style: FilledButton.styleFrom(
backgroundColor: ask_state == -1
? Colors.blue
? null
: (v.questions[_currentQuestionIndex].correct ==
v.questions[_currentQuestionIndex].answers
.indexOf(option)
? Colors.green
: Colors.red),
foregroundColor: Colors.white),
));
)));
},
),
if (ask_state != -1)