Initial month instruction dialog done
This commit is contained in:
parent
2c1e98d896
commit
bc778ba1a5
2 changed files with 78 additions and 0 deletions
|
@ -6,6 +6,8 @@ import 'package:ohthatsa/pages/practice/PracticeSetup.dart';
|
|||
import 'package:ohthatsa/pages/practice/PracticeType.dart';
|
||||
import 'package:ohthatsa/util/Extensions.dart';
|
||||
|
||||
import 'instructions/MonthInstructionDialog.dart';
|
||||
|
||||
class PracticeSetupPage extends StatefulWidget {
|
||||
@override
|
||||
_PracticeSetupState createState() => _PracticeSetupState();
|
||||
|
@ -24,6 +26,29 @@ class _PracticeSetupState extends State<PracticeSetupPage> {
|
|||
super.initState();
|
||||
}
|
||||
|
||||
SimpleDialog getInstructionDialog(PracticeType practiceType){
|
||||
switch(practiceType){
|
||||
case PracticeType.month: {
|
||||
return getMonthInstructionDialog();
|
||||
}
|
||||
case PracticeType.year: {
|
||||
return SimpleDialog();
|
||||
}
|
||||
case PracticeType.century: {
|
||||
return SimpleDialog();
|
||||
}
|
||||
case PracticeType.leap: {
|
||||
return SimpleDialog();
|
||||
}
|
||||
case PracticeType.mod: {
|
||||
return SimpleDialog();
|
||||
}
|
||||
default: {
|
||||
return SimpleDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TableRow getStatTableRow(AsyncSnapshot<Map<String, double>> snapshot, PracticeType practiceType){
|
||||
final typeString = practiceType.toString().split(".").last;
|
||||
return TableRow(
|
||||
|
@ -39,6 +64,12 @@ class _PracticeSetupState extends State<PracticeSetupPage> {
|
|||
arguments: PracticeSetup(_count, _showCorrect, practiceType)
|
||||
);
|
||||
},
|
||||
onLongPress: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
child: this.getInstructionDialog(practiceType)
|
||||
);
|
||||
},
|
||||
),
|
||||
getStatTableText(snapshot.hasData ? snapshot.data["7d $typeString"] : null),
|
||||
getStatTableText(snapshot.hasData ? snapshot.data["30d $typeString"] : null),
|
||||
|
@ -130,6 +161,10 @@ class _PracticeSetupState extends State<PracticeSetupPage> {
|
|||
]
|
||||
);
|
||||
}
|
||||
),
|
||||
Text(
|
||||
"Long press for instructions",
|
||||
style: TextStyle(fontSize: 10, color: Colors.grey)
|
||||
)
|
||||
]
|
||||
)
|
||||
|
|
43
lib/pages/practice/instructions/MonthInstructionDialog.dart
Normal file
43
lib/pages/practice/instructions/MonthInstructionDialog.dart
Normal file
|
@ -0,0 +1,43 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:ohthatsa/util/Months.dart';
|
||||
|
||||
TableRow getMonthTableRow(MapEntry<String, Month> month) {
|
||||
return TableRow(
|
||||
children: [
|
||||
TableCell(
|
||||
child: Text(
|
||||
month.key,
|
||||
style: TextStyle(fontSize: 25),
|
||||
textAlign: TextAlign.right
|
||||
)
|
||||
),
|
||||
TableCell(
|
||||
child: Text(
|
||||
month.value.value.toString(),
|
||||
style: TextStyle(fontSize: 25),
|
||||
textAlign: TextAlign.center
|
||||
)
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
SimpleDialog getMonthInstructionDialog(){
|
||||
return SimpleDialog(
|
||||
title: Text(
|
||||
"Month Instructions",
|
||||
style: TextStyle(fontSize: 25, color: Colors.blue),
|
||||
),
|
||||
children: <Widget>[
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text("Memorize these values for every month"),
|
||||
Table(
|
||||
children: Months.stringMap.entries.map(getMonthTableRow).toList()
|
||||
)
|
||||
]
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
Loading…
Add table
Reference in a new issue