removed some 'month' specific things from practice page

This commit is contained in:
BroodjeAap 2020-11-02 17:22:49 +01:00
parent 25874a711d
commit ba7c909ac4
4 changed files with 16 additions and 11 deletions

View file

@ -3,7 +3,7 @@ import 'package:ohthatsa/pages/YearsPage.dart';
import 'package:ohthatsa/pages/practice/PracticeSetup.dart';
import 'package:ohthatsa/pages/practice/PracticeSetupPage.dart';
import 'package:ohthatsa/pages/practice/month/MonthPracticePage.dart';
import 'file:///D:/dev/projects/ohthatsa/lib/pages/practice/PracticePage.dart';
import 'package:ohthatsa/pages/MonthValuesPage.dart';
void main() {
@ -34,7 +34,7 @@ class RouteGenerator {
return MaterialPageRoute(builder: (context) => PracticeSetupPage());
}
case "/practice/month/practice": {
return MaterialPageRoute(builder: (context) => MonthPracticePage(settings.arguments));
return MaterialPageRoute(builder: (context) => PracticePage(settings.arguments));
}
default: {
return MaterialPageRoute(builder: (context) => YearsPage());

View file

@ -5,18 +5,18 @@ import 'package:ohthatsa/pages/practice/PracticeThingMonth.dart';
import 'package:ohthatsa/AppDrawer.dart';
import 'package:ohthatsa/util/Extensions.dart';
import 'MonthPracticeAnswer.dart';
import 'month/MonthPracticeAnswer.dart';
class MonthPracticePage extends StatefulWidget {
class PracticePage extends StatefulWidget {
final PracticeSetup practiceSetup;
MonthPracticePage(
PracticePage(
this.practiceSetup
);
@override
_MonthPracticeState createState() => _MonthPracticeState(practiceSetup);
_PracticeState createState() => _PracticeState(practiceSetup);
}
class _MonthPracticeState extends State<MonthPracticePage> {
class _PracticeState extends State<PracticePage> {
int _startCount = 0;
bool _showCorrect = true;
PracticeThing practiceThing;
@ -25,7 +25,7 @@ class _MonthPracticeState extends State<MonthPracticePage> {
int _correct = 0;
int _incorrect = 0;
_MonthPracticeState(PracticeSetup practiceSetup){
_PracticeState(PracticeSetup practiceSetup){
this._startCount = practiceSetup.count;
this._showCorrect = practiceSetup.showCorrect;
this.practiceThing = PracticeThingMonth();
@ -52,7 +52,7 @@ class _MonthPracticeState extends State<MonthPracticePage> {
buttons.add(
FlatButton(
onPressed: () {
checkMonth(i);
checkAnswer(i);
},
color: Colors.blue,
textColor: Colors.white,
@ -121,7 +121,7 @@ class _MonthPracticeState extends State<MonthPracticePage> {
return Scaffold(
drawer: AppDrawer(),
appBar: AppBar(
title: Text("Practicing months"),
title: practiceThing.getAppBarTitleText(),
),
body: Center(
child: Container(
@ -176,7 +176,7 @@ class _MonthPracticeState extends State<MonthPracticePage> {
);
}
void checkMonth(int answer){
void checkAnswer(int answer){
if(practiceThing.answer(answer)){
_correct += 1;
} else {

View file

@ -4,6 +4,7 @@ abstract class PracticeThing {
bool answer(int answer);
void next();
List<bool> getBoolAnswers();
Text getAppBarTitleText();
Text getCurrentQuestionText();
Text getLastAnswerText(bool showCorrect);
Text getSecondLastAnswerText(bool showCorrect);

View file

@ -28,6 +28,10 @@ class PracticeThingMonth extends PracticeThing {
return answers.map((answer) => answer.month.value == answer.answer).toList();
}
Text getAppBarTitleText(){
return Text("Practicing Months");
}
Text getCurrentQuestionText(){
return Text(
current.toString(),