Added the Arabic Language Support

master
FaizHashmiCS22 2 years ago
parent 87ba49fe54
commit 74ab4d5f84

@ -33,6 +33,7 @@ class CallConfig {
late String createdOn;
late int editedBy;
late String editedOn;
late String preVoiceText;
late String roomText;
late String queueNoText;
late String callForText;
@ -74,6 +75,7 @@ class CallConfig {
this.createdOn = "",
this.editedBy = 0,
this.editedOn = "",
this.preVoiceText = "",
this.roomText = "",
this.queueNoText = "",
this.callForText = "",
@ -101,7 +103,7 @@ class CallConfig {
concurrentCallDelaySec = json['concurrentCallDelaySec'];
voiceType = json['voiceType'];
screenLanguage = json['screenLanguage'] ?? 1;
voiceLanguage = json['voiceLanguage'];
voiceLanguage = screenLanguage; // json['voiceLanguage'] ?? 1;
screenMaxDisplayPatients = json['screenMaxDisplayPatients'];
prioritySMS = json['prioritySMS'];
priorityWhatsApp = json['priorityWhatsApp'];
@ -115,6 +117,7 @@ class CallConfig {
createdOn = json['createdOn'];
editedBy = json['editedBy'];
editedOn = json['editedOn'];
preVoiceText = json['preVoiceText'] ?? (json['textDirection'] == 2 ? "رقم التذكرة" : "Ticket Number");
roomText = json['roomText'];
queueNoText = json['queueNoText'];
callForText = json['callForText'];

@ -79,7 +79,6 @@ class AppProvider extends ChangeNotifier {
if (widgetsConfigModel != null) {
currentWidgetsConfigModel = widgetsConfigModel;
log("I got this data: ${widgetsConfigModel.toString()}");
notifyListeners();
}
}
@ -87,7 +86,6 @@ class AppProvider extends ChangeNotifier {
WeathersWidgetModel currentWeathersWidgetModel = WeathersWidgetModel();
Future<void> getWeatherDetailsFromServer() async {
log("I got this data from Weather: ");
WeathersWidgetModel? weathersWidgetModel = await API.getWeatherDetailsFromServer(
(currentWidgetsConfigModel!.cityKey ?? "").toString(),
@ -96,7 +94,6 @@ class AppProvider extends ChangeNotifier {
if (weathersWidgetModel != null) {
currentWeathersWidgetModel = weathersWidgetModel;
log("I got this data from Weather: ${weathersWidgetModel.toString()}");
notifyListeners();
}
}
@ -308,9 +305,16 @@ class AppProvider extends ChangeNotifier {
await audioPlayer.play();
await Future.delayed(const Duration(seconds: 3));
}
if (patientTicket.isVoiceReq && voiceCaller == null && !patientTicket.isQueue) {
final postVoice = getCallTypeText(patientTicket, patientCallConfigurations);
voiceCaller = CallByVoice(preVoice: "Ticket Number", ticketNo: patientTicket.queueNo.trim().toString(), postVoice: postVoice, lang: 'en', flutterTts: flutterTts);
voiceCaller = CallByVoice(
preVoice: patientCallConfigurations.preVoiceText,
ticketNo: patientTicket.queueNo.trim().toString(),
postVoice: postVoice,
lang: patientCallConfigurations.voiceLanguage == 1 ? "en-US" : "ar",
flutterTts: flutterTts,
);
await voiceCaller!.startCalling(patientTicket.queueNo.trim().toString() != patientTicket.callNoStr.trim().toString());
voiceCaller = null;
if (isQueuePatients.isNotEmpty) {
@ -318,13 +322,10 @@ class AppProvider extends ChangeNotifier {
}
} else {
isCallingInProgress = false;
log("Setting isCallingInProgress : $isCallingInProgress");
if (isApiCallNeeded) {
log("I will start waiting!!");
Timer(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec), () async {
await callPatientsAPI();
log("Called the API after waiting!");
isApiCallNeeded = false;
});
}
@ -339,7 +340,6 @@ class AppProvider extends ChangeNotifier {
if (currentPatient.isVoiceReq) return;
if (isQueuePatients.isNotEmpty) {
log("isQueuePatients length : ${isQueuePatients.length}");
final length = isQueuePatients.length;
for (int i = 0; i < length; i++) {
await Future.delayed(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec)).whenComplete(() async {
@ -358,12 +358,9 @@ class AppProvider extends ChangeNotifier {
}
}
isCallingInProgress = false;
log("Setting isCallingInProgress : $isCallingInProgress");
if (isApiCallNeeded) {
log("I will start waiting!!");
Timer(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec), () async {
await callPatientsAPI();
log("Called the API after waiting!");
isApiCallNeeded = false;
});
}
@ -376,7 +373,6 @@ class AppProvider extends ChangeNotifier {
flutterTts.setCompletionHandler(() async {
if (isQueuePatients.isNotEmpty) {
log("isQueuePatients length : ${isQueuePatients.length}");
final length = isQueuePatients.length;
for (int i = 0; i < length; i++) {
await Future.delayed(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec)).whenComplete(() async {
@ -395,12 +391,9 @@ class AppProvider extends ChangeNotifier {
}
}
isCallingInProgress = false;
log("Setting isCallingInProgress : $isCallingInProgress");
if (isApiCallNeeded) {
log("I will start waiting!!");
Timer(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec), () async {
await callPatientsAPI();
log("Called the API after waiting!");
isApiCallNeeded = false;
});
}

@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:marquee/marquee.dart';
import 'package:provider/provider.dart';
import 'package:queuing_system/core/base/app_scaffold_widget.dart';
import 'package:queuing_system/core/config/config.dart';
@ -9,7 +8,6 @@ import 'package:queuing_system/footer/app_footer.dart';
import 'package:queuing_system/header/app_header.dart';
import 'package:queuing_system/home/app_provider.dart';
import 'package:queuing_system/home/priority_calls_components.dart';
import 'package:queuing_system/utils/utils.dart';
import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
class MyHomePage extends StatelessWidget {
@ -129,11 +127,9 @@ class MyHomePage extends StatelessWidget {
);
}
@override
Widget build(BuildContext context) {
final appProvider = context.watch<AppProvider>();
return AppScaffold(
appProvider: appProvider,
appBar: const AppHeader(),

@ -34,12 +34,13 @@ class CallByVoice {
patientAlpha = ticketNo.split("-")[0];
patientNumeric = ticketNo.split("-")[1];
}
// await flutterTts.setLanguage("en-US");
// Create Pre Voice Players
if (postVoice != null && postVoice.isNotEmpty) {
flutterTts.setSpeechRate(0.45);
flutterTts.setPitch(0.9);
flutterTts.setVolume(1.0);
await flutterTts.setLanguage(lang);
// await flutterTts.speak(clinicName + " .. " + patientAlpha + " .. " + patientNumeric + " .. " + postVoice);
await flutterTts.speak(preVoice + " .. " + clinicName + " .. " + patientAlpha + " .. " + patientNumeric + " .. " + postVoice);
}

Loading…
Cancel
Save