From 413b1fd133d3163deb1a4576e8cd18dc835bff2f Mon Sep 17 00:00:00 2001 From: BroodjeAap Date: Mon, 16 Nov 2020 20:57:59 +0100 Subject: [PATCH] added all practice stats --- lib/pages/practice/PracticeSetupPage.dart | 125 +++++++++++++++++++++- 1 file changed, 120 insertions(+), 5 deletions(-) diff --git a/lib/pages/practice/PracticeSetupPage.dart b/lib/pages/practice/PracticeSetupPage.dart index aec797d..a254fa4 100644 --- a/lib/pages/practice/PracticeSetupPage.dart +++ b/lib/pages/practice/PracticeSetupPage.dart @@ -13,6 +13,7 @@ class PracticeSetupPage extends StatefulWidget { class _PracticeSetupState extends State { int _count = 12; bool _showCorrect = true; + final _ranges = ["", "7d", "30d", "All"]; Future> _answerStats; @@ -22,10 +23,6 @@ class _PracticeSetupState extends State { super.initState(); } - Table getStatsTable(BuildContext context, AsyncSnapshot> snapshot){ - - } - @override Widget build(BuildContext context){ return Scaffold( @@ -96,7 +93,7 @@ class _PracticeSetupState extends State { ), Text( snapshot.hasData ? - snapshot.data["7d month"].toString() + "%" : "-", + snapshot.data["7d month"].toString() + "%" : "-", textAlign: TextAlign.center, style: TextStyle(fontSize: 25) ), Text( @@ -111,6 +108,124 @@ class _PracticeSetupState extends State { ), ] ), + TableRow( + children: [ + FlatButton( + child: Text("Century"), + color: Colors.blue, + textColor: Colors.white, + onPressed: () { + Navigator.pushNamed( + context, + '/practice/practice', + arguments: PracticeSetup(_count, _showCorrect, PracticeType.century) + ); + }, + ), + Text( + snapshot.hasData ? + snapshot.data["7d century"].toString() + "%" : "-", + textAlign: TextAlign.center, style: TextStyle(fontSize: 25) + ), + Text( + snapshot.hasData ? + snapshot.data["30d century"].toString() + "%" : "-", + textAlign: TextAlign.center, style: TextStyle(fontSize: 25) + ), + Text( + snapshot.hasData ? + snapshot.data["All century"].toString() + "%" : "-", + textAlign: TextAlign.center, style: TextStyle(fontSize: 25) + ), + ] + ), + TableRow( + children: [ + FlatButton( + child: Text("Leap"), + color: Colors.blue, + textColor: Colors.white, + onPressed: () { + Navigator.pushNamed( + context, + '/practice/practice', + arguments: PracticeSetup(_count, _showCorrect, PracticeType.leap) + ); + }, + ), + Text( + snapshot.hasData ? + snapshot.data["7d leap"].toString() + "%" : "-", + textAlign: TextAlign.center, style: TextStyle(fontSize: 25) + ), + Text( + snapshot.hasData ? + snapshot.data["30d leap"].toString() + "%" : "-", + textAlign: TextAlign.center, style: TextStyle(fontSize: 25) + ), + Text( + snapshot.hasData ? + snapshot.data["All leap"].toString() + "%" : "-", + textAlign: TextAlign.center, style: TextStyle(fontSize: 25) + ), + ] + ), + TableRow( + children: [ + FlatButton( + child: Text("Mod7"), + color: Colors.blue, + textColor: Colors.white, + onPressed: () { + Navigator.pushNamed( + context, + '/practice/practice', + arguments: PracticeSetup(_count, _showCorrect, PracticeType.mod) + ); + }, + ), + Text( + snapshot.hasData ? + snapshot.data["7d mod"].toString() + "%" : "-", + textAlign: TextAlign.center, style: TextStyle(fontSize: 25) + ), + Text( + snapshot.hasData ? + snapshot.data["30d mod"].toString() + "%" : "-", + textAlign: TextAlign.center, style: TextStyle(fontSize: 25) + ), + Text( + snapshot.hasData ? + snapshot.data["All mod"].toString() + "%" : "-", + textAlign: TextAlign.center, style: TextStyle(fontSize: 25) + ), + ] + ), + TableRow( + children: [ + FlatButton( + child: Text("All"), + color: Colors.blue, + textColor: Colors.white, + onPressed: () {}, + ), + Text( + snapshot.hasData ? + snapshot.data["7d mod"].toString() + "%" : "-", + textAlign: TextAlign.center, style: TextStyle(fontSize: 25) + ), + Text( + snapshot.hasData ? + snapshot.data["30d mod"].toString() + "%" : "-", + textAlign: TextAlign.center, style: TextStyle(fontSize: 25) + ), + Text( + snapshot.hasData ? + snapshot.data["All mod"].toString() + "%" : "-", + textAlign: TextAlign.center, style: TextStyle(fontSize: 25) + ), + ] + ), ] ); }