Structure Update
parent
1a3ed42951
commit
f524cee132
@ -1,9 +0,0 @@
|
|||||||
//
|
|
||||||
// class BaseService {
|
|
||||||
// String error;
|
|
||||||
// bool hasError = false;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// BaseService() {
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
@ -1,50 +0,0 @@
|
|||||||
// import 'package:flutter/material.dart';
|
|
||||||
// import 'package:provider/provider.dart';
|
|
||||||
//
|
|
||||||
// import 'base_view_model.dart';
|
|
||||||
// import 'locater.dart';
|
|
||||||
//
|
|
||||||
// class BaseView<T extends BaseViewModel> extends StatefulWidget {
|
|
||||||
// final Widget Function(BuildContext context, T model, Widget child) builder;
|
|
||||||
// final Function(T) onModelReady;
|
|
||||||
//
|
|
||||||
// BaseView({
|
|
||||||
// this.builder,
|
|
||||||
// this.onModelReady,
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// _BaseViewState<T> createState() => _BaseViewState<T>();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class _BaseViewState<T extends BaseViewModel> extends State<BaseView<T>> {
|
|
||||||
// T model = locator<T>();
|
|
||||||
//
|
|
||||||
// bool isLogin = false;
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// void initState() {
|
|
||||||
// if (widget.onModelReady != null) {
|
|
||||||
// widget.onModelReady(model);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// super.initState();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// return ChangeNotifierProvider<T>.value(
|
|
||||||
// value: model,
|
|
||||||
// child: Consumer<T>(builder: widget.builder),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// void dispose() {
|
|
||||||
// if (model != null) {
|
|
||||||
// model = null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// super.dispose();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:connectivity/connectivity.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:queuing_system/core/base/view_state.dart';
|
|
||||||
|
|
||||||
class BaseViewModel extends ChangeNotifier {
|
|
||||||
|
|
||||||
ViewState _state = ViewState.Idle;
|
|
||||||
bool isInternetConnection = true;
|
|
||||||
StreamSubscription subscription;
|
|
||||||
|
|
||||||
ViewState get state => _state;
|
|
||||||
|
|
||||||
String error = "";
|
|
||||||
void setState(ViewState viewState) {
|
|
||||||
_state = viewState;
|
|
||||||
|
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
BaseViewModel(){
|
|
||||||
subscription = Connectivity()
|
|
||||||
.onConnectivityChanged
|
|
||||||
.listen((ConnectivityResult result) {
|
|
||||||
switch (result) {
|
|
||||||
case ConnectivityResult.wifi:
|
|
||||||
isInternetConnection = true;
|
|
||||||
break;
|
|
||||||
case ConnectivityResult.mobile:
|
|
||||||
isInternetConnection = true;
|
|
||||||
break;
|
|
||||||
case ConnectivityResult.none:
|
|
||||||
isInternetConnection = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
notifyListeners();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
import 'package:get_it/get_it.dart';
|
|
||||||
|
|
||||||
GetIt locator = GetIt.instance;
|
|
||||||
|
|
||||||
///di
|
|
||||||
void setupLocator() {
|
|
||||||
/// Services
|
|
||||||
|
|
||||||
/// View Model
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:queuing_system/core/base/view_state.dart';
|
|
||||||
import 'package:queuing_system/widget/app_loader_widget.dart';
|
|
||||||
import 'package:queuing_system/widget/errors/error_message.dart';
|
|
||||||
|
|
||||||
import 'base_view_model.dart';
|
|
||||||
|
|
||||||
class NetworkBaseView extends StatelessWidget {
|
|
||||||
final BaseViewModel baseViewModel;
|
|
||||||
final Widget child;
|
|
||||||
|
|
||||||
NetworkBaseView({Key key, this.baseViewModel, this.child});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
color: Colors.grey[100],
|
|
||||||
child: buildBaseViewWidget(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
buildBaseViewWidget() {
|
|
||||||
switch (baseViewModel.state) {
|
|
||||||
case ViewState.ErrorLocal:
|
|
||||||
case ViewState.Idle:
|
|
||||||
case ViewState.BusyLocal:
|
|
||||||
return child;
|
|
||||||
break;
|
|
||||||
case ViewState.Busy:
|
|
||||||
return AppLoaderWidget();
|
|
||||||
break;
|
|
||||||
case ViewState.Error:
|
|
||||||
return ErrorMessage(
|
|
||||||
error: baseViewModel.error,
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:connectivity/connectivity.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:queuing_system/core/base/base_app_client.dart';
|
|
||||||
|
|
||||||
|
|
||||||
class ProjectViewModel with ChangeNotifier {
|
|
||||||
Locale _appLocale;
|
|
||||||
String currentLanguage = 'ar';
|
|
||||||
bool _isArabic = false;
|
|
||||||
bool isInternetConnection = true;
|
|
||||||
bool isLoading = false;
|
|
||||||
bool isError = false;
|
|
||||||
String error = '';
|
|
||||||
BaseAppClient baseAppClient = BaseAppClient();
|
|
||||||
|
|
||||||
Locale get appLocal => _appLocale;
|
|
||||||
|
|
||||||
bool get isArabic => _isArabic;
|
|
||||||
StreamSubscription subscription;
|
|
||||||
|
|
||||||
ProjectViewModel() {
|
|
||||||
|
|
||||||
subscription = Connectivity()
|
|
||||||
.onConnectivityChanged
|
|
||||||
.listen((ConnectivityResult result) {
|
|
||||||
switch (result) {
|
|
||||||
case ConnectivityResult.wifi:
|
|
||||||
isInternetConnection = true;
|
|
||||||
break;
|
|
||||||
case ConnectivityResult.mobile:
|
|
||||||
isInternetConnection = true;
|
|
||||||
break;
|
|
||||||
case ConnectivityResult.none:
|
|
||||||
isInternetConnection = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
notifyListeners();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
if (subscription != null) subscription.cancel();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
enum ViewState { Idle, Busy, Error, BusyLocal, ErrorLocal }
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,16 +0,0 @@
|
|||||||
const TOKEN = 'token';
|
|
||||||
const PROJECT_ID = 'projectID';
|
|
||||||
const VIDA_AUTH_TOKEN_ID = 'VidaAuthTokenID';
|
|
||||||
const VIDA_REFRESH_TOKEN_ID = 'VidaRefreshTokenID';
|
|
||||||
const LOGIN_TOKEN_ID = 'LogInToken';
|
|
||||||
const DOCTOR_ID = 'doctorID';
|
|
||||||
const SLECTED_PATIENT_TYPE = 'slectedPatientType';
|
|
||||||
const APP_Language = 'language';
|
|
||||||
const DOCTOR_PROFILE = 'doctorProfile';
|
|
||||||
const LIVE_CARE_PATIENT = 'livecare-patient-profile';
|
|
||||||
const LOGGED_IN_USER = 'loggedUser';
|
|
||||||
const EMPLOYEE_ID = 'EmployeeID';
|
|
||||||
const DASHBOARD_DATA = 'dashboard-data';
|
|
||||||
const OTP_TYPE = 'otp-type';
|
|
||||||
const LAST_LOGIN_USER = 'last-login-user';
|
|
||||||
const CLINIC_NAME = 'clinic-name';
|
|
||||||
@ -1,56 +1,56 @@
|
|||||||
class CallConfig {
|
class CallConfig {
|
||||||
int id;
|
late int id;
|
||||||
bool globalClinicPrefixReq;
|
late bool globalClinicPrefixReq;
|
||||||
bool clinicPrefixReq;
|
late bool clinicPrefixReq;
|
||||||
int concurrentCallDelaySec;
|
late int concurrentCallDelaySec;
|
||||||
int voiceType;
|
late int voiceType;
|
||||||
int screenLanguage;
|
late int screenLanguage;
|
||||||
int voiceLanguage;
|
late int voiceLanguage;
|
||||||
int screenMaxDisplayPatients;
|
late int screenMaxDisplayPatients;
|
||||||
int prioritySMS;
|
late int prioritySMS;
|
||||||
int priorityWhatsApp;
|
late int priorityWhatsApp;
|
||||||
int priorityEmail;
|
late int priorityEmail;
|
||||||
String vitalSignText;
|
late String vitalSignText;
|
||||||
String vitalSignTextN;
|
late String vitalSignTextN;
|
||||||
String doctorText;
|
late String doctorText;
|
||||||
String doctorTextN;
|
late String doctorTextN;
|
||||||
String procedureText;
|
late String procedureText;
|
||||||
String procedureTextN;
|
late String procedureTextN;
|
||||||
String vaccinationText;
|
late String vaccinationText;
|
||||||
String vaccinationTextN;
|
late String vaccinationTextN;
|
||||||
String nebulizationText;
|
late String nebulizationText;
|
||||||
String nebulizationTextN;
|
late String nebulizationTextN;
|
||||||
int createdBy;
|
late int createdBy;
|
||||||
String createdOn;
|
late String createdOn;
|
||||||
int editedBy;
|
late int editedBy;
|
||||||
String editedOn;
|
late String editedOn;
|
||||||
|
|
||||||
CallConfig(
|
CallConfig(
|
||||||
{this.id,
|
{this.id = 0,
|
||||||
this.globalClinicPrefixReq,
|
this.globalClinicPrefixReq = false,
|
||||||
this.clinicPrefixReq,
|
this.clinicPrefixReq = false,
|
||||||
this.concurrentCallDelaySec,
|
this.concurrentCallDelaySec = 8,
|
||||||
this.voiceType,
|
this.voiceType = 0,
|
||||||
this.screenLanguage,
|
this.screenLanguage = 1,
|
||||||
this.voiceLanguage,
|
this.voiceLanguage = 1,
|
||||||
this.screenMaxDisplayPatients,
|
this.screenMaxDisplayPatients = 5,
|
||||||
this.prioritySMS,
|
this.prioritySMS = 1,
|
||||||
this.priorityWhatsApp,
|
this.priorityWhatsApp = 1,
|
||||||
this.priorityEmail,
|
this.priorityEmail = 1,
|
||||||
this.vitalSignText,
|
this.vitalSignText = "",
|
||||||
this.vitalSignTextN,
|
this.vitalSignTextN = "",
|
||||||
this.doctorText,
|
this.doctorText = "",
|
||||||
this.doctorTextN,
|
this.doctorTextN = "",
|
||||||
this.procedureText,
|
this.procedureText = "",
|
||||||
this.procedureTextN,
|
this.procedureTextN = "",
|
||||||
this.vaccinationText,
|
this.vaccinationText = "",
|
||||||
this.vaccinationTextN,
|
this.vaccinationTextN = "",
|
||||||
this.nebulizationText,
|
this.nebulizationText = "",
|
||||||
this.nebulizationTextN,
|
this.nebulizationTextN = "",
|
||||||
this.createdBy,
|
this.createdBy = 0,
|
||||||
this.createdOn,
|
this.createdOn = "",
|
||||||
this.editedBy,
|
this.editedBy = 0,
|
||||||
this.editedOn});
|
this.editedOn = ""});
|
||||||
|
|
||||||
CallConfig.fromJson(Map<String, dynamic> json) {
|
CallConfig.fromJson(Map<String, dynamic> json) {
|
||||||
id = json['id'];
|
id = json['id'];
|
||||||
@ -0,0 +1,227 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
import 'dart:developer';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:connectivity/connectivity.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:just_audio/just_audio.dart';
|
||||||
|
import 'package:queuing_system/core/api.dart';
|
||||||
|
import 'package:queuing_system/core/response_models/call_config.dart';
|
||||||
|
import 'package:queuing_system/core/response_models/patient_call.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';
|
||||||
|
|
||||||
|
class AppProvider extends ChangeNotifier {
|
||||||
|
AppProvider() {
|
||||||
|
startSignalHubConnection();
|
||||||
|
listenNetworkConnectivity();
|
||||||
|
}
|
||||||
|
|
||||||
|
SignalRHelper signalRHelper = SignalRHelper();
|
||||||
|
|
||||||
|
final AudioPlayer audioPlayer = AudioPlayer();
|
||||||
|
|
||||||
|
CallConfig patientCallConfigurations = CallConfig();
|
||||||
|
List<Tickets> patientTickets = [];
|
||||||
|
List<Tickets> isQueuePatients = [];
|
||||||
|
|
||||||
|
String currentDeviceIp = "";
|
||||||
|
bool isCallingInProgress = false;
|
||||||
|
bool isInternetConnectionAvailable = true;
|
||||||
|
|
||||||
|
updateInternetConnection(bool value) {
|
||||||
|
isInternetConnectionAvailable = value;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getCurrentIP() async {
|
||||||
|
final ips = await NetworkInterface.list(type: InternetAddressType.IPv4);
|
||||||
|
for (var interface in ips) {
|
||||||
|
if (interface.name == "eth0") {
|
||||||
|
for (var address in interface.addresses) {
|
||||||
|
currentDeviceIp = address.address;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (interface.name == "wlan0") {
|
||||||
|
for (var address in interface.addresses) {
|
||||||
|
currentDeviceIp = address.address;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> startSignalHubConnection() async {
|
||||||
|
if (!signalRHelper.getConnectionState()) {
|
||||||
|
signalRHelper.startSignalRConnection(currentDeviceIp, onUpdateAvailable: onPingReceived, onConnect: onConnect, onConnecting: onConnecting, onDisconnect: onDisconnect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> callPatientsAPI() async {
|
||||||
|
patientTickets.clear();
|
||||||
|
API.getCallRequestInfoByClinicInfo(currentDeviceIp, onSuccess: (waitingCalls, isQueuePatientsCalls, callConfigs) {
|
||||||
|
patientCallConfigurations = callConfigs;
|
||||||
|
if (waitingCalls.length > patientCallConfigurations.screenMaxDisplayPatients) {
|
||||||
|
patientTickets = waitingCalls.sublist(0, patientCallConfigurations.screenMaxDisplayPatients);
|
||||||
|
} else {
|
||||||
|
patientTickets = waitingCalls;
|
||||||
|
}
|
||||||
|
isQueuePatients = isQueuePatientsCalls;
|
||||||
|
notifyListeners();
|
||||||
|
}, onFailure: (error) {
|
||||||
|
log("Api call failed with this error: ${error.toString()}");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onPingReceived(data) async {
|
||||||
|
if (patientTickets.isNotEmpty) {
|
||||||
|
if ((patientTickets.first.isToneReq && isCallingInProgress) || (patientTickets.first.isVoiceReq && voiceCaller != null)) {
|
||||||
|
Timer(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec), () async {
|
||||||
|
await callPatientsAPI();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
await callPatientsAPI();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await callPatientsAPI();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getCallTypeText(Tickets ticket, CallConfig callConfig) {
|
||||||
|
final callType = ticket.getCallType();
|
||||||
|
switch (callType) {
|
||||||
|
case CallType.vitalSign:
|
||||||
|
return callConfig.vitalSignText;
|
||||||
|
case CallType.doctor:
|
||||||
|
return callConfig.doctorText;
|
||||||
|
case CallType.procedure:
|
||||||
|
return callConfig.procedureText;
|
||||||
|
case CallType.vaccination:
|
||||||
|
return callConfig.vaccinationText;
|
||||||
|
case CallType.nebulization:
|
||||||
|
return callConfig.nebulizationText;
|
||||||
|
default:
|
||||||
|
return callConfig.vitalSignText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CallByVoice? voiceCaller;
|
||||||
|
|
||||||
|
callPatientTicket(AudioPlayer audioPlayer) async {
|
||||||
|
isCallingInProgress = true;
|
||||||
|
if (patientTickets.isNotEmpty) {
|
||||||
|
if (patientTickets.first.isToneReq && !patientTickets.first.isQueue) {
|
||||||
|
audioPlayer.setAsset("assets/tones/call_tone.mp3");
|
||||||
|
await audioPlayer.play();
|
||||||
|
await Future.delayed(const Duration(seconds: 2));
|
||||||
|
isCallingInProgress = false;
|
||||||
|
}
|
||||||
|
if (patientTickets.first.isVoiceReq && voiceCaller == null && !patientTickets.first.isQueue) {
|
||||||
|
final postVoice = getCallTypeText(patientTickets.first, patientCallConfigurations);
|
||||||
|
voiceCaller = CallByVoice(preVoice: "Ticket Number", ticketNo: patientTickets.first.queueNo.trim().toString(), postVoice: postVoice, lang: 'en');
|
||||||
|
await voiceCaller!.startCalling(patientTickets.first.queueNo.trim().toString() != patientTickets.first.callNoStr.trim().toString());
|
||||||
|
voiceCaller = null;
|
||||||
|
isCallingInProgress = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isQueuePatients.isNotEmpty) {
|
||||||
|
await Future.delayed(Duration(seconds: isQueuePatients.first.concurrentCallDelaySec)).whenComplete(() async {
|
||||||
|
if (isQueuePatients.isNotEmpty) {
|
||||||
|
isQueuePatients.removeAt(0);
|
||||||
|
}
|
||||||
|
if (patientTickets.isNotEmpty) {
|
||||||
|
// Tickets ticket = patientTickets.elementAt(0);
|
||||||
|
// patientTickets.removeAt(0);
|
||||||
|
// patientTickets.add(ticket);
|
||||||
|
}
|
||||||
|
if (isQueuePatients.isNotEmpty) {
|
||||||
|
// setState(() {});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// if (isQueuePatients.isEmpty && callFlag == 1) {
|
||||||
|
// callFlag == 0;
|
||||||
|
// await Future.delayed(const Duration(seconds: 3));
|
||||||
|
// patientTickets.clear();
|
||||||
|
// API.getCallRequestInfoByClinicInfo(DEVICE_IP, onSuccess: (waitingCalls, isQueuePatientsCalls) {
|
||||||
|
// setState(() {
|
||||||
|
// patientTickets = waitingCalls;
|
||||||
|
// isQueuePatients = isQueuePatientsCalls;
|
||||||
|
// // currents = currentInClinic;
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// log("--------------------");
|
||||||
|
// log("waiting: $patientTickets");
|
||||||
|
// log("isQueuePatients: $isQueuePatients");
|
||||||
|
// log("--------------------");
|
||||||
|
//
|
||||||
|
// updateTickets();
|
||||||
|
// }, onFailure: (error) {});
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> listenAudioPlayerEvents() async {
|
||||||
|
audioPlayer.playerStateStream.listen((playerState) {
|
||||||
|
if (playerState.processingState == ProcessingState.completed) {
|
||||||
|
isCallingInProgress = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
updatePatientTickets() {
|
||||||
|
if (patientTickets.isNotEmpty) {
|
||||||
|
List<Tickets> _ticketsToUpdate = patientTickets.where((t) => t.callUpdated == false).toList();
|
||||||
|
API.callUpdateNotIsQueueRecordByIDAsync(currentDeviceIp, ticket: _ticketsToUpdate.first, onSuccess: (ticketsUpdated) {
|
||||||
|
log("[${ticketsUpdated.length}] Tickets Updated: $ticketsUpdated");
|
||||||
|
}, onFailure: (e) {
|
||||||
|
log(" Tickets Update Failed with : ${e.toString()}");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updatePatientTicketByIndex(int index) {
|
||||||
|
if (patientTickets.isNotEmpty) {
|
||||||
|
API.callUpdateNotIsQueueRecordByIDAsync(currentDeviceIp, ticket: patientTickets.elementAt(index), onSuccess: (ticketsUpdated) {
|
||||||
|
log("[${patientTickets.elementAt(index).callNoStr}] Ticket Updated: $ticketsUpdated");
|
||||||
|
}, onFailure: (e) {
|
||||||
|
log(" Tickets Update ${patientTickets.elementAt(index).callNoStr} Failed with Error : ${e.toString()}");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onConnect() {
|
||||||
|
log("SignalR: onConnect");
|
||||||
|
}
|
||||||
|
|
||||||
|
onDisconnect(exception) {
|
||||||
|
log("SignalR: onDisconnect");
|
||||||
|
signalRHelper.startSignalRConnection(currentDeviceIp, onUpdateAvailable: onPingReceived, onConnect: onConnect, onConnecting: onConnecting, onDisconnect: onDisconnect);
|
||||||
|
}
|
||||||
|
|
||||||
|
onConnecting() {
|
||||||
|
log("SignalR: onConnecting");
|
||||||
|
}
|
||||||
|
|
||||||
|
listenNetworkConnectivity() async {
|
||||||
|
Connectivity().onConnectivityChanged.listen((event) async {
|
||||||
|
switch (event) {
|
||||||
|
case ConnectivityResult.wifi:
|
||||||
|
updateInternetConnection(true);
|
||||||
|
await getCurrentIP();
|
||||||
|
if (signalRHelper.connection == null || signalRHelper.connection!.state != ConnectionState.active) {
|
||||||
|
signalRHelper.connection!.start();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ConnectivityResult.none:
|
||||||
|
updateInternetConnection(false);
|
||||||
|
signalRHelper.closeConnection();
|
||||||
|
break;
|
||||||
|
case ConnectivityResult.mobile:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,98 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:queuing_system/core/config/size_config.dart';
|
|
||||||
import 'package:queuing_system/core/response_model/call_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, CallConfig callConfig) {
|
|
||||||
return PriorityTickets(tickets, callConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget priorityTicketsWithSideList(List<Tickets> tickets, CallConfig callConfig) {
|
|
||||||
final priorityTickets = tickets.sublist(0, 3);
|
|
||||||
final otherTickets = tickets.sublist(3, tickets.length);
|
|
||||||
return Row(
|
|
||||||
children: [
|
|
||||||
Expanded(flex: 7, child: PriorityTickets(priorityTickets, callConfig)),
|
|
||||||
Container(color: Colors.grey.withOpacity(0.1), width: 10, margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 50)),
|
|
||||||
Expanded(
|
|
||||||
flex: 5,
|
|
||||||
child: ListView.builder(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 50),
|
|
||||||
itemCount: otherTickets.length,
|
|
||||||
itemBuilder: (ctx, idx) {
|
|
||||||
final itm = otherTickets[idx];
|
|
||||||
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.all(8),
|
|
||||||
child: Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: SizeConfig.getWidthMultiplier() * 19,
|
|
||||||
child: AppText(
|
|
||||||
itm.queueNo.toString(),
|
|
||||||
letterSpacing: -2,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontSize: SizeConfig.getWidthMultiplier() * 4,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 5),
|
|
||||||
Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: SizeConfig.getWidthMultiplier() * 3,
|
|
||||||
child: itm.getCallType().icon(SizeConfig.getHeightMultiplier() * 2.5),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
SizedBox(
|
|
||||||
width: SizeConfig.getWidthMultiplier() * 28,
|
|
||||||
child: AppText(
|
|
||||||
itm.getCallType().message(callConfig),
|
|
||||||
color: itm.getCallType().color(),
|
|
||||||
letterSpacing: -1.5,
|
|
||||||
fontSize: SizeConfig.getWidthMultiplier() * 3,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
fontHeight: 0.5,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
color: Colors.grey.withOpacity(0.3),
|
|
||||||
width: 6,
|
|
||||||
height: SizeConfig.getHeightMultiplier() * 3,
|
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 10),
|
|
||||||
),
|
|
||||||
AppText(
|
|
||||||
"Room: ${itm.roomNo}",
|
|
||||||
color: itm.getCallType().color(),
|
|
||||||
letterSpacing: -1.5,
|
|
||||||
fontSize: SizeConfig.getWidthMultiplier() * 3.3,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
fontHeight: 0.5,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
// import 'package:flutter/material.dart';
|
|
||||||
// import 'package:queuing_system/core/config/size_config.dart';
|
|
||||||
// import 'package:queuing_system/home/que_item/que_item.dart';
|
|
||||||
//
|
|
||||||
// class QueItemList extends StatelessWidget {
|
|
||||||
// const QueItemList({Key key}) : super(key: key);
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// return SizedBox(
|
|
||||||
// child: Column(
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
// children: [
|
|
||||||
// SizedBox(height: SizeConfig.getHeightMultiplier() *2.3,),
|
|
||||||
// const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: true, haveListOfPatient: false,),
|
|
||||||
// const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: true, haveListOfPatient: false,),
|
|
||||||
// const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: false, haveListOfPatient: false,),
|
|
||||||
// const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: true, haveListOfPatient: false,),
|
|
||||||
// const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: true, haveListOfPatient: false,),
|
|
||||||
// const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: false, haveListOfPatient: false,),
|
|
||||||
// const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: true, haveListOfPatient: false,),
|
|
||||||
// const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: false, haveListOfPatient: false,),
|
|
||||||
//
|
|
||||||
// ],),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
@ -1,32 +1,32 @@
|
|||||||
import 'package:flutter/material.dart';
|
// import 'package:flutter/material.dart';
|
||||||
import 'package:queuing_system/widget/loader/gif_loader_container.dart';
|
// import 'package:queuing_system/widget/loader/gif_loader_container.dart';
|
||||||
|
//
|
||||||
class AppLoaderWidget extends StatefulWidget {
|
// class AppLoaderWidget extends StatefulWidget {
|
||||||
AppLoaderWidget({Key key, this.title, this.containerColor}) : super(key: key);
|
// AppLoaderWidget({Key? key, this.title, this.containerColor}) : super(key: key);
|
||||||
|
//
|
||||||
final String title;
|
// final String title;
|
||||||
final Color containerColor;
|
// final Color containerColor;
|
||||||
|
//
|
||||||
@override
|
// @override
|
||||||
_AppLoaderWidgetState createState() => _AppLoaderWidgetState();
|
// _AppLoaderWidgetState createState() => _AppLoaderWidgetState();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
class _AppLoaderWidgetState extends State<AppLoaderWidget> {
|
// class _AppLoaderWidgetState extends State<AppLoaderWidget> {
|
||||||
@override
|
// @override
|
||||||
Widget build(BuildContext context) {
|
// Widget build(BuildContext context) {
|
||||||
return SizedBox(
|
// return SizedBox(
|
||||||
height: MediaQuery.of(context).size.height,
|
// height: MediaQuery.of(context).size.height,
|
||||||
child: Stack(
|
// child: Stack(
|
||||||
children: [
|
// children: [
|
||||||
Container(
|
// Container(
|
||||||
color: widget.containerColor ?? Colors.grey.withOpacity(0.6),
|
// color: widget.containerColor ?? Colors.grey.withOpacity(0.6),
|
||||||
),
|
// ),
|
||||||
Container(
|
// Container(
|
||||||
child: GifLoaderContainer(),
|
// child: GifLoaderContainer(),
|
||||||
margin: EdgeInsets.only(
|
// margin: EdgeInsets.only(
|
||||||
bottom: MediaQuery.of(context).size.height * 0.09))
|
// bottom: MediaQuery.of(context).size.height * 0.09))
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|||||||
@ -1,43 +1,36 @@
|
|||||||
import 'package:flutter/material.dart';
|
// import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
// import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
|
// import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
|
||||||
|
//
|
||||||
|
// class ErrorMessage extends StatelessWidget {
|
||||||
class ErrorMessage extends StatelessWidget {
|
// const ErrorMessage({Key? key, this.error = ''}) : super(key: key);
|
||||||
const ErrorMessage({
|
//
|
||||||
Key key,
|
// final String error;
|
||||||
@required this.error,
|
//
|
||||||
}) : super(key: key);
|
// @override
|
||||||
|
// Widget build(BuildContext context) {
|
||||||
final String error;
|
// return SingleChildScrollView(
|
||||||
|
// child: Center(
|
||||||
@override
|
// child: Column(
|
||||||
Widget build(BuildContext context) {
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
return SingleChildScrollView(
|
// children: [
|
||||||
child: Center(
|
// const SizedBox(height: 100),
|
||||||
child: Column(
|
// SvgPicture.asset('assets/images/svgs/no data.svg'),
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
// Center(
|
||||||
children: [
|
// child: Center(
|
||||||
SizedBox(
|
// child: Padding(
|
||||||
height: 100,
|
// padding: const EdgeInsets.only(top: 12, bottom: 12, right: 20, left: 30),
|
||||||
),
|
// child: Center(
|
||||||
SvgPicture.asset('assets/images/svgs/no data.svg'),
|
// child: AppText(
|
||||||
Center(
|
// error ?? '',
|
||||||
child: Center(
|
// textAlign: TextAlign.center,
|
||||||
child: Padding(
|
// )),
|
||||||
padding: const EdgeInsets.only(
|
// ),
|
||||||
top: 12, bottom: 12, right: 20, left: 30),
|
// ),
|
||||||
child: Center(
|
// )
|
||||||
child: AppText(
|
// ],
|
||||||
error ?? '',
|
// ),
|
||||||
textAlign: TextAlign.center,
|
// ),
|
||||||
)),
|
// );
|
||||||
),
|
// }
|
||||||
),
|
// }
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,43 +1,43 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
// import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter_gifimage/flutter_gifimage.dart';
|
// import 'package:flutter_gifimage/flutter_gifimage.dart';
|
||||||
|
//
|
||||||
class GifLoaderContainer extends StatefulWidget {
|
// class GifLoaderContainer extends StatefulWidget {
|
||||||
@override
|
// @override
|
||||||
_GifLoaderContainerState createState() => _GifLoaderContainerState();
|
// _GifLoaderContainerState createState() => _GifLoaderContainerState();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
class _GifLoaderContainerState extends State<GifLoaderContainer>
|
// class _GifLoaderContainerState extends State<GifLoaderContainer>
|
||||||
with TickerProviderStateMixin {
|
// with TickerProviderStateMixin {
|
||||||
GifController controller1;
|
// GifController controller1;
|
||||||
|
//
|
||||||
@override
|
// @override
|
||||||
void initState() {
|
// void initState() {
|
||||||
controller1 = GifController(vsync: this);
|
// controller1 = GifController(vsync: this);
|
||||||
|
//
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
// WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
controller1.repeat(
|
// controller1.repeat(
|
||||||
min: 0, max: 11, period: Duration(milliseconds: 750), reverse: true);
|
// min: 0, max: 11, period: Duration(milliseconds: 750), reverse: true);
|
||||||
});
|
// });
|
||||||
super.initState();
|
// super.initState();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@override
|
// @override
|
||||||
void dispose() {
|
// void dispose() {
|
||||||
controller1.dispose();
|
// controller1.dispose();
|
||||||
super.dispose();
|
// super.dispose();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@override
|
// @override
|
||||||
Widget build(BuildContext context) {
|
// Widget build(BuildContext context) {
|
||||||
return Center(
|
// return Center(
|
||||||
//progress-loading.gif
|
// //progress-loading.gif
|
||||||
child: Container(
|
// child: Container(
|
||||||
// margin: EdgeInsets.only(bottom: 40),
|
// // margin: EdgeInsets.only(bottom: 40),
|
||||||
child: GifImage(
|
// child: GifImage(
|
||||||
controller: controller1,
|
// controller: controller1,
|
||||||
image: AssetImage(
|
// image: AssetImage(
|
||||||
"assets/images/progress-loading-red.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"),
|
// "assets/images/progress-loading-red.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"),
|
||||||
),
|
// ),
|
||||||
));
|
// ));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
// import 'package:flutter/material.dart';
|
||||||
import 'gif_loader_container.dart';
|
// import 'gif_loader_container.dart';
|
||||||
class GifLoaderDialogUtils {
|
// class GifLoaderDialogUtils {
|
||||||
static showMyDialog(BuildContext context) {
|
// static showMyDialog(BuildContext context) {
|
||||||
showDialog(context: context, builder: (ctx) => GifLoaderContainer());
|
// showDialog(context: context, builder: (ctx) => GifLoaderContainer());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
static hideDialog(BuildContext context) {
|
// static hideDialog(BuildContext context) {
|
||||||
if (Navigator.canPop(context)) Navigator.of(context).pop();
|
// if (Navigator.canPop(context)) Navigator.of(context).pop();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|||||||
Loading…
Reference in New Issue