101 lines
2.9 KiB
Dart
101 lines
2.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:lottis_birthday_escaperoom_app/controller/gamecontroller.dart';
|
|
import 'package:lottis_birthday_escaperoom_app/screens/marker.dart';
|
|
import 'package:lottis_birthday_escaperoom_app/screens/pattern.dart';
|
|
import 'package:lottis_birthday_escaperoom_app/screens/qr.dart';
|
|
|
|
void showAdminLoginPopup() {
|
|
final TextEditingController passwordController = TextEditingController();
|
|
final GameController c = Get.find();
|
|
|
|
Get.dialog(
|
|
AlertDialog(
|
|
title: const Text('Admin Login'),
|
|
content: TextField(
|
|
controller: passwordController,
|
|
obscureText: true,
|
|
decoration: const InputDecoration(
|
|
hintText: 'Enter admin password',
|
|
),
|
|
),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () {
|
|
Get.back();
|
|
},
|
|
child: const Text('Cancel'),
|
|
),
|
|
ElevatedButton(
|
|
onPressed: () {
|
|
if (passwordController.text == c.adminPass) {
|
|
Get.back();
|
|
Get.to(() => const AdminPage());
|
|
} else {
|
|
// Get.back();
|
|
Get.snackbar(
|
|
'Error',
|
|
'Incorrect password',
|
|
snackPosition: SnackPosition.BOTTOM,
|
|
);
|
|
}
|
|
},
|
|
child: const Text('Login'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
class AdminPage extends StatelessWidget {
|
|
const AdminPage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
GameController c = Get.find();
|
|
return Scaffold(
|
|
body: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
const Text('Admin Page'),
|
|
Text('Marker Sequence: ${c.markerSequence}'),
|
|
Text('Calendar QR Data: ${c.calendarQrData}'),
|
|
Text('Final Code: ${c.finalCode}'),
|
|
Text('Admin Password: ${c.adminPass}'),
|
|
const Text("Go to Challenge directly: "),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: [
|
|
ElevatedButton(
|
|
onPressed: () {
|
|
Get.offAll(const MarkerScreen());
|
|
},
|
|
child: const Text('Marker'),
|
|
),
|
|
ElevatedButton(
|
|
onPressed: () {
|
|
Get.offAll(const QrScreen());
|
|
},
|
|
child: const Text('Story'),
|
|
),
|
|
ElevatedButton(
|
|
onPressed: () {
|
|
Get.offAll(const PatternScreen());
|
|
// Add functionality for Pattern button
|
|
},
|
|
child: const Text('Pattern'),
|
|
),
|
|
ElevatedButton(
|
|
onPressed: () {
|
|
c.qrPageController.stop();
|
|
},
|
|
child: const Text('stop qr scanner qr page'),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|