Switched month instructions to a page

This commit is contained in:
BroodjeAap 2020-12-21 16:12:14 +01:00
parent 20e3e5b6e1
commit 4638bd334e
4 changed files with 66 additions and 44 deletions

View file

@ -7,6 +7,7 @@ import 'package:ohthatsa/pages/practice/PracticePage.dart';
import 'package:ohthatsa/pages/MonthValuesPage.dart'; import 'package:ohthatsa/pages/MonthValuesPage.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:ohthatsa/pages/practice/instructions/MonthInstructionPage.dart';
import 'package:ohthatsa/pages/practice/instructions/YearInstructionPage.dart'; import 'package:ohthatsa/pages/practice/instructions/YearInstructionPage.dart';
import 'package:rxdart/subjects.dart'; import 'package:rxdart/subjects.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -101,6 +102,7 @@ class OhThatsA extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
title: "OhThatsA", title: "OhThatsA",
home: PracticeSetupPage(),
onGenerateRoute: RouteGenerator.generateRoute, onGenerateRoute: RouteGenerator.generateRoute,
); );
} }
@ -109,6 +111,9 @@ class OhThatsA extends StatelessWidget {
class RouteGenerator { class RouteGenerator {
static Route<dynamic> generateRoute(RouteSettings settings){ static Route<dynamic> generateRoute(RouteSettings settings){
switch(settings.name){ switch(settings.name){
case "/": {
return MaterialPageRoute(builder: (context) => PracticeSetupPage());
}
case "/monthValues": { case "/monthValues": {
return MaterialPageRoute(builder: (context) => MonthValuesPage()); return MaterialPageRoute(builder: (context) => MonthValuesPage());
} }
@ -124,9 +129,24 @@ class RouteGenerator {
case "/notifications": { case "/notifications": {
return MaterialPageRoute(builder: (context) => NotificationsPage()); return MaterialPageRoute(builder: (context) => NotificationsPage());
} }
case "/instructions/month": {
return MaterialPageRoute(builder: (context) => MonthInstructionPage());
}
case "/instructions/year": { case "/instructions/year": {
return MaterialPageRoute(builder: (context) => YearInstructionPage()); return MaterialPageRoute(builder: (context) => YearInstructionPage());
} }
case "/instructions/century": {
return MaterialPageRoute(builder: (context) => YearInstructionPage());
}
case "/instructions/leap": {
return MaterialPageRoute(builder: (context) => YearInstructionPage());
}
case "/instructions/mod": {
return MaterialPageRoute(builder: (context) => YearInstructionPage());
}
case "/instructions/all": {
return MaterialPageRoute(builder: (context) => YearInstructionPage());
}
default: { default: {
return null; return null;
} }

View file

@ -6,7 +6,7 @@ import 'package:ohthatsa/pages/practice/PracticeSetup.dart';
import 'package:ohthatsa/pages/practice/PracticeType.dart'; import 'package:ohthatsa/pages/practice/PracticeType.dart';
import 'package:ohthatsa/util/Extensions.dart'; import 'package:ohthatsa/util/Extensions.dart';
import 'instructions/MonthInstructionDialog.dart'; import 'instructions/MonthInstructionPage.dart';
class PracticeSetupPage extends StatefulWidget { class PracticeSetupPage extends StatefulWidget {
@override @override

View file

@ -1,43 +0,0 @@
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()
)
]
)
],
);
}

View file

@ -0,0 +1,45 @@
import 'package:flutter/material.dart';
import 'package:ohthatsa/other/AppDrawer.dart';
import 'package:ohthatsa/util/Months.dart';
class MonthInstructionPage extends StatelessWidget{
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
)
)
]
);
}
@override
Widget build(BuildContext context){
return Scaffold(
drawer: AppDrawer(),
appBar: AppBar(
title: Text("Year Instructions")
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text("Memorize these values:", style: TextStyle(fontSize: 25, color: Colors.blue)),
Table(
children: Months.stringMap.entries.map(getMonthTableRow).toList()
)
]
)
);
}
}