diff --git a/lib/core/config/config.dart b/lib/core/config/config.dart index 6cba86c..3868dc3 100644 --- a/lib/core/config/config.dart +++ b/lib/core/config/config.dart @@ -14,6 +14,8 @@ const apiKey = 'EE17D21C7943485D9780223CCE55DCE5'; // UAT /// Timer Info const TIMER_MIN = 10; +const currentBuildVersion = 4; + class AppGlobal { static var CONTEX; diff --git a/lib/footer/app_footer.dart b/lib/footer/app_footer.dart index 3123c1c..5b7ec79 100644 --- a/lib/footer/app_footer.dart +++ b/lib/footer/app_footer.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:marquee/marquee.dart'; import 'package:provider/provider.dart'; +import 'package:queuing_system/core/config/config.dart'; import 'package:queuing_system/core/config/size_config.dart'; import 'package:queuing_system/core/response_models/call_config_model.dart'; import 'package:queuing_system/home/app_provider.dart'; @@ -37,8 +38,7 @@ class AppFooter extends StatelessWidget { fontFamily: 'Poppins-Medium.ttf', ), ), - Text("v${appProvider.currentDeviceIp}", - style: TextStyle(fontWeight: FontWeight.w500, fontSize: SizeConfig.getWidthMultiplier() * 2.2)), + Text("v${appProvider.currentDeviceIp}_$currentBuildVersion", style: TextStyle(fontWeight: FontWeight.w500, fontSize: SizeConfig.getWidthMultiplier() * 1.8)), Row( children: [ InkWell( diff --git a/lib/home/app_provider.dart b/lib/home/app_provider.dart index 16bd180..268e7d3 100644 --- a/lib/home/app_provider.dart +++ b/lib/home/app_provider.dart @@ -400,14 +400,20 @@ class AppProvider extends ChangeNotifier { logger.i("voiceCaller: ${voiceCaller == null}"); logger.i("isQueue: ${patientTicket.isQueue}"); logger.i("isToneReq: ${patientTicket.isToneReq}"); - - if (patientTicket.isToneReq && !patientTicket.isQueue) { + //TODO: DATA ACCURACY + // if (patientTicket.isToneReq && !patientTicket.isQueue) { + if (!patientTicket.isQueue) { + if (!patientTicket.isToneReq) { + await audioPlayer.setVolume(0.0); + } audioPlayer.setAsset("assets/tones/call_tone.mp3"); await audioPlayer.play(); await Future.delayed(const Duration(seconds: 2)); } - if (patientTicket.isVoiceReq && voiceCaller == null && !patientTicket.isQueue) { + //TODO: DATA ACCURACY + // if (patientTicket.isVoiceReq && voiceCaller == null && !patientTicket.isQueue) { + if (!patientTicket.isQueue) { logger.i("patientTicket.voiceLanguage: ${patientTicket.voiceLanguage}"); final postVoice = getCallTypeText(patientTicket); voiceCaller = CallByVoice( @@ -416,12 +422,16 @@ class AppProvider extends ChangeNotifier { postVoice: postVoice, lang: patientTicket.voiceLanguage == 1 ? "en" : "ar", flutterTts: flutterTts, + isMute: !patientTicket.isVoiceReq, ); - await voiceCaller!.startCalling(patientTicket.queueNo.trim().toString() != patientTicket.callNoStr.trim().toString()).whenComplete(() { - voiceCaller = null; - onVoiceCompleted(); - logger.i("Completed Calling!! ${isQueuePatients.length}"); - }); + + //TODO: DATA ACCURACY + // await voiceCaller!.startCalling(patientTicket.queueNo.trim().toString() != patientTicket.callNoStr.trim().toString()).whenComplete(() { + // voiceCaller = null; + // onVoiceCompleted(); + // logger.i("Completed Calling!! ${isQueuePatients.length}"); + // }); + await voiceCaller!.startCalling(patientTicket.queueNo.trim().toString() != patientTicket.callNoStr.trim().toString()); } else { isCallingInProgress = false; logger.i("Setting isCallingInProgress : $isCallingInProgress"); diff --git a/lib/home/home_screen.dart b/lib/home/home_screen.dart index b6bce35..743b7e7 100644 --- a/lib/home/home_screen.dart +++ b/lib/home/home_screen.dart @@ -22,7 +22,9 @@ class MyHomePage extends StatelessWidget { return const SizedBox.shrink(); } return Container( - height: (appProvider.currentScreenRotation == ScreenOrientationEnum.portraitUp || appProvider.currentScreenRotation == ScreenOrientationEnum.portraitDown) ? SizeConfig.getHeightMultiplier() * 8 : SizeConfig.getHeightMultiplier() * 5, + height: (appProvider.currentScreenRotation == ScreenOrientationEnum.portraitUp || appProvider.currentScreenRotation == ScreenOrientationEnum.portraitDown) + ? SizeConfig.getHeightMultiplier() * 8 + : SizeConfig.getHeightMultiplier() * 5, padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10), decoration: AppGlobal.configWidgetDecoration, child: Directionality( @@ -64,7 +66,9 @@ class MyHomePage extends StatelessWidget { return const SizedBox.shrink(); } return Container( - height: (appProvider.currentScreenRotation == ScreenOrientationEnum.portraitUp || appProvider.currentScreenRotation == ScreenOrientationEnum.portraitDown) ? SizeConfig.getHeightMultiplier() * 8 : SizeConfig.getHeightMultiplier() * 5, + height: (appProvider.currentScreenRotation == ScreenOrientationEnum.portraitUp || appProvider.currentScreenRotation == ScreenOrientationEnum.portraitDown) + ? SizeConfig.getHeightMultiplier() * 8 + : SizeConfig.getHeightMultiplier() * 5, padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10), decoration: AppGlobal.configWidgetDecoration, child: Directionality( diff --git a/lib/home/priority_calls_components.dart b/lib/home/priority_calls_components.dart index baa260c..09ed370 100644 --- a/lib/home/priority_calls_components.dart +++ b/lib/home/priority_calls_components.dart @@ -106,7 +106,7 @@ class TicketItem extends StatelessWidget { style: TextStyle( fontSize: SizeConfig.getWidthMultiplier() * 10, letterSpacing: -1, - height: 0.5, + height: 0.7, fontWeight: FontWeight.bold, ), beginColor: Colors.black, @@ -122,10 +122,7 @@ class TicketItem extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.center, children: [ - Padding( - padding: EdgeInsets.only(bottom: callType == CallType.vitalSign ? 8 : 8), - child: callType.icon(SizeConfig.getHeightMultiplier() * 2), - ), + callType.icon(SizeConfig.getHeightMultiplier() * 2), const SizedBox(width: 13), AppText( callType.message(callConfig), @@ -133,16 +130,13 @@ class TicketItem extends StatelessWidget { letterSpacing: -1, fontSize: SizeConfig.getWidthMultiplier() * 3.8, fontWeight: FontWeight.w600, - fontHeight: 1, + fontHeight: 0.7, ), - Padding( - padding: const EdgeInsets.only(bottom: 8.0), - child: Container( - color: Colors.grey.withOpacity(0.5), - width: 5, - height: SizeConfig.getHeightMultiplier() * 2, - margin: const EdgeInsets.symmetric(horizontal: 15), - ), + Container( + color: Colors.grey.withOpacity(0.5), + width: 5, + height: SizeConfig.getHeightMultiplier() * 2, + margin: const EdgeInsets.symmetric(horizontal: 15), ), AppText( callConfig.textDirection == TextDirection.ltr ? "${callConfig.roomText}: $roomNo" : " $roomNo : ${callConfig.roomText}", @@ -150,7 +144,7 @@ class TicketItem extends StatelessWidget { letterSpacing: -1, fontSize: SizeConfig.getWidthMultiplier() * 3.8, fontWeight: FontWeight.w600, - fontHeight: 1, + fontHeight: 0.7, ), ], ), @@ -194,7 +188,6 @@ Widget priorityTicketsWithSideList({required List tickets, r final priorityTickets = tickets.sublist(0, 3); final otherTickets = tickets.sublist(3, tickets.length); final AppProvider appProvider = context.watch(); - log("appProvider.currentScreenRotation: ${appProvider.currentScreenRotation}"); final List children = [ Expanded(flex: 8, child: PriorityTickets(callConfig: callConfig, tickets: priorityTickets)), @@ -204,11 +197,11 @@ Widget priorityTicketsWithSideList({required List tickets, r child: ListView( children: [ Padding( - padding: EdgeInsets.fromLTRB(10, SizeConfig.getHeightMultiplier() * 3.3, 10, 10), + padding: EdgeInsets.fromLTRB(10, SizeConfig.getHeightMultiplier() * 3.3, 10, 20), child: Directionality( textDirection: callConfig.textDirection, child: Row( - crossAxisAlignment: CrossAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Expanded( @@ -221,7 +214,7 @@ Widget priorityTicketsWithSideList({required List tickets, r letterSpacing: -2, fontHeight: 0.5, fontWeight: FontWeight.bold, - fontSize: SizeConfig.getWidthMultiplier() * 3.8, + fontSize: SizeConfig.getWidthMultiplier() * 4, textAlign: TextAlign.center, ), ], @@ -243,7 +236,7 @@ Widget priorityTicketsWithSideList({required List tickets, r letterSpacing: -2, fontHeight: 0.5, fontWeight: FontWeight.bold, - fontSize: SizeConfig.getWidthMultiplier() * 3.8, + fontSize: SizeConfig.getWidthMultiplier() * 4, textAlign: TextAlign.center, ), ], @@ -265,7 +258,7 @@ Widget priorityTicketsWithSideList({required List tickets, r letterSpacing: -2, fontHeight: 0.5, fontWeight: FontWeight.bold, - fontSize: SizeConfig.getWidthMultiplier() * 3.8, + fontSize: SizeConfig.getWidthMultiplier() * 4, textAlign: TextAlign.center, ), ], @@ -281,11 +274,10 @@ Widget priorityTicketsWithSideList({required List tickets, r itemBuilder: (ctx, idx) { final itm = otherTickets[idx]; return Padding( - padding: const EdgeInsets.all(8), + padding: const EdgeInsets.all(12), child: Directionality( textDirection: callConfig.textDirection, child: Row( - crossAxisAlignment: CrossAxisAlignment.end, children: [ Expanded( flex: 5, @@ -297,7 +289,7 @@ Widget priorityTicketsWithSideList({required List tickets, r letterSpacing: -1, fontHeight: 0.5, fontWeight: FontWeight.bold, - fontSize: SizeConfig.getWidthMultiplier() * 3.5, + fontSize: SizeConfig.getWidthMultiplier() * 3.8, textAlign: TextAlign.center, ), ], @@ -306,35 +298,41 @@ Widget priorityTicketsWithSideList({required List tickets, r Container( color: Colors.grey.withOpacity(0.5), width: 5, - height: SizeConfig.getHeightMultiplier() * 2, + height: SizeConfig.getHeightMultiplier() * 2.5, margin: const EdgeInsets.symmetric(horizontal: 15), ), Expanded( flex: 5, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - width: SizeConfig.getWidthMultiplier() * 3.5, - child: itm.getCallType().icon(SizeConfig.getHeightMultiplier() * 2.5), - ), - const SizedBox(width: 15), - AppText( - itm.getCallType().message(callConfig, isListView: true), - color: itm.getCallType().color(), - letterSpacing: -1, - fontSize: SizeConfig.getWidthMultiplier() * 3, - fontWeight: FontWeight.w600, - fontHeight: 0.5, - ), - ], + child: SizedBox( + height: SizeConfig.getHeightMultiplier() * 3, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.only(bottom: itm.getCallType() == CallType.doctor ? 8.0 : 0.0), + child: itm.getCallType().icon( + itm.getCallType() == CallType.vitalSign ? SizeConfig.getWidthMultiplier() * 3 : SizeConfig.getWidthMultiplier() * 3.5, + fit: BoxFit.cover, + ), + ), + const SizedBox(width: 15), + AppText( + itm.getCallType().message(callConfig, isListView: true), + color: itm.getCallType().color(), + letterSpacing: 0, + fontSize: SizeConfig.getWidthMultiplier() * 3.8, + fontWeight: FontWeight.w600, + fontHeight: 1, + ), + ], + ), ), ), Container( color: Colors.grey.withOpacity(0.5), width: 5, - height: SizeConfig.getHeightMultiplier() * 2, + height: SizeConfig.getHeightMultiplier() * 2.5, margin: const EdgeInsets.symmetric(horizontal: 15), ), Expanded( @@ -344,10 +342,9 @@ Widget priorityTicketsWithSideList({required List tickets, r children: [ AppText( itm.roomNo, - // callConfig.textDirection == TextDirection.ltr ? "${callConfig.roomText}: ${itm.roomNo}" : " ${itm.roomNo} ${callConfig.roomText}: ", color: itm.getCallType().color(), - letterSpacing: -1.5, - fontSize: SizeConfig.getWidthMultiplier() * 3.3, + letterSpacing: 0, + fontSize: SizeConfig.getWidthMultiplier() * 3.8, fontWeight: FontWeight.w600, fontHeight: 0.5, ), diff --git a/lib/utils/call_by_voice.dart b/lib/utils/call_by_voice.dart index 51bd841..5301763 100644 --- a/lib/utils/call_by_voice.dart +++ b/lib/utils/call_by_voice.dart @@ -8,9 +8,17 @@ class CallByVoice { final String preVoice; final String ticketNo; final String postVoice; + final bool isMute; final FlutterTts flutterTts; - CallByVoice({this.lang = 'en', required this.ticketNo, required this.preVoice, required this.postVoice, required this.flutterTts}); + CallByVoice({ + this.lang = 'en', + required this.isMute, + required this.ticketNo, + required this.preVoice, + required this.postVoice, + required this.flutterTts, + }); double volume = 1.0; double pitch = 0.6; @@ -31,6 +39,9 @@ class CallByVoice { String clinicName = ""; String patientAlpha = ""; String patientNumeric = ""; + if (isMute) { + volume = 0.0; + } if (isClinicNameAdded) { var clinic = ticketNo.split(" "); @@ -54,13 +65,13 @@ class CallByVoice { } } // Create Pre Voice Players - if (postVoice != null && postVoice.isNotEmpty) { + if (postVoice.isNotEmpty) { log('lang $lang'); flutterTts.setSpeechRate(0.45); if (lang != "ar") { await flutterTts.setLanguage(lang); flutterTts.setPitch(0.9); - flutterTts.setVolume(1.0); + flutterTts.setVolume(volume); isVoiceActualCompletedGlobally = true; await flutterTts.awaitSpeakCompletion(true); await flutterTts.speak("$preVoice .. $clinicName .. $patientAlpha .. $patientNumeric .. $postVoice"); @@ -68,7 +79,7 @@ class CallByVoice { } flutterTts.setPitch(1.1); - flutterTts.setVolume(1.0); + flutterTts.setVolume(volume); await flutterTts.setLanguage(lang); isVoiceActualCompletedGlobally = false; await flutterTts.awaitSpeakCompletion(true); @@ -76,7 +87,7 @@ class CallByVoice { // await flutterTts.speak(preVoice + " .. " + clinicName + " .. " + patientAlpha + " .. " + patientNumeric + " .. " + postVoice); await flutterTts.speak("$preVoice .. "); await flutterTts.setLanguage("en"); - await flutterTts.speak("$clinicName .. $patientAlpha .. $patientNumeric .. "); + await flutterTts.speak("${clinicName.isNotEmpty ? ".." : ""} $patientAlpha .. $patientNumeric .. "); await flutterTts.setLanguage(lang); isVoiceActualCompletedGlobally = true; await flutterTts.speak(postVoice); diff --git a/lib/utils/call_type.dart b/lib/utils/call_type.dart index 5bae053..4a0db85 100644 --- a/lib/utils/call_type.dart +++ b/lib/utils/call_type.dart @@ -42,19 +42,26 @@ extension XCallType on CallType { } } - SvgPicture icon(double height) { + SvgPicture icon(double height, {double? width, BoxFit fit = BoxFit.contain}) { + String iconPath = ""; if (this == CallType.vitalSign) { - return SvgPicture.asset(AppGlobal.vitalSignIcon, height: height, color: color()); + iconPath = AppGlobal.vitalSignIcon; } else if (this == CallType.doctor) { - return SvgPicture.asset(AppGlobal.doctorIcon, height: height, color: color()); + iconPath = AppGlobal.doctorIcon; } else if (this == CallType.procedure) { - return SvgPicture.asset(AppGlobal.procedureIcon, height: height, color: color()); + iconPath = AppGlobal.procedureIcon; } else if (this == CallType.vaccination) { - return SvgPicture.asset(AppGlobal.vaccinationIcon, height: height, color: color()); + iconPath = AppGlobal.vaccinationIcon; } else if (this == CallType.nebulization) { - return SvgPicture.asset(AppGlobal.nebulizationIcon, height: height, color: color()); + iconPath = AppGlobal.nebulizationIcon; } - return SvgPicture.asset("assets/images/wait.svg", height: height, color: color()); + + return SvgPicture.asset( + iconPath.isEmpty ? "assets/images/wait.svg" : iconPath, + height: height, + width: width, + fit: fit, + ); } String audio(String lang) {