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