diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 570563ba..35d24cc7 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -361,5 +361,6 @@ const Map> localizedValues = { }, "medicalProfile": {"en": "Medical Profile", 'ar': 'الملف الطبي'}, "consultation": {"en": "Consultation", "ar": "استشارة"}, - "logs": {"en": "Logs", "ar": "السجلات"} + "logs": {"en": "Logs", "ar": "السجلات"}, + "textToSpeech": {"en": "How May I Help You?", "ar": "كيف يمكنني مساعدتك؟"} }; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index f45fe22b..32b935fa 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -31,7 +31,7 @@ class BaseAppClient { //Map profile = await sharedPref.getObj(DOCTOR_PROFILE); String token = await sharedPref.getString(TOKEN); var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'en'); + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); var user = await sharedPref.getObject(USER_PROFILE); body['SetupID'] = body.containsKey('SetupID') ? body['SetupID'] != null ? body['SetupID'] : SETUP_ID diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 730228eb..ba3ad56e 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -45,7 +45,7 @@ class DoctorsListService extends BaseService { "SessionID": "YckwoXhUmWBsnHKEKig", "ClinicID": clinicID, "ProjectID": projectID, - "DoctorID": doctorId, //!= null ? doctorId : 0, + "DoctorName": doctorId, //!= null ? doctorId : 0, "ContinueDentalPlan": false, "IsSearchAppointmnetByClinicID": true, "PatientID": authUser.patientID != null ? authUser.patientID : 0, diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 76599677..df1999bb 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -447,6 +447,8 @@ class TranslationBase { String get consultation => localizedValues['consultation'][locale.languageCode]; String get logs => localizedValues['logs'][locale.languageCode]; + String get textToSpeech => + localizedValues['textToSpeech'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/others/bottom_bar.dart b/lib/widgets/others/bottom_bar.dart index edcc1ae2..32df2dfc 100644 --- a/lib/widgets/others/bottom_bar.dart +++ b/lib/widgets/others/bottom_bar.dart @@ -31,6 +31,7 @@ import 'package:diplomaticquarterapp/widgets/robo-search/robosearch.dart'; import 'dart:math'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/routes.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; class BottomBarSearch extends StatefulWidget { @override @@ -83,7 +84,7 @@ class _SearchBot extends State { maxLines: null, controller: searchController, decoration: InputDecoration( - hintText: 'How May I Help You?', + hintText: TranslationBase.of(context).textToSpeech, suffixIcon: IconButton( icon: Icon(Icons.mic), onPressed: () async { @@ -210,6 +211,7 @@ class _SearchBot extends State { result['ClinicId'], context, doctorId: result['DoctorId'], + doctorName: result['DoctorName'], ); } else if (result['ProjectId'] != 0 && result['ClinicId'] != 0 && @@ -234,6 +236,8 @@ class _SearchBot extends State { result['ProjectId'], result['ClinicId'], context, + doctorId: result['DoctorId'], + doctorName: result['DoctorName'], ); } else { Navigator.push( @@ -298,14 +302,17 @@ class _SearchBot extends State { isAppo: true); //speak(); } - }); + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } - getDoctorsList(projectId, clinicId, context, {doctorId}) { + getDoctorsList(projectId, clinicId, context, {doctorId, doctorName}) { List doctorsList = []; DoctorsListService service = new DoctorsListService(); service - .getDoctorsList(clinicId, projectId, context, doctorId: doctorId) + .getDoctorsList(clinicId, projectId, context, doctorId: doctorName) .then((res) { if (res['MessageStatus'] == 1) { setState(() { @@ -314,12 +321,13 @@ class _SearchBot extends State { res['DoctorList'].forEach((v) { doctorsList.add(new DoctorList.fromJson(v)); }); - if (doctorId == null) { - navigateToSearchResults(context, doctorsList); - //speak(); - } else { + if (res['DoctorList'].length == 1 && doctorId != null) { getDoctorProfile( projectId, clinicId, doctorId, context, doctorsList); + + //speak(); + } else { + navigateToSearchResults(context, doctorsList); } } }); @@ -328,7 +336,8 @@ class _SearchBot extends State { } }).catchError((err) { print(err); - }); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } Future navigateToDoctorProfile(context, docObject, docProfile,