summaryrefslogtreecommitdiff
path: root/lib/pages
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik@amftech.nl>2022-11-05 15:58:05 +0100
committerAldrik Ramaekers <aldrik@amftech.nl>2022-11-05 15:58:05 +0100
commit0b0168ac91c9b7f7896cb89436aa1dcf90605cf3 (patch)
treee6c25a6c618c6132c86d7133ae82554784213257 /lib/pages
parentd3bf422afa275f8264a85c48c639576839f2f320 (diff)
fix shift delete bug
Diffstat (limited to 'lib/pages')
-rw-r--r--lib/pages/delivery_login_page.dart79
-rw-r--r--lib/pages/developer_page.dart6
-rw-r--r--lib/pages/home_page.dart9
3 files changed, 87 insertions, 7 deletions
diff --git a/lib/pages/delivery_login_page.dart b/lib/pages/delivery_login_page.dart
new file mode 100644
index 0000000..1724ba2
--- /dev/null
+++ b/lib/pages/delivery_login_page.dart
@@ -0,0 +1,79 @@
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:training_planner/pages/agenda_page.dart';
+import 'package:training_planner/pages/developer_page.dart';
+import 'package:training_planner/pages/logbook_page.dart';
+import 'package:training_planner/pages/navigation_page.dart';
+import 'package:training_planner/pages/settings_page.dart';
+import 'package:training_planner/shift.dart';
+import 'package:training_planner/main.dart';
+import 'package:training_planner/style/style.dart';
+
+class DeliveryLoginPage extends StatefulWidget {
+ @override
+ _DeliveryLoginPageState createState() => _DeliveryLoginPageState();
+
+ const DeliveryLoginPage({Key? key}) : super(key: key);
+}
+
+class _DeliveryLoginPageState extends State<DeliveryLoginPage> {
+ final pnumberController = TextEditingController();
+ final daycodeController = TextEditingController();
+
+ @override
+ initState() {
+ super.initState();
+ }
+
+ _attemptLogin() async {
+ bool success = await remoteAuthService.authenticate(
+ pnumberController.text, daycodeController.text);
+ if (success) {
+ Navigator.push(
+ context,
+ MaterialPageRoute(builder: (context) => NavigationPage()),
+ );
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Row(
+ children: [
+ Container(
+ width: 50,
+ ),
+ Expanded(
+ child: Column(
+ children: [
+ Padding(padding: EdgeInsets.all(50)),
+ TextField(
+ decoration: InputDecoration(labelText: "pnummer"),
+ keyboardType: TextInputType.number,
+ controller: pnumberController,
+ inputFormatters: <TextInputFormatter>[
+ FilteringTextInputFormatter.digitsOnly
+ ],
+ ),
+ Padding(padding: EdgeInsets.all(10)),
+ TextField(
+ decoration: InputDecoration(labelText: "dagcode"),
+ keyboardType: TextInputType.number,
+ controller: daycodeController,
+ inputFormatters: <TextInputFormatter>[
+ FilteringTextInputFormatter.digitsOnly
+ ],
+ ),
+ Padding(padding: EdgeInsets.all(10)),
+ OutlinedButton(
+ onPressed: () => _attemptLogin(), child: Text('Inloggen'))
+ ],
+ ),
+ ),
+ Container(
+ width: 50,
+ ),
+ ],
+ );
+ }
+}
diff --git a/lib/pages/developer_page.dart b/lib/pages/developer_page.dart
index 13d3c5d..b724f8c 100644
--- a/lib/pages/developer_page.dart
+++ b/lib/pages/developer_page.dart
@@ -22,8 +22,8 @@ class _DeveloperPageState extends State<DeveloperPage> {
initState() {
super.initState();
- auth.canCheckBiometrics.then((bio) => {
- auth
+ localAuthService.canCheckBiometrics.then((bio) => {
+ localAuthService
.isDeviceSupported()
.then((supported) => {canUseLocalAuth = bio && supported})
});
@@ -60,7 +60,7 @@ class _DeveloperPageState extends State<DeveloperPage> {
TextButton(
onPressed: () {
if (canUseLocalAuth) {
- auth
+ localAuthService
.authenticate(
localizedReason:
'Weet je zeker dat je alle locale bestanden wilt verwijderen?')
diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart
index 404f6cc..07fc1a8 100644
--- a/lib/pages/home_page.dart
+++ b/lib/pages/home_page.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:training_planner/pages/agenda_page.dart';
+import 'package:training_planner/pages/delivery_login_page.dart';
import 'package:training_planner/pages/developer_page.dart';
import 'package:training_planner/pages/logbook_page.dart';
import 'package:training_planner/pages/navigation_page.dart';
@@ -26,7 +27,7 @@ class _HomePageState extends State<HomePage> {
_widgetOptions = <Widget>[
new AgendaPage(agendaWeekNr: widget.agendaWeekNr),
new LogbookPage(),
- new NavigationPage(),
+ new DeliveryLoginPage(),
];
super.initState();
@@ -38,7 +39,7 @@ class _HomePageState extends State<HomePage> {
_widgetOptions = <Widget>[
new AgendaPage(agendaWeekNr: widget.agendaWeekNr),
new LogbookPage(),
- new NavigationPage(),
+ new DeliveryLoginPage(),
];
_selectedIndex = index;
});
@@ -110,11 +111,11 @@ class _HomePageState extends State<HomePage> {
),
BottomNavigationBarItem(
icon: Icon(Icons.book),
- label: 'Logboek',
+ label: 'Registratie',
),
BottomNavigationBarItem(
icon: Icon(Icons.pin_drop),
- label: 'Delivery',
+ label: 'Bezorging',
),
],
currentIndex: _selectedIndex,