kinda done
This commit is contained in:
parent
093e305fa4
commit
6f26885c20
|
|
@ -36,6 +36,18 @@ class _DataManager{
|
||||||
}catch(e){
|
}catch(e){
|
||||||
Debug.LogError(e);
|
Debug.LogError(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<dynamic> _services= [];
|
||||||
|
for (var s in services) {
|
||||||
|
Map<String,dynamic> se = jsonDecode(s);
|
||||||
|
|
||||||
|
if(DateTime.now().isAfter(DateTime.parse(se['end_time']))){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
_services.add(s);
|
||||||
|
}
|
||||||
|
services = _services;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> AddService(String name, DateTime sTime, DateTime eTime,Duration duration) async {
|
Future<void> AddService(String name, DateTime sTime, DateTime eTime,Duration duration) async {
|
||||||
|
|
|
||||||
86
lib/scanning_page.dart
Normal file
86
lib/scanning_page.dart
Normal file
|
|
@ -0,0 +1,86 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:queue_mgr/backend/DataManager.dart';
|
||||||
|
|
||||||
|
class ScanningPage extends StatefulWidget {
|
||||||
|
ScanningPage({super.key,required this.id});
|
||||||
|
String id;
|
||||||
|
@override
|
||||||
|
State<ScanningPage> createState() => _ScanningPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ScanningPageState extends State<ScanningPage> {
|
||||||
|
int tokenID = 0;
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
Map<String, dynamic> service = DataManager.instance().GetServiceById(widget.id.toString());
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(title: Text("${service['name']} - Scan Mode"),),
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.all(18.0),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.token),
|
||||||
|
Text(" Token ID"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Text(tokenID.toString(),style: TextStyle(fontSize: 65),),
|
||||||
|
|
||||||
|
LimitedBox(
|
||||||
|
maxWidth: 300,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 30.0),
|
||||||
|
child: GridView.count(crossAxisCount: 3,shrinkWrap: true,children: List.generate(9, (index){
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: ElevatedButton(onPressed: (){OnButton(index+1);}, child: Text((index+1).toString(),style: TextStyle(fontSize: 20),)),
|
||||||
|
);
|
||||||
|
}),),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height:95,
|
||||||
|
width: 135,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 30.0,vertical: 10),
|
||||||
|
child: ElevatedButton(onPressed: (){OnButton(0);}, child: Text("0",style: TextStyle(fontSize: 20))),
|
||||||
|
)
|
||||||
|
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
ElevatedButton(onPressed: (){
|
||||||
|
tokenID=0;
|
||||||
|
setState(() {
|
||||||
|
|
||||||
|
});
|
||||||
|
}, child: Padding(
|
||||||
|
padding: const EdgeInsets.all(18.0),
|
||||||
|
child: Text("Clear",style: TextStyle(fontSize: 15)),
|
||||||
|
),),
|
||||||
|
ElevatedButton(onPressed: (){}, child: Padding(
|
||||||
|
padding: const EdgeInsets.all(18.0),
|
||||||
|
child: Text("Complete",style: TextStyle(fontSize: 15)),
|
||||||
|
))
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnButton(int num){
|
||||||
|
tokenID = int.parse(tokenID.toString() + num.toString());
|
||||||
|
setState(() {
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:queue_mgr/backend/DataManager.dart';
|
import 'package:queue_mgr/backend/DataManager.dart';
|
||||||
|
import 'package:queue_mgr/scanning_page.dart';
|
||||||
|
|
||||||
class ServicePage extends StatefulWidget {
|
class ServicePage extends StatefulWidget {
|
||||||
ServicePage({super.key,required this.serviceId});
|
ServicePage({super.key,required this.serviceId});
|
||||||
|
|
@ -12,62 +13,110 @@ class _ServicePageState extends State<ServicePage> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Map<String, dynamic> service = DataManager.instance().GetServiceById(widget.serviceId.toString());
|
Map<String, dynamic> service = DataManager.instance().GetServiceById(widget.serviceId.toString());
|
||||||
|
List<String> members = service['members'].toString().split(',');
|
||||||
|
members.removeAt(0);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: Text(service['name']),),
|
appBar: AppBar(title: Text(service['name']),),
|
||||||
body: Padding(
|
body: SafeArea(
|
||||||
padding: const EdgeInsets.all(12.0),
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Padding(
|
||||||
children: [
|
padding: const EdgeInsets.all(12.0),
|
||||||
GridView.count(shrinkWrap: true,crossAxisCount: 2,children: [
|
child: Column(
|
||||||
Card(child:
|
children: [
|
||||||
Column(
|
GridView.count(shrinkWrap: true,crossAxisCount: 2,children: [
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
Card(child:
|
||||||
children: [
|
|
||||||
Row(mainAxisAlignment: MainAxisAlignment.center,children: [Icon(Icons.play_arrow),Text(" Starting Time")],),
|
|
||||||
Column(
|
Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
Text(dateFormat.format(DateTime.parse(service['start_time']))),
|
Row(mainAxisAlignment: MainAxisAlignment.center,children: [Icon(Icons.play_arrow),Text(" Starting Time")],),
|
||||||
Text(timeFormat.format(DateTime.parse(service['start_time'])),style: TextStyle(fontSize: 20)),
|
Column(
|
||||||
|
children: [
|
||||||
|
Text(dateFormat.format(DateTime.parse(service['start_time']))),
|
||||||
|
Text(timeFormat.format(DateTime.parse(service['start_time'])),style: TextStyle(fontSize: 20)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Container(height: 20,)
|
||||||
|
],
|
||||||
|
),),
|
||||||
|
Card(child:
|
||||||
|
Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
Row(mainAxisAlignment: MainAxisAlignment.center,children: [Icon(Icons.stop),Text(" Ending Time")],),
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
Text(dateFormat.format(DateTime.parse(service['end_time']))),
|
||||||
|
Text(timeFormat.format(DateTime.parse(service['end_time'])),style: TextStyle(fontSize: 20)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Container(height: 20,)
|
||||||
|
],
|
||||||
|
),),
|
||||||
|
|
||||||
|
],),
|
||||||
|
Card(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(12.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.people_alt_rounded),
|
||||||
|
Text(" Queue Length"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Text(members.length.toString(),style: TextStyle(fontSize: 25),)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Container(height: 20,)
|
),
|
||||||
],
|
),
|
||||||
),),
|
SizedBox(
|
||||||
Card(child:
|
height: 50,
|
||||||
Column(
|
),
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
ElevatedButton(onPressed: (){
|
||||||
children: [
|
Navigator.of(context).push(MaterialPageRoute(builder: (context)=> ScanningPage(id: widget.serviceId)));
|
||||||
Row(mainAxisAlignment: MainAxisAlignment.center,children: [Icon(Icons.stop),Text(" Ending Time")],),
|
}, child: Padding(
|
||||||
Column(
|
padding: const EdgeInsets.all(20.0),
|
||||||
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Text(dateFormat.format(DateTime.parse(service['end_time']))),
|
Icon(Icons.qr_code_scanner),
|
||||||
Text(timeFormat.format(DateTime.parse(service['end_time'])),style: TextStyle(fontSize: 20)),
|
SizedBox(height: 10,),
|
||||||
|
Text("Scan Mode"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Container(height: 20,)
|
)),
|
||||||
],
|
SizedBox(height: 50,),
|
||||||
),),
|
(members.length >0) ? Card(
|
||||||
|
child: Padding(
|
||||||
],),
|
padding: const EdgeInsets.all(8.0),
|
||||||
Card(
|
child: Column(
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(12.0),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.people_alt_rounded),
|
Row(mainAxisAlignment: MainAxisAlignment.center,children: [
|
||||||
Text(" Queue Length"),
|
Icon(Icons.emoji_people),
|
||||||
|
Text(" Queue")
|
||||||
|
],),
|
||||||
|
SizedBox(height: 20,),
|
||||||
|
GridView.count(
|
||||||
|
crossAxisCount: 5,
|
||||||
|
mainAxisSpacing: 10,
|
||||||
|
crossAxisSpacing: 10,
|
||||||
|
shrinkWrap: true,
|
||||||
|
children: List.generate(members.length, (index){
|
||||||
|
if(members[index].length <=0){return Container();}
|
||||||
|
return Container(decoration: BoxDecoration(borderRadius: BorderRadius.circular(20),color: Colors.black.withOpacity(0.2)),child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Center(child: Text(members[index],style: TextStyle(fontSize: 18),)),
|
||||||
|
));
|
||||||
|
}),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Text(service['members'].toString().split(',').length.toString(),style: TextStyle(fontSize: 25),)
|
),
|
||||||
],
|
) : Container()
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user