diff --git a/assets/fonts/Cairo/Cairo-Bold/Cairo-Bold.eot b/assets/fonts/Cairo/Cairo-Bold/Cairo-Bold.eot new file mode 100644 index 0000000..ed5f0c3 Binary files /dev/null and b/assets/fonts/Cairo/Cairo-Bold/Cairo-Bold.eot differ diff --git a/assets/fonts/Cairo/Cairo-Bold/Cairo-Bold.otf b/assets/fonts/Cairo/Cairo-Bold/Cairo-Bold.otf new file mode 100644 index 0000000..8bc25fb Binary files /dev/null and b/assets/fonts/Cairo/Cairo-Bold/Cairo-Bold.otf differ diff --git a/assets/fonts/Cairo/Cairo-Bold/Cairo-Bold.ttf b/assets/fonts/Cairo/Cairo-Bold/Cairo-Bold.ttf new file mode 100644 index 0000000..4f02689 Binary files /dev/null and b/assets/fonts/Cairo/Cairo-Bold/Cairo-Bold.ttf differ diff --git a/assets/fonts/Cairo/Cairo-Bold/Cairo-Bold.woff b/assets/fonts/Cairo/Cairo-Bold/Cairo-Bold.woff new file mode 100644 index 0000000..91e3d06 Binary files /dev/null and b/assets/fonts/Cairo/Cairo-Bold/Cairo-Bold.woff differ diff --git a/assets/fonts/Cairo/Cairo-Light/Cairo-Light.eot b/assets/fonts/Cairo/Cairo-Light/Cairo-Light.eot new file mode 100644 index 0000000..d76c539 Binary files /dev/null and b/assets/fonts/Cairo/Cairo-Light/Cairo-Light.eot differ diff --git a/assets/fonts/Cairo/Cairo-Light/Cairo-Light.otf b/assets/fonts/Cairo/Cairo-Light/Cairo-Light.otf new file mode 100644 index 0000000..f8812a9 Binary files /dev/null and b/assets/fonts/Cairo/Cairo-Light/Cairo-Light.otf differ diff --git a/assets/fonts/Cairo/Cairo-Light/Cairo-Light.ttf b/assets/fonts/Cairo/Cairo-Light/Cairo-Light.ttf new file mode 100644 index 0000000..840cbc3 Binary files /dev/null and b/assets/fonts/Cairo/Cairo-Light/Cairo-Light.ttf differ diff --git a/assets/fonts/Cairo/Cairo-Light/Cairo-Light.woff b/assets/fonts/Cairo/Cairo-Light/Cairo-Light.woff new file mode 100644 index 0000000..9534bb4 Binary files /dev/null and b/assets/fonts/Cairo/Cairo-Light/Cairo-Light.woff differ diff --git a/assets/fonts/Cairo/Cairo-Regular/Cairo-Regular.ttf b/assets/fonts/Cairo/Cairo-Regular/Cairo-Regular.ttf new file mode 100644 index 0000000..3eb09f8 Binary files /dev/null and b/assets/fonts/Cairo/Cairo-Regular/Cairo-Regular.ttf differ diff --git a/assets/tts_voices.json b/assets/tts_voices.json new file mode 100644 index 0000000..9beb5b6 --- /dev/null +++ b/assets/tts_voices.json @@ -0,0 +1,442 @@ +[ + { + "features": "", + "latency": "normal", + "name": "ru", + "locale": "ru", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "jgo", + "locale": "jgo", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "kea", + "locale": "kea", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "bs", + "locale": "bs", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "lv", + "locale": "lv", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "ff", + "locale": "ff", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "am", + "locale": "am", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "ff", + "locale": "ff-Latn", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "fy", + "locale": "fy", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "cgg", + "locale": "cgg", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "mfe", + "locale": "mfe", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "mi", + "locale": "mi", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "vi", + "locale": "vi", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "bs", + "locale": "bs-Latn", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "kam", + "locale": "kam", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "es", + "locale": "es", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "hr", + "locale": "hr", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "nmg", + "locale": "nmg", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "gl", + "locale": "gl", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "et", + "locale": "et", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "lb", + "locale": "lb", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "dje", + "locale": "dje", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "ks", + "locale": "ks", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "smn", + "locale": "smn", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "zgh", + "locale": "zgh", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "sk", + "locale": "sk", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "lt", + "locale": "lt", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "seh", + "locale": "seh", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "ig", + "locale": "ig", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "ml", + "locale": "ml", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "fil", + "locale": "fil", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "mer", + "locale": "mer", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "sg", + "locale": "sg", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "yue", + "locale": "yue-Hans", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "guz", + "locale": "guz", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "zh", + "locale": "zh-Hant", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "nn", + "locale": "nn", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "ksh", + "locale": "ksh", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "mzn", + "locale": "mzn", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "eu", + "locale": "eu", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "twq", + "locale": "twq", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "mk", + "locale": "mk", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "br", + "locale": "br", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "tk", + "locale": "tk", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "wo", + "locale": "wo", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "shi", + "locale": "shi", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "mgh", + "locale": "mgh", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "nl", + "locale": "nl", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "lrc", + "locale": "lrc", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "sr", + "locale": "sr-Cyrl", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "az", + "locale": "az-Cyrl", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "chr", + "locale": "chr", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "sn", + "locale": "sn", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "bax", + "locale": "bax", + "network_required": 0, + "quality": "normal" + }, + { + "features": "", + "latency": "normal", + "name": "ig", + "locale": "ig", + "network_required": 0, + "quality": "normal" + } +] diff --git a/lib/constants/app_constants.dart b/lib/constants/app_constants.dart index 3bebcc5..ed1f8eb 100644 --- a/lib/constants/app_constants.dart +++ b/lib/constants/app_constants.dart @@ -9,7 +9,8 @@ class AppStrings { static String appName = "QLine"; static String fontName = "Poppins"; static String noInternetConnection = "No Internet Connection"; - static String awaitingArrival = "Awaiting Patients Arrival"; + static String awaitingArrivalEng = "Awaiting Patients Arrival"; + static String awaitingArrivalAr = "في انتظار وصول المرضى"; } class AppColors { diff --git a/lib/models/global_config_model.dart b/lib/models/global_config_model.dart index d81dba0..d32f45d 100644 --- a/lib/models/global_config_model.dart +++ b/lib/models/global_config_model.dart @@ -9,7 +9,7 @@ class GlobalConfigurationsModel { String? description; int? counterStart; int? counterEnd; - int? concurrentCallDelaySec; + int concurrentCallDelaySec = 1; int? voiceType; String? voiceTypeText; LanguageEnum screenLanguageEnum = LanguageEnum.english; @@ -17,7 +17,7 @@ class GlobalConfigurationsModel { TextDirection textDirection = TextDirection.ltr; LanguageEnum voiceLanguageEnum = LanguageEnum.english; String? voiceLanguageText; - int? screenMaxDisplayPatients; + int screenMaxDisplayPatients = 10; bool? isNotiReq; int? prioritySMS; int? priorityWhatsApp; @@ -64,7 +64,7 @@ class GlobalConfigurationsModel { this.description, this.counterStart, this.counterEnd, - this.concurrentCallDelaySec, + this.concurrentCallDelaySec = 1, this.voiceType, this.voiceTypeText, this.screenLanguageEnum = LanguageEnum.english, @@ -72,7 +72,7 @@ class GlobalConfigurationsModel { this.textDirection = TextDirection.ltr, this.voiceLanguageEnum = LanguageEnum.english, this.voiceLanguageText, - this.screenMaxDisplayPatients, + this.screenMaxDisplayPatients = 10, this.isNotiReq, this.prioritySMS, this.priorityWhatsApp, @@ -120,7 +120,7 @@ class GlobalConfigurationsModel { description = json['description']; counterStart = json['counterStart']; counterEnd = json['counterEnd']; - concurrentCallDelaySec = json['concurrentCallDelaySec']; + concurrentCallDelaySec = json['concurrentCallDelaySec'] ?? 1; voiceType = json['voiceType']; voiceTypeText = json['voiceTypeText']; screenLanguageEnum = (json['screenLanguage'] as int).toLanguageEnum(); @@ -128,13 +128,13 @@ class GlobalConfigurationsModel { textDirection = json['textDirection'] == 2 ? TextDirection.rtl : TextDirection.ltr; voiceLanguageEnum = (json['voiceLanguage'] as int).toLanguageEnum(); voiceLanguageText = json['voiceLanguageText']; - screenMaxDisplayPatients = json['screenMaxDisplayPatients']; + screenMaxDisplayPatients = json['screenMaxDisplayPatients'] ?? 10; isNotiReq = json['isNotiReq']; prioritySMS = json['prioritySMS']; priorityWhatsApp = json['priorityWhatsApp']; priorityEmail = json['priorityEmail']; ticketNoText = json['ticketNoText'] ?? "Ticket Number"; - postVoiceText = json['postVoiceText'] ?? "Please Visit Counter"; + postVoiceText = json['pleaseVisitCounterText'] ?? "Please Visit Counter"; roomText = json['roomText']; queueNoText = json['queueNoText']; callForText = json['callForText']; diff --git a/lib/models/ticket_model.dart b/lib/models/ticket_model.dart index 81d291a..aa08057 100644 --- a/lib/models/ticket_model.dart +++ b/lib/models/ticket_model.dart @@ -18,17 +18,6 @@ class TicketDetailsModel { connectionID = json['connectionID']; ticketModel = json['data'] != null ? TicketData.fromJson(json['data']) : null; } - - Map toJson() { - final Map data = {}; - data['qType'] = qTypeEnum; - data['screenType'] = screenTypeEnum; - data['connectionID'] = connectionID; - if (ticketModel != null) { - data['data'] = ticketModel!.toJson(); - } - return data; - } } class TicketData { @@ -44,6 +33,7 @@ class TicketData { String? mobileNo; String? patientEmail; int? preferredLang; + LanguageEnum voiceLanguageEnum = LanguageEnum.english; int? patientGender; String? roomNo; bool? isActive; @@ -52,26 +42,27 @@ class TicketData { DateTime? editedOn; DateTime? createdOn; - TicketData( - {this.id, - this.patientID, - this.laBQGroupID, - this.queueNo, - this.counterBatchNo, - this.calledBy, - this.calledOn, - this.servedOn, - this.patientName, - this.mobileNo, - this.patientEmail, - this.preferredLang, - this.patientGender, - this.roomNo, - this.isActive, - this.createdBy, - this.createdOn, - this.editedBy, - this.editedOn}); + TicketData({ + this.id, + this.patientID, + this.laBQGroupID, + this.queueNo, + this.counterBatchNo, + this.calledBy, + this.calledOn, + this.servedOn, + this.patientName, + this.mobileNo, + this.patientEmail, + this.preferredLang, + this.patientGender, + this.roomNo, + this.isActive, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn, + }); TicketData.fromJson(Map json) { id = json['id']; @@ -86,6 +77,7 @@ class TicketData { mobileNo = json['mobileNo']; patientEmail = json['patientEmail']; preferredLang = (json['preferredLang'] != null && json['preferredLang'].trim() != "") ? int.parse(json['preferredLang']) : 1; + voiceLanguageEnum = (json['preferredLang'] != null && json['preferredLang'].trim() != "") ? (json['preferredLang'] as int).toLanguageEnum() : LanguageEnum.english; patientGender = json['patientGender'] ?? 1; roomNo = json['roomNo'].toString(); isActive = json['isActive']; @@ -94,28 +86,4 @@ class TicketData { editedOn = json['editedOn'] != null ? (json['editedOn'] as String).toDateTime() : DateTime.now(); createdOn = json['createdOn'] != null ? (json['createdOn'] as String).toDateTime() : DateTime.now(); } - - Map toJson() { - final Map data = {}; - data['id'] = id; - data['patientID'] = patientID; - data['laB_QGroupID'] = laBQGroupID; - data['queueNo'] = queueNo; - data['counterBatchNo'] = counterBatchNo; - data['calledBy'] = calledBy; - data['calledOn'] = calledOn; - data['servedOn'] = servedOn; - data['patientName'] = patientName; - data['mobileNo'] = mobileNo; - data['patientEmail'] = patientEmail; - data['preferredLang'] = preferredLang; - data['patientGender'] = patientGender; - data['roomNo'] = roomNo; - data['isActive'] = isActive; - data['createdBy'] = createdBy; - data['createdOn'] = createdOn; - data['editedBy'] = editedBy; - data['editedOn'] = editedOn; - return data; - } } diff --git a/lib/services/text_to_speech_service.dart b/lib/services/text_to_speech_service.dart index 917418b..b204c12 100644 --- a/lib/services/text_to_speech_service.dart +++ b/lib/services/text_to_speech_service.dart @@ -5,7 +5,7 @@ import 'package:hmg_qline/models/ticket_model.dart'; import 'package:hmg_qline/utilities/enums.dart'; import 'package:hmg_qline/utilities/extensions.dart'; -bool isNeedToBreakVoiceForArabic = false; +bool isNeedToBreakVoiceForArabic = true; abstract class TextToSpeechService { Future speechText({ @@ -30,67 +30,76 @@ class TextToSpeechServiceImp implements TextToSpeechService { required TicketDetailsModel ticket, required GlobalConfigurationsModel globalConfigurationsModel, }) async { + const ttsGoogleEngine = 'com.google.android.tts'; + // const ttsFlyTecEngine = 'com.iflytek.speechcloud'; + + LanguageEnum langEnum = globalConfigurationsModel.voiceLanguageEnum; + List engines = await textToSpeechInstance.getEngines; + if (engines.contains(ttsGoogleEngine)) { + await textToSpeechInstance.setEngine(ttsGoogleEngine); + } + textToSpeechInstance.setVolume(1.0); - textToSpeechInstance.setSpeechRate(0.45); - textToSpeechInstance.setPitch(0.9); + if (langEnum == LanguageEnum.arabic) { + await textToSpeechInstance.setLanguage(LanguageEnum.arabic.enumToString()); + textToSpeechInstance.setSpeechRate(0.45); + textToSpeechInstance.setPitch(0.8); + } else if (langEnum == LanguageEnum.english) { + await textToSpeechInstance.setLanguage(LanguageEnum.english.enumToString()); + textToSpeechInstance.setSpeechRate(0.37); + textToSpeechInstance.setPitch(0.85); + } // String postVoice = globalConfigurationsModel.postVoiceText; - String postVoice = ''; - LanguageEnum langEnum = globalConfigurationsModel.voiceLanguageEnum; - String preVoice = globalConfigurationsModel.ticketNoText; + // String preVoice = globalConfigurationsModel.ticketNoText; + + String postVoice = globalConfigurationsModel.postVoiceText; + String preVoice = ''; + String roomNo = ''; + if (ticket.ticketModel!.roomNo != null && ticket.ticketModel!.roomNo!.isNotEmpty) { + roomNo = ticket.ticketModel!.roomNo.toString(); + } + if (preVoice.isNotEmpty) { + preVoice = '$preVoice..'; + } + String ticketNo = ticket.ticketModel!.queueNo!.trim().toString(); - bool isClinicNameAdded = false; log("lang: ${await textToSpeechInstance.areLanguagesInstalled(["en", "ar"])}"); + log("getDefaultEngine: ${await textToSpeechInstance.getDefaultEngine}"); + log("getEngines: ${await textToSpeechInstance.getEngines}"); log("lang: $langEnum"); log("preVoice: $preVoice"); log("postVoice: $postVoice"); log("ticketNo: $ticketNo"); - log("isClinicNameAdded: $isClinicNameAdded"); - String clinicName = ""; String patientAlpha = ""; String patientNumeric = ""; - if (isClinicNameAdded) { - var clinic = ticketNo.split(" "); - clinicName = clinic[0]; - var queueNoArray = clinic[1].split("-"); - if (queueNoArray.length > 2) { - patientAlpha = "${queueNoArray[0]} .. ${queueNoArray[1]}"; - patientNumeric = queueNoArray[2]; - } else { - patientAlpha = queueNoArray[0]; - patientNumeric = queueNoArray[1]; - } + var queueNoArray = ticketNo.split("-"); + if (queueNoArray.length > 2) { + patientAlpha = "${queueNoArray[0]} .. ${queueNoArray[1]}"; + patientNumeric = queueNoArray[2]; } else { - var queueNoArray = ticketNo.split("-"); - if (queueNoArray.length > 2) { - patientAlpha = "${queueNoArray[0]} .. ${queueNoArray[1]}"; - patientNumeric = queueNoArray[2]; - } else { - patientAlpha = queueNoArray[0]; - patientNumeric = queueNoArray[1]; - } + patientAlpha = queueNoArray[0]; + patientNumeric = queueNoArray[1]; } - log("Speech: $preVoice .. $clinicName .. $patientAlpha .. $patientNumeric .. $postVoice"); - // Create Pre Voice Players - log('lang $langEnum'); - if (langEnum != LanguageEnum.arabic) { - await textToSpeechInstance.setLanguage(langEnum.enumToString()); - await textToSpeechInstance.speak("$preVoice .. $clinicName .. $patientAlpha .. $patientNumeric .. $postVoice"); + if (langEnum == LanguageEnum.english) { + await textToSpeechInstance.speak("$preVoice $patientAlpha .. $patientNumeric .. $postVoice $roomNo"); return; } - await textToSpeechInstance.setLanguage(langEnum.enumToString()); - textToSpeechInstance.setPitch(1.3); if (isNeedToBreakVoiceForArabic) { - await textToSpeechInstance.speak("$preVoice .. "); - await textToSpeechInstance.setLanguage("en"); - await textToSpeechInstance.speak("$clinicName .. $patientAlpha .. $patientNumeric .. "); + if (preVoice.isNotEmpty) { + await textToSpeechInstance.speak("$preVoice "); + } + textToSpeechInstance.setLanguage(LanguageEnum.english.enumToString()); + await textToSpeechInstance.speak(" $patientAlpha .. $patientNumeric .. "); + await textToSpeechInstance.setLanguage(langEnum.enumToString()); + await textToSpeechInstance.speak(" $postVoice "); } else { - await textToSpeechInstance.speak("$preVoice .. .. $clinicName .. $patientAlpha .. .. $patientNumeric .. .. $postVoice"); + await textToSpeechInstance.speak("$preVoice $patientAlpha .. .. $patientNumeric .. .. $postVoice"); } } diff --git a/lib/view_models/queuing_view_model.dart b/lib/view_models/queuing_view_model.dart index 951d87a..9b35c54 100644 --- a/lib/view_models/queuing_view_model.dart +++ b/lib/view_models/queuing_view_model.dart @@ -59,7 +59,7 @@ class QueuingViewModel extends ChangeNotifier { var data = response.first['data']; GlobalConfigurationsModel globalConfigurationsModel = GlobalConfigurationsModel.fromJson(data as Map); ScreenConfigViewModel screenConfigViewModel = getIt.get(); - screenConfigViewModel.updateGlobalConfigurationsModel(value: globalConfigurationsModel, needNotify: true); + screenConfigViewModel.updateGlobalConfigurationsModel(value: globalConfigurationsModel, needNotify: true, shouldUpdateNextPrayer: true); } } @@ -101,6 +101,9 @@ class QueuingViewModel extends ChangeNotifier { Timer(Duration(seconds: globalConfigurationsModel.concurrentCallDelaySec ?? 1), () async { if (queueTickets.isNotEmpty) { currentTickets.insert(0, queueTickets.first); + if (currentTickets.length > globalConfigurationsModel.screenMaxDisplayPatients) { + currentTickets.removeLast(); + } notifyListeners(); queueTickets.removeAt(0); voiceCallTicket(ticketData: currentTickets.first.ticketModel); @@ -127,6 +130,10 @@ class QueuingViewModel extends ChangeNotifier { void addNewTicket(TicketDetailsModel ticket) { if (!isCallingInProgress) { currentTickets.insert(0, ticket); + GlobalConfigurationsModel globalConfigurationsModel = getIt.get().globalConfigurationsModel; + if (currentTickets.length > globalConfigurationsModel.screenMaxDisplayPatients) { + currentTickets.removeLast(); + } voiceCallTicket(ticketData: currentTickets.first.ticketModel); } else { queueTickets.add(ticket); diff --git a/lib/view_models/screen_config_view_model.dart b/lib/view_models/screen_config_view_model.dart index 9e13631..001cfb2 100644 --- a/lib/view_models/screen_config_view_model.dart +++ b/lib/view_models/screen_config_view_model.dart @@ -109,11 +109,14 @@ class ScreenConfigViewModel extends ChangeNotifier { notifyListeners(); } - void updateGlobalConfigurationsModel({required var value, bool needNotify = false}) { + void updateGlobalConfigurationsModel({required var value, bool needNotify = false, bool shouldUpdateNextPrayer = false}) { globalConfigurationsModel = value; if (needNotify) { notifyListeners(); } + if (shouldUpdateNextPrayer) { + getNextPrayerToShow(); + } } Future getInfoWidgetsDetailsFromServer() async { @@ -218,9 +221,6 @@ class ScreenConfigViewModel extends ChangeNotifier { if (!(globalConfigurationsModel.isWeatherReq) && !(globalConfigurationsModel.isPrayerTimeReq) && !(globalConfigurationsModel.isRssFeedReq)) { return; } - if (!globalConfigurationsModel.isWeatherReq && !globalConfigurationsModel.isPrayerTimeReq && !globalConfigurationsModel.isRssFeedReq) { - return; - } DateTime current = DateTime.now(); Stream timer = Stream.periodic(const Duration(minutes: 1), (i) { diff --git a/lib/views/common_widgets/app_footer.dart b/lib/views/common_widgets/app_footer.dart index 670d932..0e5573f 100644 --- a/lib/views/common_widgets/app_footer.dart +++ b/lib/views/common_widgets/app_footer.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:hmg_qline/view_models/queuing_view_model.dart'; import 'package:hmg_qline/view_models/screen_config_view_model.dart'; import 'package:marquee/marquee.dart'; import 'package:provider/provider.dart'; @@ -76,9 +77,14 @@ class AppFooter extends StatelessWidget { ], ), const SizedBox(width: 10), - Image.asset( - AppAssets.cloudLogo, - height: SizeConfig.getHeightMultiplier() * 0.5, + InkWell( + onTap: () { + // context.read().createAutoTickets(); + }, + child: Image.asset( + AppAssets.cloudLogo, + height: SizeConfig.getHeightMultiplier() * 0.5, + ), ), ], ), diff --git a/lib/views/main_queue_screen/main_queue_screen.dart b/lib/views/main_queue_screen/main_queue_screen.dart index 285d3cd..d95c734 100644 --- a/lib/views/main_queue_screen/main_queue_screen.dart +++ b/lib/views/main_queue_screen/main_queue_screen.dart @@ -1,4 +1,3 @@ -import 'dart:developer'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:hmg_qline/constants/app_constants.dart'; @@ -106,10 +105,10 @@ class MainQueueScreen extends StatelessWidget { ); } - Widget noPatientInQueue() { + Widget noPatientInQueue(String text) { return Center( child: AppText( - AppStrings.awaitingArrival, + text, textAlign: TextAlign.center, fontSize: SizeConfig.getWidthMultiplier() * 9, ), @@ -132,10 +131,13 @@ class MainQueueScreen extends StatelessWidget { return Consumer2( builder: (BuildContext context, ScreenConfigViewModel screenConfigViewModel, QueuingViewModel queuingViewModel, Widget? child) { Widget widget = const SizedBox(); - // screenConfigViewModel.createAutoTickets(); + String text = AppStrings.awaitingArrivalEng; // queuingViewModel.voiceCallTicket(ticketData: queuingViewModel.currentTickets.first.ticketModel); + if (screenConfigViewModel.globalConfigurationsModel.screenLanguageEnum == LanguageEnum.arabic) { + text = AppStrings.awaitingArrivalAr; + } if (queuingViewModel.currentTickets.isEmpty) { - widget = noPatientInQueue(); + widget = noPatientInQueue(text); } else if (screenConfigViewModel.globalConfigurationsModel.screenTypeEnum == ScreenTypeEnum.roomLevelScreen) { widget = PriorityTickets( tickets: [queuingViewModel.currentTickets.first], @@ -216,6 +218,8 @@ class MainQueueScreen extends StatelessWidget { return Selector( selector: (context, screenConfigViewModel) => screenConfigViewModel.currentScreenRotation, builder: (BuildContext context, ScreenOrientationEnum screenOrientationEnum, Widget? child) { + //TODO: For Testing Only + // context.read().voiceCallTicket(ticketData: context.read().currentTickets.first.ticketModel); return RotatedBox( quarterTurns: screenOrientationEnum.getTurnsByOrientation(), child: AppScaffold( diff --git a/lib/views/splash_screen/splash_screen.dart b/lib/views/splash_screen/splash_screen.dart index f7e91b2..4193d2d 100644 --- a/lib/views/splash_screen/splash_screen.dart +++ b/lib/views/splash_screen/splash_screen.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:hmg_qline/config/routes.dart'; +import 'package:hmg_qline/constants/app_constants.dart'; import 'package:hmg_qline/utilities/extensions.dart'; import 'package:hmg_qline/view_models/queuing_view_model.dart'; import 'package:hmg_qline/view_models/screen_config_view_model.dart'; @@ -11,8 +12,8 @@ class SplashScreen extends StatelessWidget { Future _loadData(BuildContext context) async { final screenConfigViewModel = context.read(); final queuingViewModel = context.read(); - await screenConfigViewModel.initializeScreenConfigVM(); - await queuingViewModel.initializeQueueingVM(); + await screenConfigViewModel.initializeScreenConfigVM(); + await queuingViewModel.initializeQueueingVM(); } static Future? _initializationFuture; @@ -36,7 +37,7 @@ class SplashScreen extends StatelessWidget { body: Center( child: Padding( padding: const EdgeInsets.all(12), - child: Text('${snapshot.error}'), + child: Text('${snapshot.stackTrace}'), ), // Error message ), ); diff --git a/pubspec.yaml b/pubspec.yaml index 93f1a4f..c041237 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -100,3 +100,18 @@ flutter: weight: 800 - asset: assets/fonts/Poppins/Poppins-Bold.ttf weight: 900 + - family: Cairo + fonts: + - asset: assets/fonts/Cairo/Cairo-Light/Cairo-Light.eot + - asset: assets/fonts/Cairo/Cairo-Light/Cairo-Light.otf + - asset: assets/fonts/Cairo/Cairo-Light/Cairo-Light.ttf + - asset: assets/fonts/Cairo/Cairo-Light/Cairo-Light.woff + weight: 300 + - asset: assets/fonts/Cairo/Cairo-Regular/Cairo-Regular.ttf + weight: 400 + - asset: assets/fonts/Cairo/Cairo-Bold/Cairo-Bold.eot + - asset: assets/fonts/Cairo/Cairo-Bold/Cairo-Bold.otf + - asset: assets/fonts/Cairo/Cairo-Bold/Cairo-Bold.ttf + - asset: assets/fonts/Cairo/Cairo-Bold/Cairo-Bold.woff + weight: 700 +