Updated MonthPracticePage to use Months util
This commit is contained in:
parent
602e0c1628
commit
b5267053c9
2 changed files with 5 additions and 16 deletions
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:ohthatsa/pages/practice/month/MonthPracticeSetup.dart';
|
import 'package:ohthatsa/pages/practice/month/MonthPracticeSetup.dart';
|
||||||
import 'package:ohthatsa/util/DayCalculator.dart';
|
import 'package:ohthatsa/util/DayCalculator.dart';
|
||||||
import 'package:ohthatsa/AppDrawer.dart';
|
import 'package:ohthatsa/AppDrawer.dart';
|
||||||
|
import 'package:ohthatsa/util/Months.dart';
|
||||||
import "dart:math";
|
import "dart:math";
|
||||||
|
|
||||||
import 'MonthPracticeAnswer.dart';
|
import 'MonthPracticeAnswer.dart';
|
||||||
|
@ -17,21 +18,7 @@ class _MonthPracticeState extends State<MonthPracticePage> {
|
||||||
int _correct = 0;
|
int _correct = 0;
|
||||||
int _incorrect = 0;
|
int _incorrect = 0;
|
||||||
static final _random = new Random();
|
static final _random = new Random();
|
||||||
static List<String> _months = [
|
String _month = Months.stringList[_random.nextInt(Months.length)];
|
||||||
"January",
|
|
||||||
"February",
|
|
||||||
"March",
|
|
||||||
"April",
|
|
||||||
"May",
|
|
||||||
"June",
|
|
||||||
"July",
|
|
||||||
"August",
|
|
||||||
"September",
|
|
||||||
"October",
|
|
||||||
"November",
|
|
||||||
"December"
|
|
||||||
];
|
|
||||||
String _month = _months[_random.nextInt(_months.length)];
|
|
||||||
List<MonthPracticeAnswer> answers = new List<MonthPracticeAnswer>();
|
List<MonthPracticeAnswer> answers = new List<MonthPracticeAnswer>();
|
||||||
|
|
||||||
Widget getAnswerRow(){
|
Widget getAnswerRow(){
|
||||||
|
@ -177,7 +164,7 @@ class _MonthPracticeState extends State<MonthPracticePage> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setState(() => {
|
setState(() => {
|
||||||
_month = _months[_random.nextInt(_months.length)]
|
_month = Months.stringList[_random.nextInt(Months.length)]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,6 +12,8 @@ class Months {
|
||||||
static final Month november = new Month("november", 10, 3);
|
static final Month november = new Month("november", 10, 3);
|
||||||
static final Month december = new Month("december", 11, 5);
|
static final Month december = new Month("december", 11, 5);
|
||||||
|
|
||||||
|
static final int length = 12;
|
||||||
|
|
||||||
static final List<Month> list = List.unmodifiable([
|
static final List<Month> list = List.unmodifiable([
|
||||||
january,
|
january,
|
||||||
february,
|
february,
|
||||||
|
|
Loading…
Add table
Reference in a new issue