Updates
parent
7587bc0062
commit
1428fd6480
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 297 297" style="enable-background:new 0 0 297 297;" xml:space="preserve">
|
||||
<path d="M251.01,277.015h-17.683l-0.002-31.559c0-31.639-17.358-60.726-48.876-81.901c-3.988-2.682-6.466-8.45-6.466-15.055
|
||||
s2.478-12.373,6.464-15.053c31.52-21.178,48.878-50.264,48.88-81.904V19.985h17.683c5.518,0,9.992-4.475,9.992-9.993
|
||||
c0-5.518-4.475-9.992-9.992-9.992H45.99c-5.518,0-9.992,4.475-9.992,9.992c0,5.519,4.475,9.993,9.992,9.993h17.683v31.558
|
||||
c0,31.642,17.357,60.729,48.875,81.903c3.989,2.681,6.467,8.448,6.467,15.054c0,6.605-2.478,12.373-6.466,15.053
|
||||
c-31.519,21.176-48.876,50.263-48.876,81.903v31.559H45.99c-5.518,0-9.992,4.475-9.992,9.993c0,5.519,4.475,9.992,9.992,9.992
|
||||
h205.02c5.518,0,9.992-4.474,9.992-9.992C261.002,281.489,256.527,277.015,251.01,277.015z M138.508,110.362
|
||||
c0-5.518,4.474-9.993,9.992-9.993s9.992,4.475,9.992,9.993v17.664c0,5.519-4.474,9.992-9.992,9.992s-9.992-4.474-9.992-9.992
|
||||
V110.362z M141.433,173.956c1.858-1.857,4.436-2.927,7.064-2.927c2.628,0,5.206,1.069,7.064,2.927
|
||||
c1.868,1.859,2.928,4.438,2.928,7.065s-1.06,5.206-2.928,7.064c-1.858,1.858-4.436,2.928-7.064,2.928
|
||||
c-2.628,0-5.206-1.069-7.064-2.928c-1.859-1.858-2.928-4.437-2.928-7.064S139.573,175.816,141.433,173.956z M86.94,277.112
|
||||
c8.152-30.906,50.161-64.536,55.405-68.635c3.614-2.826,8.692-2.828,12.309,0c5.244,4.1,47.252,37.729,55.404,68.635H86.94z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,47 @@
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:queuing_system/core/base/base_app_client.dart';
|
||||
import 'package:queuing_system/core/response_model/patient_call.dart';
|
||||
|
||||
const _getCallRequestInfoByClinicInfo = "/GetCallRequestInfoByClinincInfo";
|
||||
const _call_UpdateNotIsQueueRecordByIDAsync = "/Call_UpdateNotIsQueueRecordByIDAsync";
|
||||
|
||||
class API{
|
||||
|
||||
static GetCallRequestInfoByClinincInfo(String deviceIp, {@required Function(List<Tickets>, List<Tickets>) onSuccess, @required Function(dynamic) onFailure}) async{
|
||||
final body = { "IPAdress" : deviceIp };
|
||||
BaseAppClient.post(_getCallRequestInfoByClinicInfo, body: body, onSuccess: (response, status){
|
||||
if(status == 200){
|
||||
final calledByNurse = (response["CalledByNurse"] as List).map((j) => Tickets.fromJson(j)).toList();
|
||||
final clinicCurrentPatient = (response["ClinicCurrentPatient"] as List).map((j) => Tickets.fromJson(j)).toList();
|
||||
onSuccess(calledByNurse, clinicCurrentPatient);
|
||||
}else{
|
||||
onFailure(response);
|
||||
}
|
||||
}, onFailure: (error, status) => onFailure(error));
|
||||
}
|
||||
|
||||
static Call_UpdateNotIsQueueRecordByIDAsync(String deviceIp, {@required List<Tickets> tickets, @required Function(List<Tickets>) onSuccess, @required Function(dynamic) onFailure}) async{
|
||||
if(tickets.isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Tickets> _ticketsUpdated = [];
|
||||
|
||||
for (var ticket in tickets) {
|
||||
final body = { "CallID" : ticket.callNo};
|
||||
await BaseAppClient.post(_call_UpdateNotIsQueueRecordByIDAsync, body: body, onSuccess: (response, status){
|
||||
if(status == 200){
|
||||
ticket.call_updated = true;
|
||||
_ticketsUpdated.add(ticket);
|
||||
}
|
||||
}, onFailure: (error, status) => onFailure(error));
|
||||
}
|
||||
|
||||
if(_ticketsUpdated.isNotEmpty) {
|
||||
onSuccess(_ticketsUpdated);
|
||||
}else{
|
||||
onFailure(false);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:queuing_system/utils/call_type.dart';
|
||||
|
||||
class Tickets {
|
||||
Tickets({
|
||||
this.callNo,
|
||||
this.roomNo,
|
||||
this.callType,
|
||||
this.createdON,
|
||||
this.doctorName,
|
||||
this.doctorNameN,
|
||||
this.editedON,
|
||||
this.mobileNo,
|
||||
this.patientGender,
|
||||
this.patientID,
|
||||
this.queueNo,});
|
||||
|
||||
Tickets.fromJson(dynamic json) {
|
||||
callNo = json['CallNo'];
|
||||
roomNo = json['RoomNo'];
|
||||
callType = json['CallType'];
|
||||
createdON = json['CreatedON'];
|
||||
doctorName = json['DoctorName'];
|
||||
doctorNameN = json['DoctorNameN'];
|
||||
editedON = json['EditedON'];
|
||||
mobileNo = json['MobileNo'];
|
||||
patientGender = json['PatientGender'];
|
||||
patientID = json['PatientID'];
|
||||
queueNo = json['QueueNo'];
|
||||
}
|
||||
|
||||
int callNo;
|
||||
String roomNo;
|
||||
int callType;
|
||||
String createdON;
|
||||
String doctorName;
|
||||
String doctorNameN;
|
||||
String editedON;
|
||||
String mobileNo;
|
||||
int patientGender;
|
||||
int patientID;
|
||||
String queueNo;
|
||||
bool call_updated = false;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['CallNo'] = callNo;
|
||||
map['RoomNo'] = roomNo;
|
||||
map['CallType'] = callType;
|
||||
map['CreatedON'] = createdON;
|
||||
map['DoctorName'] = doctorName;
|
||||
map['DoctorNameN'] = doctorNameN;
|
||||
map['EditedON'] = editedON;
|
||||
map['MobileNo'] = mobileNo;
|
||||
map['PatientGender'] = patientGender;
|
||||
map['PatientID'] = patientID;
|
||||
map['QueueNo'] = queueNo;
|
||||
return map;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return (callNo).toString();
|
||||
}
|
||||
|
||||
CallType getCallType(){
|
||||
if(callType == 0) return CallType.RECEPTION;
|
||||
if(callType == 1) return CallType.NURSE;
|
||||
if(callType == 2) return CallType.DOCTOR;
|
||||
return CallType.NONE;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
import 'dart:convert';
|
||||
Xyz xyzFromJson(String str) => Xyz.fromJson(json.decode(str));
|
||||
String xyzToJson(Xyz data) => json.encode(data.toJson());
|
||||
class Xyz {
|
||||
Xyz({
|
||||
this.callNo,
|
||||
this.roomNo,
|
||||
this.callType,
|
||||
this.createdON,
|
||||
this.doctorName,
|
||||
this.doctorNameN,
|
||||
this.editedON,
|
||||
this.mobileNo,
|
||||
this.patientGender,
|
||||
this.patientID,
|
||||
this.queueNo,});
|
||||
|
||||
Xyz.fromJson(dynamic json) {
|
||||
callNo = json['CallNo'];
|
||||
roomNo = json['RoomNo'];
|
||||
callType = json['CallType'];
|
||||
createdON = json['CreatedON'];
|
||||
doctorName = json['DoctorName'];
|
||||
doctorNameN = json['DoctorNameN'];
|
||||
editedON = json['EditedON'];
|
||||
mobileNo = json['MobileNo'];
|
||||
patientGender = json['PatientGender'];
|
||||
patientID = json['PatientID'];
|
||||
queueNo = json['QueueNo'];
|
||||
}
|
||||
int callNo;
|
||||
String roomNo;
|
||||
int callType;
|
||||
String createdON;
|
||||
String doctorName;
|
||||
String doctorNameN;
|
||||
String editedON;
|
||||
String mobileNo;
|
||||
int patientGender;
|
||||
int patientID;
|
||||
String queueNo;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['CallNo'] = callNo;
|
||||
map['RoomNo'] = roomNo;
|
||||
map['CallType'] = callType;
|
||||
map['CreatedON'] = createdON;
|
||||
map['DoctorName'] = doctorName;
|
||||
map['DoctorNameN'] = doctorNameN;
|
||||
map['EditedON'] = editedON;
|
||||
map['MobileNo'] = mobileNo;
|
||||
map['PatientGender'] = patientGender;
|
||||
map['PatientID'] = patientID;
|
||||
map['QueueNo'] = queueNo;
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
@ -1,181 +1,195 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
import 'package:connectivity/connectivity.dart';
|
||||
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/core/response_model/patient_call.dart';
|
||||
import 'package:queuing_system/header/app_header.dart';
|
||||
import 'package:queuing_system/home/home_screen_components.dart';
|
||||
import 'package:queuing_system/home/que_item_list.dart';
|
||||
import 'package:queuing_system/utils/call_by_voice.dart';
|
||||
import 'package:queuing_system/utils/call_type.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 'package:signalr_core/signalr_core.dart';
|
||||
import 'package:text_to_speech/text_to_speech.dart';
|
||||
import 'first_column.dart';
|
||||
|
||||
|
||||
var DEVICE_IP = "10.20.20.19"; // Testing IP
|
||||
// var DEVICE_IP = "10.70.249.21"; // (Make sure by Haroon before use it) Production IP
|
||||
|
||||
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;
|
||||
SignalRHelper signalRHelper = SignalRHelper();
|
||||
|
||||
final _tts = TextToSpeech();
|
||||
|
||||
List<Tickets> waitings = [];
|
||||
List<Tickets> currents = [];
|
||||
|
||||
@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();
|
||||
SignalRHelper signalRHelper = new SignalRHelper();
|
||||
if (!signalRHelper.getConnectionState()) signalRHelper.startSignalRConnection();
|
||||
listenNetworkConnectivity();
|
||||
|
||||
if (!signalRHelper.getConnectionState()) {
|
||||
signalRHelper.startSignalRConnection(
|
||||
DEVICE_IP,
|
||||
onUpdateAvailable: onUpdateAvailable,
|
||||
onConnect: onConnect,
|
||||
onConnecting: onConnecting,
|
||||
onDisconnect: onDisconnect
|
||||
);
|
||||
}
|
||||
|
||||
_tts.setLanguage("en");
|
||||
_tts.setRate(0.7);
|
||||
|
||||
// _tts.getVoiceByLang('en').then((value){
|
||||
//
|
||||
// })
|
||||
_tts.getVoice().then((value){
|
||||
_tts.setVoice(value[2]);
|
||||
});
|
||||
|
||||
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',
|
||||
letterSpacing: -1.56,
|
||||
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,
|
||||
body: content(),
|
||||
bottomNavigationBar: Container(
|
||||
color: Colors.grey.withOpacity(0.1),
|
||||
height: Utils.getHeight(),
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 30, left: 30),
|
||||
child: AppText(
|
||||
"Powered By",
|
||||
letterSpacing: -1.56,
|
||||
fontSize: SizeConfig.getWidthMultiplier() * 2.6,
|
||||
fontFamily: 'Poppins-Medium.ttf',
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
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,
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
Image.asset(
|
||||
"assets/images/cloud_logo.png",
|
||||
height: SizeConfig.getHeightMultiplier() * 4,
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
],
|
||||
),
|
||||
), // This trailing comma makes auto-formatting nicer for build methods.
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget content(){
|
||||
// waitings = waitings.sublist(0,3);
|
||||
voiceCall();
|
||||
|
||||
if(waitings.isEmpty) {
|
||||
// No Patient in Queue
|
||||
return noPatientInQueue();
|
||||
|
||||
}else if(waitings.length > 4){
|
||||
// Return Content With Side List
|
||||
return priorityTicketsWithSideList(waitings);
|
||||
|
||||
}else{
|
||||
// Return Content In Center Aligned
|
||||
return priorityTickets(waitings);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CallByVoice voiceCaller;
|
||||
voiceCall() async{
|
||||
if(waitings.isNotEmpty && voiceCaller == null){
|
||||
final postVoice = waitings.first.getCallType().audio('en');
|
||||
voiceCaller = CallByVoice(waitings.first.callNo.toString(), preVoice: 'ticket_number.mp3', postVoice: postVoice, lang: 'en');
|
||||
await voiceCaller.start();
|
||||
voiceCaller = null;
|
||||
}
|
||||
}
|
||||
|
||||
onUpdateAvailable(data) async{
|
||||
API.GetCallRequestInfoByClinincInfo(
|
||||
DEVICE_IP,
|
||||
onSuccess: (waitingCalls, currentInClinic){
|
||||
|
||||
setState(() {
|
||||
waitings = waitingCalls;
|
||||
currents = currentInClinic;
|
||||
});
|
||||
|
||||
print("\n\n");
|
||||
print("--------------------");
|
||||
print("Current: $currentInClinic");
|
||||
print("Waiting: $waitingCalls");
|
||||
print("--------------------");
|
||||
print("\n\n");
|
||||
|
||||
updateTickets();
|
||||
|
||||
}, onFailure: (error){
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
updateTickets(){
|
||||
List<Tickets> _ticketsToUpdate = waitings.where((t) => t.call_updated == false);
|
||||
API.Call_UpdateNotIsQueueRecordByIDAsync(DEVICE_IP, tickets: _ticketsToUpdate, onSuccess: (tickets_updated){
|
||||
print("[${tickets_updated.length}] Tickets Updated: $tickets_updated");
|
||||
}, onFailure: (e){
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
onConnect(){
|
||||
print("SignalR: onConnect");
|
||||
}
|
||||
|
||||
onDisconnect(exception){
|
||||
print("SignalR: onDisconnect");
|
||||
}
|
||||
|
||||
onConnecting(){
|
||||
print("SignalR: onConnecting");
|
||||
}
|
||||
|
||||
listenNetworkConnectivity() async{
|
||||
Connectivity().onConnectivityChanged.listen((event) {
|
||||
switch (event) {
|
||||
case ConnectivityResult.wifi:
|
||||
signalRHelper.connection.start();
|
||||
break;
|
||||
case ConnectivityResult.none:
|
||||
signalRHelper.closeConnection(context);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +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){
|
||||
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:queuing_system/core/config/config.dart';
|
||||
import 'package:queuing_system/core/config/size_config.dart';
|
||||
import 'package:queuing_system/core/response_model/patient_call.dart';
|
||||
import 'package:queuing_system/home/priority_calls.dart';
|
||||
import 'package:queuing_system/utils/call_type.dart';
|
||||
import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
|
||||
|
||||
Widget noPatientInQueue(){
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Center(
|
||||
child: AppText("Awaiting Patients Arrival",
|
||||
fontFamily: 'Poppins-SemiBold.ttf',
|
||||
fontSize: SizeConfig.getWidthMultiplier() * 9),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget priorityTickets(List<Tickets> tickets){
|
||||
return PriorityTickets(tickets);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Widget priorityTicketsWithSideList(List<Tickets> tickets){
|
||||
final priorityTickets = tickets.sublist(0,3);
|
||||
final otherTickets = tickets.sublist(3,tickets.length);
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: PriorityTickets(priorityTickets)
|
||||
),
|
||||
Container(color: Colors.grey.withOpacity(0.1), width: 10, margin: const EdgeInsets.symmetric(horizontal: 20, vertical: 50)),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 50),
|
||||
itemCount: otherTickets.length,
|
||||
itemBuilder: (ctx,idx){
|
||||
|
||||
final itm = otherTickets[idx];
|
||||
final isDoctor = itm.callType == 1;
|
||||
|
||||
final icon = "assets/images/${isDoctor ? 'doctoricon' : 'nurseicon'}.svg";
|
||||
final title = "Please Visit ${isDoctor ? 'Doctor' : 'Nurse'}";
|
||||
final color = isDoctor ? AppGlobal.appRedColor : AppGlobal.appGreenColor;
|
||||
|
||||
return ListTile(
|
||||
contentPadding: const EdgeInsets.all(8),
|
||||
title: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 140,
|
||||
child: AppText(
|
||||
itm.callNo.toString(),
|
||||
letterSpacing: -2.32,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: SizeConfig.getWidthMultiplier() * 5,
|
||||
textAlign: TextAlign.end,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
itm.getCallType().icon(SizeConfig.getHeightMultiplier()*2.5),
|
||||
const SizedBox(width: 10),
|
||||
AppText(
|
||||
itm.getCallType().message('en'),
|
||||
color: itm.getCallType().color(),
|
||||
letterSpacing: -1.5,
|
||||
fontSize: SizeConfig.getWidthMultiplier() * 3.3,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontHeight: 0.5,
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
import 'package:blinking_text/blinking_text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:queuing_system/core/config/config.dart';
|
||||
import 'package:queuing_system/core/config/size_config.dart';
|
||||
import 'package:queuing_system/core/response_model/patient_call.dart';
|
||||
import 'package:queuing_system/home/que_item/que_item.dart';
|
||||
import 'package:queuing_system/utils/call_type.dart';
|
||||
import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
|
||||
|
||||
class PriorityTickets extends StatelessWidget {
|
||||
List<Tickets> tickets;
|
||||
|
||||
PriorityTickets(this.tickets, {Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
final firstTicket = tickets[0];
|
||||
final otherTickets = tickets.sublist(1,tickets.length);
|
||||
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
|
||||
vTicketItem(ticketNo: "${firstTicket.callNo ?? ''}", callType: firstTicket.getCallType(), scale: 1.2, blink: true),
|
||||
|
||||
const SizedBox(height: 100),
|
||||
|
||||
if(tickets.length > 1)
|
||||
...[
|
||||
SizedBox(height: SizeConfig.getHeightMultiplier()*1.5),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: otherTickets.map((ticket) => vTicketItem(ticketNo: "${ticket.callNo ?? ''}", callType: ticket.getCallType(), scale: 0.8)).toList(),
|
||||
)
|
||||
]
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class vTicketItem extends StatelessWidget{
|
||||
final String ticketNo;
|
||||
final CallType callType;
|
||||
final bool blink;
|
||||
final double scale;
|
||||
vTicketItem({@required this.ticketNo, @required this.callType, this.scale, this.blink = false});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return Transform.scale(
|
||||
scale: scale,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
BlinkText(
|
||||
ticketNo,
|
||||
style: TextStyle(
|
||||
fontSize: SizeConfig.getWidthMultiplier() * 16,
|
||||
letterSpacing: -9.32,
|
||||
height: 0.5,
|
||||
fontWeight: FontWeight.bold
|
||||
),
|
||||
beginColor: Colors.black,
|
||||
endColor: blink ? Colors.black.withOpacity(0.1) : Colors.black,
|
||||
// endColor: blink ? AppGlobal.appRedColor : Colors.black,
|
||||
times: 0,
|
||||
duration: const Duration(seconds: 1)
|
||||
),
|
||||
// AppText(
|
||||
// ticketNo,
|
||||
// letterSpacing: -9.32,
|
||||
// fontSize: SizeConfig.getWidthMultiplier() * 16,
|
||||
// fontWeight: FontWeight.bold,
|
||||
// fontHeight: 0.7,
|
||||
// ),
|
||||
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
callType.icon(SizeConfig.getHeightMultiplier()*2.5),
|
||||
const SizedBox(width: 10),
|
||||
AppText(
|
||||
callType.message('en'),
|
||||
color: callType.color(),
|
||||
letterSpacing: -1.5,
|
||||
fontSize: SizeConfig.getWidthMultiplier() * 3.3,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontHeight: 0.5,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:just_audio/just_audio.dart';
|
||||
import 'package:queuing_system/utils/call_type.dart';
|
||||
|
||||
class CallByVoice{
|
||||
|
||||
final String lang;
|
||||
final String preVoice;
|
||||
final String ticketNo;
|
||||
final String postVoice;
|
||||
|
||||
CallByVoice(this.ticketNo, {this.lang = 'en', @required this.preVoice, @required this.postVoice});
|
||||
|
||||
final _player = AudioPlayer();
|
||||
start() async{
|
||||
|
||||
// Create Pre Voice Players
|
||||
if(preVoice != null && preVoice.isNotEmpty) {
|
||||
await _player.setAsset('assets/voice_$lang/$preVoice');
|
||||
await _player.play();
|
||||
}
|
||||
|
||||
// Create Ticket Number Voice Players
|
||||
final characters = ticketNo.characters.toList();
|
||||
for(int i = 0; i< characters.length; i++){
|
||||
final no = characters[i];
|
||||
if(no.isNotEmpty){
|
||||
await Future.delayed(const Duration(milliseconds: 200));
|
||||
|
||||
await _player.stop();
|
||||
await _player.setAsset('assets/voice_$lang/$no.mp3');
|
||||
await _player.play();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Create Post Voice Players
|
||||
if(postVoice != null && postVoice.isNotEmpty) {
|
||||
await Future.delayed(const Duration(milliseconds: 1000));
|
||||
|
||||
await _player.stop();
|
||||
await _player.setAsset('assets/voice_$lang/$postVoice');
|
||||
await _player.play();
|
||||
}
|
||||
|
||||
_player.dispose();
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:queuing_system/core/config/config.dart';
|
||||
|
||||
enum CallType{
|
||||
RECEPTION,
|
||||
NURSE,
|
||||
DOCTOR,
|
||||
NONE,
|
||||
}
|
||||
|
||||
extension xCallType on CallType{
|
||||
|
||||
Color color(){
|
||||
if(this == CallType.RECEPTION) {
|
||||
return AppGlobal.appRedColor;
|
||||
}else if(this == CallType.NURSE) {
|
||||
return AppGlobal.appGreenColor;
|
||||
}else if(this == CallType.DOCTOR) {
|
||||
return AppGlobal.appRedColor ;
|
||||
}else{
|
||||
return Colors.black54;
|
||||
}
|
||||
}
|
||||
|
||||
SvgPicture icon(double height,){
|
||||
if(this == CallType.RECEPTION) {
|
||||
return SvgPicture.asset("assets/images/doctoricon.svg", height: height, color: color());
|
||||
}else if(this == CallType.NURSE) {
|
||||
return SvgPicture.asset("assets/images/nurseicon.svg", height: height, color: color());
|
||||
}else if(this == CallType.DOCTOR) {
|
||||
return SvgPicture.asset("assets/images/doctoricon.svg", height: height, color: color());
|
||||
}
|
||||
return SvgPicture.asset("assets/images/wait.svg", height: height, color: color());;
|
||||
}
|
||||
|
||||
String message(String lang){
|
||||
if(this == CallType.RECEPTION) {
|
||||
return "Please visit reception";
|
||||
}else if(this == CallType.NURSE) {
|
||||
return "Please visit nurse";
|
||||
}else if(this == CallType.DOCTOR) {
|
||||
return "Please visit doctor";
|
||||
}
|
||||
return "Please wait . . .";
|
||||
}
|
||||
|
||||
String audio(String lang){
|
||||
if(this == CallType.RECEPTION) {
|
||||
return "visit_doctor.mp3";
|
||||
}else if(this == CallType.NURSE) {
|
||||
return "visit_nurse.mp3";
|
||||
}else if(this == CallType.DOCTOR) {
|
||||
return "visit_doctor.mp3";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue