Pushing after callType Testing
parent
3295bbc9e1
commit
7e82746ce3
@ -1,205 +1,205 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:queuing_system/core/api.dart';
|
||||
import 'package:queuing_system/core/base/app_scaffold_widget.dart';
|
||||
import 'package:queuing_system/core/base/base_app_client.dart';
|
||||
import 'package:queuing_system/core/config/config.dart';
|
||||
import 'package:queuing_system/core/config/size_config.dart';
|
||||
import 'package:queuing_system/header/app_header.dart';
|
||||
import 'package:queuing_system/home/que_item_list.dart';
|
||||
import 'package:queuing_system/utils/signalR_utils.dart';
|
||||
import 'package:queuing_system/utils/utils.dart';
|
||||
import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
|
||||
import 'first_column.dart';
|
||||
|
||||
|
||||
var DEVICE_IP = "10.70.249.21";
|
||||
|
||||
class MyHomePage extends StatefulWidget {
|
||||
String title = "MyHomePage";
|
||||
bool have0Patient = true;
|
||||
bool have1Patient = false;
|
||||
bool have2Patient = false;
|
||||
bool have3Patient = false;
|
||||
bool haveListOfPatient = false;
|
||||
|
||||
@override
|
||||
State<MyHomePage> createState() => _MyHomePageState();
|
||||
}
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
Timer _timer;
|
||||
int remainingTime = 30;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_timer.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
startTimer() {
|
||||
Timer.periodic(const Duration(seconds: 1), (timer) {
|
||||
if (remainingTime == 0) {
|
||||
setState(() {
|
||||
remainingTime = 30;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
remainingTime--;
|
||||
if (remainingTime > 25) {
|
||||
|
||||
/// for 0 patinet
|
||||
widget.have0Patient = true;
|
||||
widget.have1Patient = false;
|
||||
widget.have2Patient = false;
|
||||
widget.have3Patient = false;
|
||||
widget.haveListOfPatient = false;
|
||||
} else if (remainingTime > 20) {
|
||||
/// for 1 patinet
|
||||
|
||||
widget.have0Patient = false;
|
||||
widget.have1Patient = true;
|
||||
widget.have2Patient = false;
|
||||
widget.have3Patient = false;
|
||||
widget.haveListOfPatient = false;
|
||||
} else if (remainingTime > 15) {
|
||||
|
||||
/// for 2 patinet
|
||||
|
||||
widget.have0Patient = false;
|
||||
widget.have1Patient = false;
|
||||
widget.have2Patient = true;
|
||||
widget.have3Patient = false;
|
||||
widget.haveListOfPatient = false;
|
||||
} else if (remainingTime > 10) {
|
||||
/// for 3 only patinet
|
||||
widget.have0Patient = false;
|
||||
widget.have1Patient = false;
|
||||
widget.have2Patient = false;
|
||||
widget.have3Patient = true;
|
||||
widget.haveListOfPatient = false;
|
||||
} else {
|
||||
/// for 3+ only patinet
|
||||
|
||||
widget.have0Patient = false;
|
||||
widget.have1Patient = false;
|
||||
widget.have2Patient = false;
|
||||
widget.have3Patient = true;
|
||||
widget.haveListOfPatient = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
startTimer();
|
||||
// Get Ticket Info
|
||||
// http://10.200.204.11:2222/Services/Nurses.svc/REST/GetCallRequestInfoByClinincInfo
|
||||
|
||||
SignalRHelper signalRHelper = SignalRHelper();
|
||||
if (!signalRHelper.getConnectionState()) {
|
||||
signalRHelper.startSignalRConnection(DEVICE_IP, onUpdateAvailable: onUpdateAvailable);
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
|
||||
return AppScaffold(
|
||||
appBar: AppHeader(),
|
||||
body: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: SizeConfig.getHeightMultiplier() *
|
||||
(widget.haveListOfPatient
|
||||
? 2
|
||||
: widget.have1Patient || widget.have0Patient
|
||||
? 20
|
||||
: 10)),
|
||||
widget.have0Patient
|
||||
? Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Center(
|
||||
child: AppText("Awaiting Patients Arrival",
|
||||
fontFamily: 'Poppins-SemiBold.ttf',
|
||||
fontSize: SizeConfig.getWidthMultiplier() * 9),
|
||||
),
|
||||
],
|
||||
)
|
||||
: widget.haveListOfPatient
|
||||
? Row(
|
||||
children: [
|
||||
FirstColumn(
|
||||
have3Patient: widget.have3Patient,
|
||||
have2Patient: widget.have2Patient,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 40,
|
||||
),
|
||||
if (widget.haveListOfPatient)
|
||||
Container(
|
||||
width: 10,
|
||||
height: SizeConfig.getHeightMultiplier() * 40,
|
||||
color: AppGlobal.appLightGreyColor,
|
||||
),
|
||||
if (widget.haveListOfPatient)
|
||||
const SizedBox(
|
||||
width: 40,
|
||||
),
|
||||
if (widget.haveListOfPatient) const QueItemList()
|
||||
],
|
||||
)
|
||||
: FirstColumn(
|
||||
have3Patient: widget.have3Patient,
|
||||
have2Patient: widget.have2Patient,
|
||||
),
|
||||
],
|
||||
),
|
||||
bottomSheet: Container(
|
||||
color: Colors.transparent,
|
||||
height: Utils.getHeight(),
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 30, left: 30),
|
||||
child: AppText(
|
||||
"Powered By",
|
||||
fontSize: SizeConfig.getWidthMultiplier() * 2.6,
|
||||
fontFamily: 'Poppins-Medium.ttf',
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 40, left: 18),
|
||||
child: Image.asset(
|
||||
"assets/images/cloud_logo.png",
|
||||
height: SizeConfig.getHeightMultiplier() * 6,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
), // This trailing comma makes auto-formatting nicer for build methods.
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
onUpdateAvailable(data) async{
|
||||
API.GetCallRequestInfoByClinincInfo(
|
||||
DEVICE_IP,
|
||||
onSuccess: (waitingCalls, currentInClinic){
|
||||
print("\n\n");
|
||||
print("--------------------");
|
||||
print("Current: $currentInClinic");
|
||||
print("Waiting: $waitingCalls");
|
||||
print("--------------------");
|
||||
print("\n\n");
|
||||
}, onFailure: (error){
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
// import 'dart:async';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:queuing_system/core/api.dart';
|
||||
// import 'package:queuing_system/core/base/app_scaffold_widget.dart';
|
||||
// import 'package:queuing_system/core/base/base_app_client.dart';
|
||||
// import 'package:queuing_system/core/config/config.dart';
|
||||
// import 'package:queuing_system/core/config/size_config.dart';
|
||||
// import 'package:queuing_system/header/app_header.dart';
|
||||
// import 'package:queuing_system/home/que_item_list.dart';
|
||||
// import 'package:queuing_system/utils/signalR_utils.dart';
|
||||
// import 'package:queuing_system/utils/utils.dart';
|
||||
// import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
|
||||
// import 'first_column.dart';
|
||||
//
|
||||
//
|
||||
// var DEVICE_IP = "10.70.249.21";
|
||||
//
|
||||
// class MyHomePage extends StatefulWidget {
|
||||
// String title = "MyHomePage";
|
||||
// bool have0Patient = true;
|
||||
// bool have1Patient = false;
|
||||
// bool have2Patient = false;
|
||||
// bool have3Patient = false;
|
||||
// bool haveListOfPatient = false;
|
||||
//
|
||||
// @override
|
||||
// State<MyHomePage> createState() => _MyHomePageState();
|
||||
// }
|
||||
//
|
||||
// class _MyHomePageState extends State<MyHomePage> {
|
||||
// Timer _timer;
|
||||
// int remainingTime = 30;
|
||||
//
|
||||
// @override
|
||||
// void dispose() {
|
||||
// _timer.cancel();
|
||||
// super.dispose();
|
||||
// }
|
||||
//
|
||||
// startTimer() {
|
||||
// Timer.periodic(const Duration(seconds: 1), (timer) {
|
||||
// if (remainingTime == 0) {
|
||||
// setState(() {
|
||||
// remainingTime = 30;
|
||||
// });
|
||||
// } else {
|
||||
// setState(() {
|
||||
// remainingTime--;
|
||||
// if (remainingTime > 25) {
|
||||
//
|
||||
// /// for 0 patinet
|
||||
// widget.have0Patient = true;
|
||||
// widget.have1Patient = false;
|
||||
// widget.have2Patient = false;
|
||||
// widget.have3Patient = false;
|
||||
// widget.haveListOfPatient = false;
|
||||
// } else if (remainingTime > 20) {
|
||||
// /// for 1 patinet
|
||||
//
|
||||
// widget.have0Patient = false;
|
||||
// widget.have1Patient = true;
|
||||
// widget.have2Patient = false;
|
||||
// widget.have3Patient = false;
|
||||
// widget.haveListOfPatient = false;
|
||||
// } else if (remainingTime > 15) {
|
||||
//
|
||||
// /// for 2 patinet
|
||||
//
|
||||
// widget.have0Patient = false;
|
||||
// widget.have1Patient = false;
|
||||
// widget.have2Patient = true;
|
||||
// widget.have3Patient = false;
|
||||
// widget.haveListOfPatient = false;
|
||||
// } else if (remainingTime > 10) {
|
||||
// /// for 3 only patinet
|
||||
// widget.have0Patient = false;
|
||||
// widget.have1Patient = false;
|
||||
// widget.have2Patient = false;
|
||||
// widget.have3Patient = true;
|
||||
// widget.haveListOfPatient = false;
|
||||
// } else {
|
||||
// /// for 3+ only patinet
|
||||
//
|
||||
// widget.have0Patient = false;
|
||||
// widget.have1Patient = false;
|
||||
// widget.have2Patient = false;
|
||||
// widget.have3Patient = true;
|
||||
// widget.haveListOfPatient = true;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// void initState() {
|
||||
// startTimer();
|
||||
// // Get Ticket Info
|
||||
// // http://10.200.204.11:2222/Services/Nurses.svc/REST/GetCallRequestInfoByClinincInfo
|
||||
//
|
||||
// SignalRHelper signalRHelper = SignalRHelper();
|
||||
// if (!signalRHelper.getConnectionState()) {
|
||||
// signalRHelper.startSignalRConnection(DEVICE_IP, onUpdateAvailable: onUpdateAvailable);
|
||||
// }
|
||||
// super.initState();
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
//
|
||||
//
|
||||
// return AppScaffold(
|
||||
// appBar: AppHeader(),
|
||||
// body: Column(
|
||||
// children: [
|
||||
// SizedBox(
|
||||
// height: SizeConfig.getHeightMultiplier() *
|
||||
// (widget.haveListOfPatient
|
||||
// ? 2
|
||||
// : widget.have1Patient || widget.have0Patient
|
||||
// ? 20
|
||||
// : 10)),
|
||||
// widget.have0Patient
|
||||
// ? Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Center(
|
||||
// child: AppText("Awaiting Patients Arrival",
|
||||
// fontFamily: 'Poppins-SemiBold.ttf',
|
||||
// fontSize: SizeConfig.getWidthMultiplier() * 9),
|
||||
// ),
|
||||
// ],
|
||||
// )
|
||||
// : widget.haveListOfPatient
|
||||
// ? Row(
|
||||
// children: [
|
||||
// FirstColumn(
|
||||
// have3Patient: widget.have3Patient,
|
||||
// have2Patient: widget.have2Patient,
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// width: 40,
|
||||
// ),
|
||||
// if (widget.haveListOfPatient)
|
||||
// Container(
|
||||
// width: 10,
|
||||
// height: SizeConfig.getHeightMultiplier() * 40,
|
||||
// color: AppGlobal.appLightGreyColor,
|
||||
// ),
|
||||
// if (widget.haveListOfPatient)
|
||||
// const SizedBox(
|
||||
// width: 40,
|
||||
// ),
|
||||
// if (widget.haveListOfPatient) const QueItemList()
|
||||
// ],
|
||||
// )
|
||||
// : FirstColumn(
|
||||
// have3Patient: widget.have3Patient,
|
||||
// have2Patient: widget.have2Patient,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// bottomSheet: Container(
|
||||
// color: Colors.transparent,
|
||||
// height: Utils.getHeight(),
|
||||
// width: double.infinity,
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(top: 30, left: 30),
|
||||
// child: AppText(
|
||||
// "Powered By",
|
||||
// fontSize: SizeConfig.getWidthMultiplier() * 2.6,
|
||||
// fontFamily: 'Poppins-Medium.ttf',
|
||||
// ),
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(top: 40, left: 18),
|
||||
// child: Image.asset(
|
||||
// "assets/images/cloud_logo.png",
|
||||
// height: SizeConfig.getHeightMultiplier() * 6,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ), // This trailing comma makes auto-formatting nicer for build methods.
|
||||
// );
|
||||
// }
|
||||
//
|
||||
//
|
||||
// onUpdateAvailable(data) async{
|
||||
// API.GetCallRequestInfoByClinincInfo(
|
||||
// DEVICE_IP,
|
||||
// onSuccess: (waitingCalls, currentInClinic){
|
||||
// print("\n\n");
|
||||
// print("--------------------");
|
||||
// print("Current: $currentInClinic");
|
||||
// print("Waiting: $waitingCalls");
|
||||
// print("--------------------");
|
||||
// print("\n\n");
|
||||
// }, onFailure: (error){
|
||||
//
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
Loading…
Reference in New Issue