From 56aa8ff6f854d0173b1535760b38fc6c11bf9dec Mon Sep 17 00:00:00 2001 From: BroodjeAap Date: Mon, 28 Dec 2020 15:51:37 +0100 Subject: [PATCH] removed unused pages --- lib/main.dart | 9 -- lib/other/AppDrawer.dart | 21 --- lib/pages/MonthValuesPage.dart | 224 ------------------------------- lib/pages/NotificationsPage.dart | 133 ------------------ lib/pages/YearsPage.dart | 40 ------ 5 files changed, 427 deletions(-) delete mode 100644 lib/pages/MonthValuesPage.dart delete mode 100644 lib/pages/NotificationsPage.dart delete mode 100644 lib/pages/YearsPage.dart diff --git a/lib/main.dart b/lib/main.dart index e245398..ca3675f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -118,21 +118,12 @@ class RouteGenerator { case "/": { return MaterialPageRoute(builder: (context) => PracticeSetupPage()); } - case "/monthValues": { - return MaterialPageRoute(builder: (context) => MonthValuesPage()); - } - case "/years": { - return MaterialPageRoute(builder: (context) => YearsPage()); - } case "/practice/setup": { return MaterialPageRoute(builder: (context) => PracticeSetupPage()); } case "/practice/practice": { return MaterialPageRoute(builder: (context) => PracticePage(settings.arguments)); } - case "/notifications": { - return MaterialPageRoute(builder: (context) => NotificationsPage()); - } case "/instructions/month": { return MaterialPageRoute(builder: (context) => MonthInstructionPage()); } diff --git a/lib/other/AppDrawer.dart b/lib/other/AppDrawer.dart index c6701b2..a9cb6a2 100644 --- a/lib/other/AppDrawer.dart +++ b/lib/other/AppDrawer.dart @@ -11,27 +11,6 @@ class AppDrawer extends StatelessWidget { DrawerHeader( child: Text("Oh That's A ..."), ), - ListTile( - title: Text("Month values"), - onTap: () { - Navigator.pop(context); - Navigator.pushNamed(context, "/monthValues"); - } - ), - ListTile( - title: Text("Years"), - onTap: () { - Navigator.pop(context); - Navigator.pushNamed(context, "/years"); - } - ), - ListTile( - title: Text("Notifications"), - onTap: () { - Navigator.pop(context); - Navigator.pushNamed(context, "/notifications"); - } - ), ListTile( title: Text("Practice"), onTap: () { diff --git a/lib/pages/MonthValuesPage.dart b/lib/pages/MonthValuesPage.dart deleted file mode 100644 index 68356f3..0000000 --- a/lib/pages/MonthValuesPage.dart +++ /dev/null @@ -1,224 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:numberpicker/numberpicker.dart'; - -import 'package:ohthatsa/other/AppDrawer.dart'; -import 'package:ohthatsa/util/DayCalculator.dart'; -import 'package:term_glyph/term_glyph.dart' as glyph; - -class MonthValuesPage extends StatefulWidget { - @override - _MonthValuesState createState() => _MonthValuesState(); -} - -class _MonthValuesState extends State { - int year; - int yy; - String centuriesString; - String yyString; - double yyDiv4; - int yyDiv4Floored; - int yearValue; - - @override - void initState(){ - super.initState(); - this.setYearValues(DateTime.now().year); - } - void setYearValues(newYear){ - year = newYear; - yy = year % 100; - centuriesString = (year ~/ 100).toString(); - yyString = year.toString().substring(2); - yyDiv4 = yy / 4; - yyDiv4Floored = yyDiv4.floor(); - yearValue = DayCalculator.getYearValue(year); - - setState(() {}); - } - static const formulaStyle = TextStyle( - fontSize: 20 - ); - static const formulaStyleU = TextStyle( - fontSize: 20, - decoration: TextDecoration.underline - ); - static const YYStyle = TextStyle( - color: Colors.green, - fontSize: 20 - ); - static const YYStyleU = TextStyle( - color: Colors.green, - fontSize: 20, - decoration: TextDecoration.underline - ); - static const pageNum = TextStyle( - color: Colors.grey, - fontSize: 20 - ); - static const pageNumCurrent = TextStyle( - color: Colors.blue, - fontSize: 20 - ); - @override - Widget build(BuildContext context) { - return Scaffold( - drawer: AppDrawer(), - appBar: AppBar( - title: Text("Month Values") - ), - body: PageView( - children: [ - Container( - padding: EdgeInsets.fromLTRB(0, 50, 0, 10), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - "Take only the last two digits: ", - style: TextStyle(fontSize: 25) - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "YY", - style: TextStyle( - color: Colors.grey, - fontSize: 25 - ) - ), - Text( - "YY", - style: YYStyle - ) - ], - ), - Text( - "Calculate:", - style: TextStyle(fontSize: 25) - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "(", - style: formulaStyle, - ), - Text( - "YY", - style: YYStyle - ), - Text( - " + floor(", - style: formulaStyle - ), - Text( - "YY", - style: YYStyle - ), - Text( - " / 4)) % 7", - style: formulaStyle - ), - ], - ), - Spacer(), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text("1", style: pageNumCurrent), - Text(" - ", style: pageNum), - Text("2", style: pageNum), - ], - ) - ], - ) - ), - Container( - padding: EdgeInsets.fromLTRB(0, 0, 0, 10), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - NumberPicker.integer( - initialValue: year, - minValue: 1700, - maxValue: 2399, - onChanged: (newYear) => this.setYearValues(newYear) - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text("For ", style: formulaStyle), - Text(centuriesString, style: formulaStyle), - Text(year.toString().substring(2), style: YYStyle), - Text(" our formula becomes: ", style: formulaStyle), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text("(", style: formulaStyle), - Text(yyString, style: YYStyle), - Text(" + floor(", style: formulaStyle), - Text(yyString, style: YYStyleU), - Text(" / 4", style: formulaStyleU), - Text(")) % 7", style: formulaStyle), - ], - ), - Text(glyph.unicodeGlyphs.downArrow, style: TextStyle(fontSize: 15)), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text("(", style: formulaStyle), - Text(yyString, style: YYStyle), - Text(" + ", style: formulaStyle), - Text("floor(" + yyDiv4.toString() + ")", style: formulaStyleU), - Text(") % 7", style: formulaStyle), - ], - ), - Text(glyph.unicodeGlyphs.downArrow, style: TextStyle(fontSize: 15)), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text("(", style: formulaStyleU), - Text(yyString, style: YYStyleU), - Text(" + " + yyDiv4Floored.toString() + ")", style: formulaStyleU), - Text(" % 7", style: formulaStyle), - ], - ), - Text(glyph.unicodeGlyphs.downArrow, style: TextStyle(fontSize: 15)), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text((yy + yyDiv4Floored).toString(), style: formulaStyleU), - Text(" % 7", style: formulaStyleU), - ], - ), - Text(glyph.unicodeGlyphs.downArrow, style: TextStyle(fontSize: 15)), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text("So the year value of " + year.toString() + " is: ", style: formulaStyle), - Text(yearValue.toString(), style: formulaStyleU), - ], - ), - Spacer(), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text("1", style: pageNum), - Text(" - ", style: pageNum), - Text("2", style: pageNumCurrent), - ], - ) - ] - ) - ) - ] - ) - ); - } -} \ No newline at end of file diff --git a/lib/pages/NotificationsPage.dart b/lib/pages/NotificationsPage.dart deleted file mode 100644 index 0fbd880..0000000 --- a/lib/pages/NotificationsPage.dart +++ /dev/null @@ -1,133 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_local_notifications/flutter_local_notifications.dart'; -import 'package:ohthatsa/other/AppDrawer.dart'; -import 'package:ohthatsa/main.dart'; -import 'package:ohthatsa/pages/practice/thing/PracticeThing.dart'; -import 'package:ohthatsa/pages/practice/thing/PracticeThingAll.dart'; -import 'package:ohthatsa/pages/practice/thing/PracticeThingYear.dart'; - -import 'package:timezone/data/latest.dart' as tz; -import 'package:timezone/timezone.dart' as tz; - -class NotificationsPage extends StatefulWidget { - @override - _NotificationPageState createState() => _NotificationPageState(); -} - -class _NotificationPageState extends State { - @override - Widget build(BuildContext context){ - return Scaffold( - drawer: AppDrawer(), - appBar: AppBar( - title: Text("Notifications") - ), - body: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - FlatButton( - child: Text("Notify!"), - color: Colors.blue, - textColor: Colors.white, - onPressed: _notify - ), - FlatButton( - child: Text("Schedule notification!"), - color: Colors.blue, - textColor: Colors.white, - onPressed: _scheduleNotify - ), - FlatButton( - child: Text("Repeat!"), - color: Colors.blue, - textColor: Colors.white, - onPressed: _repeatNotification - ), - FlatButton( - child: Text("Waiting?"), - color: Colors.blue, - textColor: Colors.white, - onPressed: _checkPendingNotificationRequests - ), - FlatButton( - child: Text("Cancel"), - color: Colors.blue, - textColor: Colors.white, - onPressed: _cancelAllNotifications - ), - ], - ) - ); - } - - Future _notify() async { - const AndroidNotificationDetails androidPlatformChannelSpecifics = - AndroidNotificationDetails("test", "test", "test", ticker: 'ticker'); - const NotificationDetails platformChannelSpecifics = - NotificationDetails(android: androidPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.show( - 0, - 'Title!', - 'and the body...\nnewline;alskdjf;leowijhfraojnfoeiurhowieurhlaskbjdfowiuehrpwqiuehrwiejhraowlijehbrwaoliuh?', - platformChannelSpecifics, - payload: "test item?" - ); - } - - Future _scheduleNotify() async { - PracticeThingAll pt = PracticeThingAll(); - - await flutterLocalNotificationsPlugin.zonedSchedule( - 0, - pt.dateFormatter.format(pt.current), - pt.weekdayFormatter.format(pt.current), - tz.TZDateTime.now(tz.local).add(const Duration(seconds: 5)), - const NotificationDetails( - android: AndroidNotificationDetails("id", "name", "desc") - ), - androidAllowWhileIdle: true, - uiLocalNotificationDateInterpretation: UILocalNotificationDateInterpretation.absoluteTime, - matchDateTimeComponents: DateTimeComponents.time - ); - } - - Future _checkPendingNotificationRequests() async { - final List pendingNotificationRequests = - await flutterLocalNotificationsPlugin.pendingNotificationRequests(); - return showDialog( - context: context, - builder: (BuildContext context) => AlertDialog( - content: - Text('${pendingNotificationRequests.length} pending notification ' - 'requests'), - actions: [ - FlatButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: const Text('OK'), - ), - ], - ), - ); - } - - Future _repeatNotification() async { - const AndroidNotificationDetails androidPlatformChannelSpecifics = - AndroidNotificationDetails( - 'id', - 'name', - 'desc' - ); - const NotificationDetails platformChannelSpecifics = - NotificationDetails(android: androidPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.periodicallyShow(0, 'repeating title', - 'repeating body', RepeatInterval.hourly, platformChannelSpecifics, - androidAllowWhileIdle: true); - } - - Future _cancelAllNotifications() async { - await flutterLocalNotificationsPlugin.cancelAll(); - } -} \ No newline at end of file diff --git a/lib/pages/YearsPage.dart b/lib/pages/YearsPage.dart deleted file mode 100644 index 6178f47..0000000 --- a/lib/pages/YearsPage.dart +++ /dev/null @@ -1,40 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:numberpicker/numberpicker.dart'; -import 'package:ohthatsa/util/DayCalculator.dart'; - -import 'package:ohthatsa/other/AppDrawer.dart'; - -class YearsPage extends StatefulWidget { - @override - _YearsPageState createState() => _YearsPageState(); -} - -class _YearsPageState extends State { - int _year = DateTime.now().year; - @override - Widget build(BuildContext context){ - return Scaffold( - drawer: AppDrawer(), - appBar: AppBar( - title: Text("Years"), - ), - body: Center( - child: Column( - children: [ - NumberPicker.integer( - initialValue: _year, // TODO set to current year - minValue: 1800, - maxValue: 2399, - onChanged: (newYear) => - setState(() => _year = newYear), - ), - Text("You picked the year: $_year"), - Text("The century code is: " + DayCalculator.getCenturyValue(_year).toString()), - Text("Is this a leap year: " + DayCalculator.isLeapYear(_year).toString()), - ] - ) - ) - ); - } -} \ No newline at end of file