Added short (2 answer) history to month practice, with right answers
This commit is contained in:
parent
80ad0cdef4
commit
185e913827
1 changed files with 66 additions and 6 deletions
|
@ -51,6 +51,71 @@ class _MonthPracticeState extends State<MonthPracticePage> {
|
||||||
return new Row(children: answerBoxes);
|
return new Row(children: answerBoxes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget getQuestions(){
|
||||||
|
List<Widget> questions = List<Widget>();
|
||||||
|
if(answers.length >= 2){
|
||||||
|
MonthPracticeAnswer answer = answers[answers.length - 2];
|
||||||
|
questions.add(
|
||||||
|
new Opacity(
|
||||||
|
opacity: 0.3,
|
||||||
|
child: new Text(
|
||||||
|
"${answer.month.string.capitalize()}: ${answer.month.value}",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 10,
|
||||||
|
color: answer.answer == answer.month.value ? Colors.green : Colors.red
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
questions.add(
|
||||||
|
new Opacity(
|
||||||
|
opacity: 0.6,
|
||||||
|
child: new Text(
|
||||||
|
"-",
|
||||||
|
style: TextStyle(fontSize: 10)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if(answers.length >= 1){
|
||||||
|
MonthPracticeAnswer answer = answers[answers.length - 1];
|
||||||
|
questions.add(
|
||||||
|
new Opacity(
|
||||||
|
opacity: 0.6,
|
||||||
|
child: new Text(
|
||||||
|
"${answer.month.string.capitalize()}: ${answer.month.value}",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
color: answer.answer == answer.month.value ? Colors.green : Colors.red
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
questions.add(
|
||||||
|
new Opacity(
|
||||||
|
opacity: 0.6,
|
||||||
|
child: new Text(
|
||||||
|
"-",
|
||||||
|
style: TextStyle(fontSize: 15)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
questions.add(
|
||||||
|
new Text(
|
||||||
|
_month.string.capitalize(),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 30,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return new Column(
|
||||||
|
children: questions
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget getButtons(){
|
Widget getButtons(){
|
||||||
List<Widget> buttons = new List<Widget>();
|
List<Widget> buttons = new List<Widget>();
|
||||||
for(int i in [1,2,3,4,5,6,-1,0,-1]){
|
for(int i in [1,2,3,4,5,6,-1,0,-1]){
|
||||||
|
@ -120,12 +185,7 @@ class _MonthPracticeState extends State<MonthPracticePage> {
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
new Text(
|
getQuestions(),
|
||||||
_month.string.capitalize(),
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 30,
|
|
||||||
)
|
|
||||||
),
|
|
||||||
getButtons(),
|
getButtons(),
|
||||||
new Align(
|
new Align(
|
||||||
alignment: FractionalOffset.bottomCenter,
|
alignment: FractionalOffset.bottomCenter,
|
||||||
|
|
Loading…
Add table
Reference in a new issue