lottis_birthday_escaperoom_app/lib/main.dart

121 lines
4.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:lottis_birthday_escaperoom_app/barcode_scanner_window.dart';
import 'package:lottis_birthday_escaperoom_app/controller/gamecontroller.dart';
import 'package:lottis_birthday_escaperoom_app/controller/mainpagecontroller.dart';
import 'package:lottis_birthday_escaperoom_app/mobile_scanner_overlay.dart';
import 'package:lottis_birthday_escaperoom_app/screens/marker.dart';
void main() {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return GetMaterialApp(
title: 'Flutter Demo',
theme: ThemeData.dark().copyWith(
colorScheme: const ColorScheme.dark(
primary: Colors.deepPurple,
secondary: Colors.deepPurpleAccent,
),
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
final MainPageController c = Get.put(MainPageController());
return PopScope(
canPop: false,
child: Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ElevatedButton(
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => BarcodeScannerWithOverlay(),
),
);
},
child: const Text('MobileScanner with Overlay'),
),
ElevatedButton(
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => BarcodeScannerWithScanWindow(),
),
);
},
child: const Text('MobileScanner with Scan Window'),
),
TextFormField(
decoration: const InputDecoration(
labelText: 'Marker Sequence',
hintText: 'Enter marker sequence',
),
controller: c.markerSeqController,
),
TextFormField(
decoration: const InputDecoration(
labelText: 'Calendar QR Data',
hintText: 'Enter calendar QR data',
),
controller: c.calendarQrDataController,
),
TextFormField(
decoration: const InputDecoration(
labelText: 'Final Code',
hintText: 'Enter final code',
),
controller: c.finalCodeController,
),
TextFormField(
decoration: const InputDecoration(
labelText: 'Admin Pass',
hintText: 'Enter admin pass',
),
controller: c.adminPassController,
),
ElevatedButton(
child: const Text('Start Game'),
onPressed: () {
Get.put(
GameController(
markerSequence: c.markerSeqController.text,
calendarQrData: c.calendarQrDataController.text,
finalCode: c.finalCodeController.text,
adminPass: c.adminPassController.text),
permanent: true);
Get.offAll(const MarkerScreen());
})
],
),
),
),
);
}
}