Added a dialog popup when month practice is complete

This commit is contained in:
BroodjeAap 2020-10-26 17:51:53 +01:00
parent 088817ad66
commit 034d787731

View file

@ -157,6 +157,51 @@ class _MonthPracticeState extends State<MonthPracticePage> {
);
}
Future _finishedPractice() {
showDialog(
context: context,
child: SimpleDialog(
title: Text("Practice Complete!"),
contentPadding: EdgeInsets.all(50),
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text("Rounds of Practice:"),
Text(_startCount.toString())
]
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text("Correct:"),
Text(_correct.toString()),
]
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text("Incorrect:"),
Text(_incorrect.toString()),
]
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
(_correct / _startCount * 100).round().toString() + "%",
style: TextStyle(
color: (_correct / _startCount * 100) > 70 ? Colors.green : Colors.red,
fontSize: 30,
)
),
]
),
]
)
);
}
@override
Widget build(BuildContext context) {
PracticeSetup setup = ModalRoute.of(context).settings.arguments;
@ -217,6 +262,7 @@ class _MonthPracticeState extends State<MonthPracticePage> {
_count += 1;
answers.add(MonthPracticeAnswer(_month, answer));
if((_startCount - _count) == 0) {
_finishedPractice();
Navigator.pop(context);
return;
}