FIXED THE LIST ISSUE FROM PERSONAL MAC

master
faizatflutter 2 years ago
parent 2398a67465
commit 66010e4f5d

@ -21,6 +21,7 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0' flutterVersionName = '1.0'
} }
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
@ -44,8 +45,9 @@ android {
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.queuing_system" applicationId "com.example.queuing_system"
minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger() minSdkVersion 24
targetSdkVersion localProperties.getProperty('flutter.targetSdkVersion').toInteger() // minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger()
targetSdkVersion 31
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
} }

@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app') project.evaluationDependsOn(':app')
} }
task clean(type: Delete) { tasks.register("clean", Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }

@ -54,9 +54,9 @@ class API {
callPatients.sort((a, b) => a.editedOnTimeStamp.compareTo(b.editedOnTimeStamp)); callPatients.sort((a, b) => a.editedOnTimeStamp.compareTo(b.editedOnTimeStamp));
isQueuePatients.sort((a, b) => a.editedOnTimeStamp.compareTo(b.editedOnTimeStamp)); isQueuePatients.sort((a, b) => a.editedOnTimeStamp.compareTo(b.editedOnTimeStamp));
log("callPatients: ${callPatients.toString()}"); log("callPatients: ${callPatients.toList().toString()}");
log("isQueuePatients: ${isQueuePatients.toString()}"); log("isQueuePatients: ${isQueuePatients.reversed.toList().toString()}");
onSuccess(callPatients.reversed.toList(), isQueuePatients.reversed.toList(), callConfig); onSuccess(callPatients.toList(), isQueuePatients.reversed.toList(), callConfig);
} else { } else {
onFailure(apiResp); onFailure(apiResp);
} }

@ -107,6 +107,7 @@ class CallConfig {
screenLanguage = json['screenLanguage'] ?? 1; screenLanguage = json['screenLanguage'] ?? 1;
voiceLanguage = screenLanguage; // json['voiceLanguage'] ?? 1; voiceLanguage = screenLanguage; // json['voiceLanguage'] ?? 1;
screenMaxDisplayPatients = json['screenMaxDisplayPatients']; screenMaxDisplayPatients = json['screenMaxDisplayPatients'];
// screenMaxDisplayPatients = 3;
prioritySMS = json['prioritySMS']; prioritySMS = json['prioritySMS'];
priorityWhatsApp = json['priorityWhatsApp']; priorityWhatsApp = json['priorityWhatsApp'];
priorityEmail = json['priorityEmail']; priorityEmail = json['priorityEmail'];

@ -15,7 +15,7 @@ class AppFooter extends StatelessWidget {
return Consumer(builder: (BuildContext context, AppProvider appProvider, Widget? child) { return Consumer(builder: (BuildContext context, AppProvider appProvider, Widget? child) {
return Container( return Container(
color: Colors.grey.withOpacity(0.1), color: Colors.grey.withOpacity(0.1),
height: Utils.getHeight() * 0.8, height: Utils.getHeight() * 0.95,
width: double.infinity, width: double.infinity,
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
@ -37,7 +37,8 @@ class AppFooter extends StatelessWidget {
fontFamily: 'Poppins-Medium.ttf', fontFamily: 'Poppins-Medium.ttf',
), ),
), ),
Text(appProvider.currentDeviceIp, style: TextStyle(fontWeight: FontWeight.w500, fontSize: SizeConfig.getWidthMultiplier() * 2.2)), Text(appProvider.currentDeviceIp,
style: TextStyle(fontWeight: FontWeight.w500, fontSize: SizeConfig.getWidthMultiplier() * 2.2)),
Row( Row(
children: [ children: [
InkWell( InkWell(

@ -6,7 +6,7 @@ import 'package:queuing_system/home/app_provider.dart';
import 'package:queuing_system/utils/utils.dart'; import 'package:queuing_system/utils/utils.dart';
import 'package:queuing_system/widget/data_display/app_texts_widget.dart'; import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
class AppHeader extends StatelessWidget with PreferredSizeWidget { class AppHeader extends StatelessWidget implements PreferredSizeWidget {
const AppHeader({Key? key}) : super(key: key); const AppHeader({Key? key}) : super(key: key);
// Widget getWeatherWidget() { // Widget getWeatherWidget() {

@ -33,6 +33,7 @@ class AppProvider extends ChangeNotifier {
listenNetworkConnectivity(); listenNetworkConnectivity();
listenAudioPlayerEvents(); listenAudioPlayerEvents();
getTheWidgetsConfigurationsEveryMidnight(); getTheWidgetsConfigurationsEveryMidnight();
// await callPatientsAPI();
} }
SignalRHelper signalRHelper = SignalRHelper(); SignalRHelper signalRHelper = SignalRHelper();
@ -163,7 +164,8 @@ class AppProvider extends ChangeNotifier {
RssFeedModel currentRssFeedModel = RssFeedModel(); RssFeedModel currentRssFeedModel = RssFeedModel();
Future<void> getRssFeedDetailsFromServer() async { Future<void> getRssFeedDetailsFromServer() async {
RssFeedModel? rssFeedModel = await API.getRssFeedDetailsFromServer(languageId: 0, onFailure: (error) => log("Api call failed with this error: ${error.toString()}")); RssFeedModel? rssFeedModel =
await API.getRssFeedDetailsFromServer(languageId: 0, onFailure: (error) => log("Api call failed with this error: ${error.toString()}"));
if (rssFeedModel != null) { if (rssFeedModel != null) {
currentRssFeedModel = rssFeedModel; currentRssFeedModel = rssFeedModel;
@ -180,7 +182,7 @@ class AppProvider extends ChangeNotifier {
await getWeatherDetailsFromServer(); await getWeatherDetailsFromServer();
} }
if (currentWidgetsConfigModel!.isPrayerTimeReq!) { if (currentWidgetsConfigModel!.isPrayerTimeReq!) {
// await getPrayerDetailsFromServer(); await getPrayerDetailsFromServer();
} }
if (currentWidgetsConfigModel!.isRssFeedReq!) { if (currentWidgetsConfigModel!.isRssFeedReq!) {
await getRssFeedDetailsFromServer(); await getRssFeedDetailsFromServer();
@ -250,6 +252,7 @@ class AppProvider extends ChangeNotifier {
} }
Future<void> callPatientsAPI() async { Future<void> callPatientsAPI() async {
log("calling callPatientsAPI");
patientTickets.clear(); patientTickets.clear();
API.getCallRequestInfoByClinicInfo(currentDeviceIp, API.getCallRequestInfoByClinicInfo(currentDeviceIp,
onSuccess: (waitingCalls, isQueuePatientsCalls, callConfigs) async { onSuccess: (waitingCalls, isQueuePatientsCalls, callConfigs) async {
@ -259,11 +262,15 @@ class AppProvider extends ChangeNotifier {
} else { } else {
patientTickets = waitingCalls; patientTickets = waitingCalls;
} }
if (isQueuePatientsCalls.length > patientCallConfigurations.screenMaxDisplayPatients) {
isQueuePatients = isQueuePatientsCalls.sublist(0, patientCallConfigurations.screenMaxDisplayPatients);
} else {
isQueuePatients = isQueuePatientsCalls; isQueuePatients = isQueuePatientsCalls;
}
notifyListeners(); notifyListeners();
if (patientTickets.isNotEmpty) { if (patientTickets.isNotEmpty) {
updateCurrentScreenRotation(patientTickets.first.screenRotationEnum); updateCurrentScreenRotation(patientTickets.first.screenRotationEnum);
voiceCallPatientTicket(patientTickets.first); voiceCallPatientTicket(patientTickets.first, "callPatientsAPI");
updatePatientTicket(patientTickets.first); updatePatientTicket(patientTickets.first);
} }
}, },
@ -271,7 +278,8 @@ class AppProvider extends ChangeNotifier {
} }
onPingReceived(data) async { onPingReceived(data) async {
log("isCallingInProgress: $isCallingInProgress"); log("A new Ping Received");
log("isCallingInProgress from onPingReceived: $isCallingInProgress");
log("isApiCallNeeded: $isApiCallNeeded"); log("isApiCallNeeded: $isApiCallNeeded");
if (patientTickets.isNotEmpty) { if (patientTickets.isNotEmpty) {
if (isCallingInProgress) { if (isCallingInProgress) {
@ -316,15 +324,22 @@ class AppProvider extends ChangeNotifier {
// await voiceCaller!.startCalling(true); // await voiceCaller!.startCalling(true);
// } // }
voiceCallPatientTicket(PatientTicketModel patientTicket) async { voiceCallPatientTicket(PatientTicketModel patientTicket, String calledFrom) async {
log("voiceCallPatientTicket calledFrom : $calledFrom");
currentPatient = patientTicket; currentPatient = patientTicket;
isCallingInProgress = true; isCallingInProgress = true;
log("Setting isCallingInProgress : $isCallingInProgress"); log("Setting isCallingInProgress : $isCallingInProgress");
log("isVoiceReq: ${patientTicket.isVoiceReq}");
log("voiceCaller: ${voiceCaller == null}");
log("isQueue: ${patientTicket.isQueue}");
log("isToneReq: ${patientTicket.isToneReq}");
if (patientTicket.isToneReq && !patientTicket.isQueue) { if (patientTicket.isToneReq && !patientTicket.isQueue) {
audioPlayer.setAsset("assets/tones/call_tone.mp3"); audioPlayer.setAsset("assets/tones/call_tone.mp3");
await audioPlayer.play(); await audioPlayer.play();
await Future.delayed(const Duration(seconds: 3)); Future.delayed(const Duration(seconds: 3));
} }
if (patientTicket.isVoiceReq && voiceCaller == null && !patientTicket.isQueue) { if (patientTicket.isVoiceReq && voiceCaller == null && !patientTicket.isQueue) {
@ -337,13 +352,16 @@ class AppProvider extends ChangeNotifier {
lang: patientTicket.voiceLanguage == 1 ? "en" : "ar", lang: patientTicket.voiceLanguage == 1 ? "en" : "ar",
flutterTts: flutterTts, flutterTts: flutterTts,
); );
await voiceCaller!.startCalling(patientTicket.queueNo.trim().toString() != patientTicket.callNoStr.trim().toString()); voiceCaller!.startCalling(patientTicket.queueNo.trim().toString() != patientTicket.callNoStr.trim().toString()).whenComplete(() {
voiceCaller = null; voiceCaller = null;
if (isQueuePatients.isNotEmpty) { // if (isQueuePatients.isNotEmpty) {
isQueuePatients.removeAt(0); // isQueuePatients.removeAt(0);
} // }
});
} else { } else {
isCallingInProgress = false; isCallingInProgress = false;
log("Setting isCallingInProgress : $isCallingInProgress");
if (isApiCallNeeded) { if (isApiCallNeeded) {
Timer(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec), () async { Timer(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec), () async {
await callPatientsAPI(); await callPatientsAPI();
@ -362,6 +380,7 @@ class AppProvider extends ChangeNotifier {
} }
if (isQueuePatients.isNotEmpty) { if (isQueuePatients.isNotEmpty) {
log("i am here on line 375");
final length = isQueuePatients.length; final length = isQueuePatients.length;
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
await Future.delayed(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec)).whenComplete(() async { await Future.delayed(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec)).whenComplete(() async {
@ -374,12 +393,14 @@ class AppProvider extends ChangeNotifier {
isQueuePatients.removeAt(0); isQueuePatients.removeAt(0);
patientTickets.add(temp); patientTickets.add(temp);
notifyListeners(); notifyListeners();
await voiceCallPatientTicket(patientTickets.first); await voiceCallPatientTicket(patientTickets.first, "listenAudioPlayerEvents");
updatePatientTicket(patientTickets.first); updatePatientTicket(patientTickets.first);
}); });
} }
} }
isCallingInProgress = false; isCallingInProgress = false;
log("Setting isCallingInProgress : $isCallingInProgress");
if (isApiCallNeeded) { if (isApiCallNeeded) {
Timer(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec), () async { Timer(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec), () async {
await callPatientsAPI(); await callPatientsAPI();
@ -391,10 +412,13 @@ class AppProvider extends ChangeNotifier {
flutterTts.setCompletionHandler(() async { flutterTts.setCompletionHandler(() async {
log("My Value is in setCompletionHandler: $isVoiceActualCompletedGlobally"); log("My Value is in setCompletionHandler: $isVoiceActualCompletedGlobally");
if (!isVoiceActualCompletedGlobally) {} log("isQueuePatients.length in setCompletionHandler: ${isQueuePatients.length}");
if (!isVoiceActualCompletedGlobally) {
return;
}
if (isQueuePatients.isNotEmpty) { if (isQueuePatients.isNotEmpty) {
final length = isQueuePatients.length; // final length = isQueuePatients.length;
for (int i = 0; i < length; i++) { // for (int i = 0; i < length; i++) {
await Future.delayed(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec)).whenComplete(() async { await Future.delayed(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec)).whenComplete(() async {
PatientTicketModel temp = PatientTicketModel(); PatientTicketModel temp = PatientTicketModel();
if (patientTickets.isNotEmpty) { if (patientTickets.isNotEmpty) {
@ -402,15 +426,19 @@ class AppProvider extends ChangeNotifier {
patientTickets.removeAt(0); patientTickets.removeAt(0);
} }
notifyListeners(); notifyListeners();
if (isQueuePatients.isNotEmpty) {
isQueuePatients.removeAt(0); isQueuePatients.removeAt(0);
}
patientTickets.add(temp); patientTickets.add(temp);
notifyListeners(); notifyListeners();
await voiceCallPatientTicket(patientTickets.first); await voiceCallPatientTicket(patientTickets.first, "setCompletionHandler");
updatePatientTicket(patientTickets.first); updatePatientTicket(patientTickets.first);
}); });
} // }
} }
isCallingInProgress = false; isCallingInProgress = false;
log("Setting isCallingInProgress : $isCallingInProgress");
if (isApiCallNeeded) { if (isApiCallNeeded) {
Timer(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec), () async { Timer(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec), () async {
await callPatientsAPI(); await callPatientsAPI();
@ -447,7 +475,8 @@ class AppProvider extends ChangeNotifier {
onDisconnect(exception) { onDisconnect(exception) {
log("SignalR: onDisconnect"); log("SignalR: onDisconnect");
signalRHelper.startSignalRConnection(currentDeviceIp, onUpdateAvailable: onPingReceived, onConnect: onConnect, onConnecting: onConnecting, onDisconnect: onDisconnect); signalRHelper.startSignalRConnection(currentDeviceIp,
onUpdateAvailable: onPingReceived, onConnect: onConnect, onConnecting: onConnecting, onDisconnect: onDisconnect);
} }
onConnecting() { onConnecting() {

@ -18,11 +18,14 @@ class MyHomePage extends StatelessWidget {
getWeatherWidget() { getWeatherWidget() {
return Consumer(builder: (BuildContext context, AppProvider appProvider, Widget? child) { return Consumer(builder: (BuildContext context, AppProvider appProvider, Widget? child) {
if (appProvider.currentWeathersWidgetModel.maxTemp == null || appProvider.currentWeathersWidgetModel.minTemp == null || appProvider.currentWeathersWidgetModel.iconPhrase == null) { if (appProvider.currentWeathersWidgetModel.maxTemp == null ||
appProvider.currentWeathersWidgetModel.minTemp == null ||
appProvider.currentWeathersWidgetModel.iconPhrase == null) {
return const SizedBox.shrink(); return const SizedBox.shrink();
} }
return Container( return Container(
height: (appProvider.currentScreenRotation == ScreenOrientationEnum.portraitUp || appProvider.currentScreenRotation == ScreenOrientationEnum.portraitDown) height: (appProvider.currentScreenRotation == ScreenOrientationEnum.portraitUp ||
appProvider.currentScreenRotation == ScreenOrientationEnum.portraitDown)
? SizeConfig.getHeightMultiplier() * 8 ? SizeConfig.getHeightMultiplier() * 8
: SizeConfig.getHeightMultiplier() * 5, : SizeConfig.getHeightMultiplier() * 5,
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10), padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
@ -66,7 +69,8 @@ class MyHomePage extends StatelessWidget {
return const SizedBox.shrink(); return const SizedBox.shrink();
} }
return Container( return Container(
height: (appProvider.currentScreenRotation == ScreenOrientationEnum.portraitUp || appProvider.currentScreenRotation == ScreenOrientationEnum.portraitDown) height: (appProvider.currentScreenRotation == ScreenOrientationEnum.portraitUp ||
appProvider.currentScreenRotation == ScreenOrientationEnum.portraitDown)
? SizeConfig.getHeightMultiplier() * 8 ? SizeConfig.getHeightMultiplier() * 8
: SizeConfig.getHeightMultiplier() * 5, : SizeConfig.getHeightMultiplier() * 5,
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10), padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
@ -149,8 +153,8 @@ class MyHomePage extends StatelessWidget {
log(appProvider.currentScreenRotation.toString()); log(appProvider.currentScreenRotation.toString());
return RotatedBox( return RotatedBox(
// quarterTurns: 3, quarterTurns: 3,
quarterTurns: getTurnsByOrientation(appProvider.currentScreenRotation), // quarterTurns: getTurnsByOrientation(appProvider.currentScreenRotation),
child: AppScaffold( child: AppScaffold(
appProvider: appProvider, appProvider: appProvider,
appBar: const AppHeader(), appBar: const AppHeader(),
@ -161,7 +165,7 @@ class MyHomePage extends StatelessWidget {
} }
Widget dataContent({required AppProvider appProvider, required BuildContext context}) { Widget dataContent({required AppProvider appProvider, required BuildContext context}) {
log("isCallingInProgress: ${appProvider.isCallingInProgress}"); log("isCallingInProgress from HomeScreen: ${appProvider.isCallingInProgress}");
// appProvider.voiceCallPatientTicket(appProvider.patientTickets.first); // appProvider.voiceCallPatientTicket(appProvider.patientTickets.first);
// appProvider.testCalling(); // appProvider.testCalling();
if (appProvider.patientTickets.isEmpty) { if (appProvider.patientTickets.isEmpty) {

@ -35,7 +35,7 @@ dependencies:
provider: ^6.0.1 provider: ^6.0.1
get_it: ^7.1.3 get_it: ^7.1.3
connectivity: ^3.0.6 connectivity: ^3.0.6
flutter_gifimage: ^1.0.1 # flutter_gifimage: ^1.0.1
flutter_svg: ^1.0.3 flutter_svg: ^1.0.3
http: ^0.13.0 http: ^0.13.0
blinking_text: ^1.0.2 blinking_text: ^1.0.2

Loading…
Cancel
Save