Got single value working for month practice 7d
This commit is contained in:
parent
3a25d17c94
commit
bc8b08bcf4
1 changed files with 51 additions and 103 deletions
|
@ -1,6 +1,7 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:numberpicker/numberpicker.dart';
|
import 'package:numberpicker/numberpicker.dart';
|
||||||
import 'package:ohthatsa/AppDrawer.dart';
|
import 'package:ohthatsa/AppDrawer.dart';
|
||||||
|
import 'package:ohthatsa/pages/practice/PracticeDatabase.dart';
|
||||||
import 'package:ohthatsa/pages/practice/PracticeSetup.dart';
|
import 'package:ohthatsa/pages/practice/PracticeSetup.dart';
|
||||||
import 'package:ohthatsa/pages/practice/PracticeType.dart';
|
import 'package:ohthatsa/pages/practice/PracticeType.dart';
|
||||||
|
|
||||||
|
@ -12,6 +13,19 @@ class PracticeSetupPage extends StatefulWidget {
|
||||||
class _PracticeSetupState extends State<PracticeSetupPage> {
|
class _PracticeSetupState extends State<PracticeSetupPage> {
|
||||||
int _count = 12;
|
int _count = 12;
|
||||||
bool _showCorrect = true;
|
bool _showCorrect = true;
|
||||||
|
|
||||||
|
Future<Map<String, double>> _answerStats;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
this._answerStats = PracticeDatabase.getStats();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
Table getStatsTable(BuildContext context, AsyncSnapshot<Map<String, double>> snapshot){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context){
|
Widget build(BuildContext context){
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
@ -53,112 +67,46 @@ class _PracticeSetupState extends State<PracticeSetupPage> {
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
Table(
|
FutureBuilder<Map<String, double>>(
|
||||||
border: TableBorder(
|
future: _answerStats,
|
||||||
//horizontalInside: BorderSide(),
|
builder: (BuildContext context, AsyncSnapshot<Map<String, double>> snapshot){
|
||||||
//verticalInside: BorderSide()
|
return Table(
|
||||||
),
|
children: <TableRow>[
|
||||||
children: <TableRow>[
|
TableRow(
|
||||||
TableRow(
|
children: <Widget>[ // Header
|
||||||
children: <Widget>[
|
Text(""),
|
||||||
// Header
|
Text("7d", textAlign: TextAlign.center, style: TextStyle(fontSize: 25)),
|
||||||
Text(""),
|
Text("30d", textAlign: TextAlign.center, style: TextStyle(fontSize: 25)),
|
||||||
Text("7d", textAlign: TextAlign.center, style: TextStyle(fontSize: 25)),
|
Text("All", textAlign: TextAlign.center, style: TextStyle(fontSize: 25))
|
||||||
Text("30d", textAlign: TextAlign.center, style: TextStyle(fontSize: 25)),
|
]
|
||||||
Text("All", textAlign: TextAlign.center, style: TextStyle(fontSize: 25))
|
|
||||||
]
|
|
||||||
),
|
|
||||||
TableRow(
|
|
||||||
children: <Widget>[
|
|
||||||
FlatButton(
|
|
||||||
child: Text("Month"),
|
|
||||||
color: Colors.blue,
|
|
||||||
textColor: Colors.white,
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pushNamed(
|
|
||||||
context,
|
|
||||||
'/practice/practice',
|
|
||||||
arguments: PracticeSetup(_count, _showCorrect, PracticeType.month)
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
Text("85%", textAlign: TextAlign.center, style: TextStyle(fontSize: 25)),
|
TableRow(
|
||||||
Text("70%", textAlign: TextAlign.center, style: TextStyle(fontSize: 25)),
|
children: <Widget>[
|
||||||
Text("50%", textAlign: TextAlign.center, style: TextStyle(fontSize: 25))
|
FlatButton(
|
||||||
]
|
child: Text("Month"),
|
||||||
),
|
color: Colors.blue,
|
||||||
TableRow(
|
textColor: Colors.white,
|
||||||
children: <Widget>[
|
onPressed: () {
|
||||||
FlatButton(
|
Navigator.pushNamed(
|
||||||
child: Text("Century"),
|
context,
|
||||||
color: Colors.blue,
|
'/practice/practice',
|
||||||
textColor: Colors.white,
|
arguments: PracticeSetup(_count, _showCorrect, PracticeType.month)
|
||||||
onPressed: () {
|
);
|
||||||
Navigator.pushNamed(
|
},
|
||||||
context,
|
),
|
||||||
'/practice/practice',
|
Text(
|
||||||
arguments: PracticeSetup(_count, _showCorrect, PracticeType.century)
|
snapshot.hasData ?
|
||||||
);
|
snapshot.data["All month"].round().toString() + "%" : "-",
|
||||||
},
|
textAlign: TextAlign.center, style: TextStyle(fontSize: 25)
|
||||||
|
),
|
||||||
|
Text("70%", textAlign: TextAlign.center, style: TextStyle(fontSize: 25)),
|
||||||
|
Text("50%", textAlign: TextAlign.center, style: TextStyle(fontSize: 25))
|
||||||
|
]
|
||||||
),
|
),
|
||||||
Text("80%", textAlign: TextAlign.center, style: TextStyle(fontSize: 25)),
|
|
||||||
Text("70%", textAlign: TextAlign.center, style: TextStyle(fontSize: 25)),
|
|
||||||
Text("50%", textAlign: TextAlign.center, style: TextStyle(fontSize: 25))
|
|
||||||
]
|
]
|
||||||
),
|
);
|
||||||
TableRow(
|
}
|
||||||
children: <Widget>[
|
)
|
||||||
FlatButton(
|
|
||||||
child: Text("Leap"),
|
|
||||||
color: Colors.blue,
|
|
||||||
textColor: Colors.white,
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pushNamed(
|
|
||||||
context,
|
|
||||||
'/practice/practice',
|
|
||||||
arguments: PracticeSetup(_count, _showCorrect, PracticeType.leap)
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
Text("80%", textAlign: TextAlign.center, style: TextStyle(fontSize: 25)),
|
|
||||||
Text("70%", textAlign: TextAlign.center, style: TextStyle(fontSize: 25)),
|
|
||||||
Text("50%", textAlign: TextAlign.center, style: TextStyle(fontSize: 25))
|
|
||||||
]
|
|
||||||
),
|
|
||||||
TableRow(
|
|
||||||
children: <Widget>[
|
|
||||||
FlatButton(
|
|
||||||
child: Text("Modulo 7"),
|
|
||||||
color: Colors.blue,
|
|
||||||
textColor: Colors.white,
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pushNamed(
|
|
||||||
context,
|
|
||||||
'/practice/practice',
|
|
||||||
arguments: PracticeSetup(_count, _showCorrect, PracticeType.mod)
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
Text("80%", textAlign: TextAlign.center, style: TextStyle(fontSize: 25)),
|
|
||||||
Text("70%", textAlign: TextAlign.center, style: TextStyle(fontSize: 25)),
|
|
||||||
Text("50%", textAlign: TextAlign.center, style: TextStyle(fontSize: 25))
|
|
||||||
]
|
|
||||||
),
|
|
||||||
TableRow(
|
|
||||||
children: <Widget>[
|
|
||||||
FlatButton(
|
|
||||||
child: Text("All"),
|
|
||||||
color: Colors.blue,
|
|
||||||
textColor: Colors.white,
|
|
||||||
onPressed: () {},
|
|
||||||
),
|
|
||||||
Text("80%", textAlign: TextAlign.center, style: TextStyle(fontSize: 25)),
|
|
||||||
Text("70%", textAlign: TextAlign.center, style: TextStyle(fontSize: 25)),
|
|
||||||
Text("50%", textAlign: TextAlign.center, style: TextStyle(fontSize: 25))
|
|
||||||
]
|
|
||||||
),
|
|
||||||
]
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue