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

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

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

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

@ -15,7 +15,7 @@ class AppFooter extends StatelessWidget {
return Consumer(builder: (BuildContext context, AppProvider appProvider, Widget? child) {
return Container(
color: Colors.grey.withOpacity(0.1),
height: Utils.getHeight() * 0.8,
height: Utils.getHeight() * 0.95,
width: double.infinity,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
@ -37,7 +37,8 @@ class AppFooter extends StatelessWidget {
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(
children: [
InkWell(

@ -6,7 +6,7 @@ import 'package:queuing_system/home/app_provider.dart';
import 'package:queuing_system/utils/utils.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);
// Widget getWeatherWidget() {

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

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

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

Loading…
Cancel
Save