diff --git a/lib/pages/practice/PracticeSetupPage.dart b/lib/pages/practice/PracticeSetupPage.dart index e1b3a6f..6c22892 100644 --- a/lib/pages/practice/PracticeSetupPage.dart +++ b/lib/pages/practice/PracticeSetupPage.dart @@ -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 { 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> snapshot, PracticeType practiceType){ final typeString = practiceType.toString().split(".").last; return TableRow( @@ -39,6 +64,12 @@ class _PracticeSetupState extends State { 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 { ] ); } + ), + Text( + "Long press for instructions", + style: TextStyle(fontSize: 10, color: Colors.grey) ) ] ) diff --git a/lib/pages/practice/instructions/MonthInstructionDialog.dart b/lib/pages/practice/instructions/MonthInstructionDialog.dart new file mode 100644 index 0000000..d2f57ad --- /dev/null +++ b/lib/pages/practice/instructions/MonthInstructionDialog.dart @@ -0,0 +1,43 @@ +import 'package:flutter/material.dart'; +import 'package:ohthatsa/util/Months.dart'; + +TableRow getMonthTableRow(MapEntry 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: [ + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text("Memorize these values for every month"), + Table( + children: Months.stringMap.entries.map(getMonthTableRow).toList() + ) + ] + ) + ], + ); +} \ No newline at end of file