After I searched lots of questions in stackoverflow I get the solution. I changed these parts of code:
ElevatedButton.styleFrom(
backgroundColor: result ==
AppLocalizations.of(context)
?.truth_answer &&
selectedOption == option
? Colors.red
: result ==
AppLocalizations.of(context)
?.wrong_answer &&
selectedOption == option
? Colors.blue
: result ==
AppLocalizations.of(context)
?.wrong_answer &&
currentQuestion["answer"]
as String ==
option
? Colors.red
: Colors.blue),
with these code:
ButtonStyle(
backgroundColor: WidgetStateProperty.resolveWith<Color>((states) {
if (result == AppLocalizations.of(context)?.truth_answer && selectedOption == option) {
return Colors.green;
} else if (result == AppLocalizations.of(context)?.wrong_answer && selectedOption == option) {
return Colors.blue;
} else if (result == AppLocalizations.of(context)?.wrong_answer && currentQuestion["answer"] as String == option) {
return Colors.green;
} else {
return Colors.blue.shade200;
}
}),
),