From 227731f8f8c3ac9f9f39aee709acf5a80a0a35a7 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 6 Oct 2020 12:16:51 +0300 Subject: [PATCH] Merge --- lib/config/config.dart | 125 ++-- lib/pages/landing/landing_page.dart | 11 +- lib/pages/login/confirm-login.dart | 69 +- lib/pages/login/login.dart | 37 +- lib/pages/login/welcome.dart | 2 +- .../medical/ask_doctor/doctor_response.dart | 4 +- lib/uitl/LocalNotification.dart | 62 +- lib/widgets/mobile-no/mobile_no.dart | 2 + .../others/floating_button_search.dart | 671 ++++++++++++++++-- lib/widgets/otp/sms-popup.dart | 24 +- lib/widgets/robo-search/robosearch.dart | 44 +- pubspec.yaml | 2 +- 12 files changed, 821 insertions(+), 232 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 02b58b34..e6e40d80 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -6,7 +6,7 @@ import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; const MAX_SMALL_SCREEN = 660; -const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; const GET_PROJECT = 'Services/Lists.svc/REST/GetProject'; @@ -29,8 +29,10 @@ const GET_PRESCRIPTION_REPORT_ENH = ///Lab Order const GET_Patient_LAB_ORDERS = 'Services/Patients.svc/REST/GetPatientLabOrders'; -const GET_Patient_LAB_SPECIAL_RESULT = 'Services/Patients.svc/REST/GetPatientLabSpecialResults'; -const GET_Patient_LAB_RESULT = '/Services/Patients.svc/REST/GetPatientLabResults'; +const GET_Patient_LAB_SPECIAL_RESULT = + 'Services/Patients.svc/REST/GetPatientLabSpecialResults'; +const GET_Patient_LAB_RESULT = + '/Services/Patients.svc/REST/GetPatientLabResults'; /// const GET_PATIENT_ORDERS = 'Services/Patients.svc/REST/GetPatientRadOrders'; @@ -43,8 +45,7 @@ const SEND_RAD_REPORT_EMAIL = ///Feedback const SEND_FEEDBACK = 'Services/COCWS.svc/REST/InsertCOCItemInSPList'; const GET_STATUS_FOR_COCO = 'Services/COCWS.svc/REST/GetStatusforCOC'; -const GET_PATIENT_AppointmentHistory = - 'Services' +const GET_PATIENT_AppointmentHistory = 'Services' '/Doctors.svc/REST/PateintHasAppoimentHistory'; ///VITAL SIGN @@ -52,31 +53,26 @@ const GET_PATIENT_VITAL_SIGN = 'Services/Doctors.svc/REST/Doctor_GetPatientVitalSign'; ///Er Nearest -const GET_NEAREST_HOSPITAL= +const GET_NEAREST_HOSPITAL = 'Services/Patients.svc/REST/Patient_GetProjectAvgERWaitingTime'; ///Er Nearest -const GET_AMBULANCE_REQUEST= +const GET_AMBULANCE_REQUEST = 'Services/Patients.svc/REST/PatientER_RRT_GetAllTransportationMethod'; - ///FindUs -const GET_FINDUS_REQUEST= - 'Services/Lists.svc/REST/Get_HMG_Locations'; - +const GET_FINDUS_REQUEST = 'Services/Lists.svc/REST/Get_HMG_Locations'; ///LiveChat -const GET_LIVECHAT_REQUEST= - 'Services/Patients.svc/REST/GetPatientICProjects'; +const GET_LIVECHAT_REQUEST = 'Services/Patients.svc/REST/GetPatientICProjects'; + ///BloodDenote -const GET_CITIES_REQUEST= - 'Services/Lists.svc/REST/GetAllCities'; +const GET_CITIES_REQUEST = 'Services/Lists.svc/REST/GetAllCities'; ///BloodDetails -const GET_BLOOD_REQUEST= +const GET_BLOOD_REQUEST = 'services/PatientVarification.svc/REST/BloodDonation_GetBloodGroupDetails'; - ///Reports const REPORTS = 'Services/Doctors.svc/REST/GetPatientMedicalReportStatusInfo'; const INSERT_REQUEST_FOR_MEDICAL_REPORT = @@ -104,7 +100,8 @@ const GET_PROJECTS_LIST = 'Services/Lists.svc/REST/GetProject'; const GET_DOCTORS_LIST_URL = "Services/Doctors.svc/REST/SearchDoctorsByTime"; //URL to dental doctors list -const GET_DENTAL_DOCTORS_LIST_URL = "Services/Doctors.svc/REST/Dental_DoctorChiefComplaintMapping"; +const GET_DENTAL_DOCTORS_LIST_URL = + "Services/Doctors.svc/REST/Dental_DoctorChiefComplaintMapping"; //URL to get doctor free slots const GET_DOCTOR_FREE_SLOTS = "Services/Doctors.svc/REST/GetDoctorFreeSlots"; @@ -175,16 +172,16 @@ const CANCEL_LIVECARE_REQUEST = const SEND_LIVECARE_INVOICE_EMAIL = 'Services/Notifications.svc/REST/SendInvoiceForLiveCare'; - -const GET_USER_TERMS ='/Services/Patients.svc/REST/GetUserTermsAndConditions'; -const UPDATE_HEALTH_TERMS ='/services/Patients.svc/REST/UpdatePateintHealthSummaryReport'; +const GET_USER_TERMS = '/Services/Patients.svc/REST/GetUserTermsAndConditions'; +const UPDATE_HEALTH_TERMS = + '/services/Patients.svc/REST/UpdatePateintHealthSummaryReport'; //URL to get medicine and pharmacies list const CHANNEL = 3; const GENERAL_ID = 'Cs2020@2016\$2958'; const IP_ADDRESS = '10.20.10.20'; const VERSION_ID = 5.6; -const SETUP_ID = '91877'; +const SETUP_ID = '91877'; const LANGUAGE = 2; const PATIENT_OUT_SA = 0; const SESSION_ID = 'TMRhVmkGhOsvamErw'; @@ -212,54 +209,66 @@ const GET_PATIENT_SICK_LEAVE = 'Services/Patients.svc/REST/GetPatientSickLeave'; const SendSickLeaveEmail = 'Services/Notifications.svc/REST/SendSickLeaveEmail'; -const GET_PATIENT_AdVANCE_BALANCE_AMOUNT = 'Services/Patients.svc/REST/GetPatientAdvanceBalanceAmount'; -const GET_PATIENT_INFO_BY_ID = 'Services/Doctors.svc/REST/GetPatientInfoByPatientID'; -const GET_PATIENT_INFO_BY_ID_AND_MOBILE_NUMBER = 'Services/Patients.svc/REST/AP_GetPatientInfoByPatientIDandMobileNumber'; -const SEND_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = 'Services/Authentication.svc/REST/SendActivationCodeForAdvancePayment'; -const CHECK_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = 'Services/Authentication.svc/REST/CheckActivationCodeForAdvancePayment'; +const GET_PATIENT_AdVANCE_BALANCE_AMOUNT = + 'Services/Patients.svc/REST/GetPatientAdvanceBalanceAmount'; +const GET_PATIENT_INFO_BY_ID = + 'Services/Doctors.svc/REST/GetPatientInfoByPatientID'; +const GET_PATIENT_INFO_BY_ID_AND_MOBILE_NUMBER = + 'Services/Patients.svc/REST/AP_GetPatientInfoByPatientIDandMobileNumber'; +const SEND_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = + 'Services/Authentication.svc/REST/SendActivationCodeForAdvancePayment'; +const CHECK_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = + 'Services/Authentication.svc/REST/CheckActivationCodeForAdvancePayment'; ///My Trackers -const GET_DIABETIC_RESULT_AVERAGE='Services/Patients.svc/REST/Patient_GetDiabeticResultAverage'; -const GET_DIABTEC_RESULT='Services/Patients.svc/REST/Patient_GetDiabtecResults'; -const ADD_DIABTEC_RESULT='Services/Patients.svc/REST/Patient_AddDiabtecResult'; - - -const GET_BLOOD_PRESSURE_RESULT_AVERAGE='Services/Patients.svc/REST/Patient_GetBloodPressureResultAverage'; -const GET_BLOOD_PRESSURE_RESULT='Services/Patients.svc/REST/Patient_GetBloodPressureResult'; -const ADD_BLOOD_PRESSURE_RESULT='Services/Patients.svc/REST/Patient_AddBloodPressureResult'; - -const GET_WEIGHT_PRESSURE_RESULT_AVERAGE='Services/Patients.svc/REST/Patient_GetWeightMeasurementResultAverage'; -const GET_WEIGHT_PRESSURE_RESULT='Services/Patients.svc/REST/Patient_GetWeightMeasurementResult'; -const ADD_WEIGHT_PRESSURE_RESULT='Services/Patients.svc/REST/Patient_AddWeightMeasurementResult'; - - -const ADD_ACTIVE_PRESCRIPTIONS_REPORT_BY_PATIENT_ID='Services/Patients.svc/Rest/GetActivePrescriptionReportByPatientID'; - -const GET_CALL_INFO_HOURS_RESULT = 'Services/Doctors.svc/REST/GetCallInfoHoursResult'; -const GET_CALL_REQUEST_TYPE_LOV = 'Services/Doctors.svc/REST/GetCallRequestType_LOV'; +const GET_DIABETIC_RESULT_AVERAGE = + 'Services/Patients.svc/REST/Patient_GetDiabeticResultAverage'; +const GET_DIABTEC_RESULT = + 'Services/Patients.svc/REST/Patient_GetDiabtecResults'; +const ADD_DIABTEC_RESULT = + 'Services/Patients.svc/REST/Patient_AddDiabtecResult'; + +const GET_BLOOD_PRESSURE_RESULT_AVERAGE = + 'Services/Patients.svc/REST/Patient_GetBloodPressureResultAverage'; +const GET_BLOOD_PRESSURE_RESULT = + 'Services/Patients.svc/REST/Patient_GetBloodPressureResult'; +const ADD_BLOOD_PRESSURE_RESULT = + 'Services/Patients.svc/REST/Patient_AddBloodPressureResult'; + +const GET_WEIGHT_PRESSURE_RESULT_AVERAGE = + 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResultAverage'; +const GET_WEIGHT_PRESSURE_RESULT = + 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResult'; +const ADD_WEIGHT_PRESSURE_RESULT = + 'Services/Patients.svc/REST/Patient_AddWeightMeasurementResult'; + +const ADD_ACTIVE_PRESCRIPTIONS_REPORT_BY_PATIENT_ID = + 'Services/Patients.svc/Rest/GetActivePrescriptionReportByPatientID'; + +const GET_CALL_INFO_HOURS_RESULT = + 'Services/Doctors.svc/REST/GetCallInfoHoursResult'; +const GET_CALL_REQUEST_TYPE_LOV = + 'Services/Doctors.svc/REST/GetCallRequestType_LOV'; const GET_DOCTOR_RESPONSE = 'Services/Patients.svc/REST/GetDoctorResponse'; const UPDATE_READ_STATUS = 'Services/Patients.svc/REST/UpdateReadStatus'; const INSERT_CALL_INFO = 'Services/Doctors.svc/REST/InsertCallInfo'; const GET_PATIENT_ALLERGIES = 'Services/Patients.svc/REST/GetPatientAllergies'; - - - - // H2O -const H2O_GET_USER_PROGRESS = "Services/H2ORemainder.svc/REST/H2O_GetUserProgress"; -const H2O_INSERT_USER_ACTIVITY="Services/H2ORemainder.svc/REST/H2O_InsertUserActivity"; - - - - +const H2O_GET_USER_PROGRESS = + "Services/H2ORemainder.svc/REST/H2O_GetUserProgress"; +const H2O_INSERT_USER_ACTIVITY = + "Services/H2ORemainder.svc/REST/H2O_InsertUserActivity"; //E_Referral Services -const GET_ALL_RELATIONSHIP_TYPES = "Services/Patients.svc/REST/GetAllRelationshipTypes"; -const SEND_ACTIVATION_CODE_FOR_E_REFERRAL = 'Services/Authentication.svc/REST/SendActivationCodeForEReferral'; -const CHECK_ACTIVATION_CODE_FOR_E_REFERRAL = 'Services/Authentication.svc/REST/CheckActivationCodeForEReferral'; +const GET_ALL_RELATIONSHIP_TYPES = + "Services/Patients.svc/REST/GetAllRelationshipTypes"; +const SEND_ACTIVATION_CODE_FOR_E_REFERRAL = + 'Services/Authentication.svc/REST/SendActivationCodeForEReferral'; +const CHECK_ACTIVATION_CODE_FOR_E_REFERRAL = + 'Services/Authentication.svc/REST/CheckActivationCodeForEReferral'; const GET_ALL_CITIES = 'services/Lists.svc/rest/GetAllCities'; const CREATE_E_REFERRAL = "Services/Patients.svc/REST/CreateEReferral"; const GET_E_REFERRALS = "Services/Patients.svc/REST/GetEReferrals"; diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 0fdb57ff..23d1645c 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -347,12 +347,9 @@ class _LandingPageState extends State with WidgetsBindingObserver { ), actions: [ IconButton( - iconSize: 50, - icon: SvgPicture.asset( - 'assets/images/robort_svg.svg', - height: 100, - width: 100, - ), + iconSize: 70, + icon: SvgPicture.asset('assets/images/robort_svg.svg', + height: 100, width: 100, fit: BoxFit.cover), onPressed: () { triggerRobot(); } //do something, @@ -385,7 +382,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { } triggerRobot() { - // event.setValue({"doctor_id": '40036'}); + event.setValue({"isRobot": 'true'}); } getText(currentTab) { diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index ac36c7d6..cc3ed1e8 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -21,7 +21,7 @@ import 'package:diplomaticquarterapp/routes.dart'; import 'package:flutter/services.dart'; import 'package:intl/intl.dart'; import 'package:local_auth/local_auth.dart'; - +import 'package:smart_progress_bar/smart_progress_bar.dart'; class ConfirmLogin extends StatefulWidget { @override _ConfirmLogin createState() => _ConfirmLogin(); @@ -74,8 +74,7 @@ class _ConfirmLogin extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).confirm, isShowAppBar: true, - body: isLoading == false - ? SingleChildScrollView( + body: SingleChildScrollView( child: Container( padding: EdgeInsets.all(20), height: SizeConfig.realScreenHeight * .9, @@ -101,11 +100,11 @@ class _ConfirmLogin extends State { .welcomeBack + ' ' + user.name, - fontSize: SizeConfig.textMultiplier * 4, + fontSize: SizeConfig.textMultiplier * 3.5, ), AppText( TranslationBase.of(context).accountInfo, - fontSize: SizeConfig.textMultiplier * 3, + fontSize: SizeConfig.textMultiplier * 2.5, ), Card( color: Colors.grey[300], @@ -250,7 +249,7 @@ class _ConfirmLogin extends State { )) ], ))) - : AppCircularProgressIndicator()); + ); } Future _getAvailableBiometrics() async { @@ -328,18 +327,25 @@ class _ConfirmLogin extends State { { if (value['IsAuthenticated']) {this.checkActivationCode()} } - }); + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } sendActivationCode(type) { var request = this.getCommonRequest(); - loading(true); + // loading(true); this.authService.sendActivationCode(request).then((result) => { if (result != null && result['isSMSSent'] == true) {loading(false), this.startSMSService(type)} else {loading(false)} - }); + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + // SMSOTP.showLoadingDialog(context, false), } startSMSService(type) { @@ -405,7 +411,10 @@ class _ConfirmLogin extends State { // // this.cs.presentAlert(result.ErrorEndUserMessage); // } } - }); + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));; } setUser() async {} @@ -512,7 +521,10 @@ class _ConfirmLogin extends State { AppToast.showErrorToast(message: result); }), } - }); + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));; } checkIfUserAgreedBefore(CheckActivationCode result) { @@ -525,42 +537,15 @@ class _ConfirmLogin extends State { } insertIMEI() { - authService.insertDeviceImei(selectedOption).then((value) => {goToHome()}); + authService.insertDeviceImei(selectedOption).then((value) => {goToHome()}).catchError((err) { + print(err); + }); } goToHome() { // authService.insertDeviceImei().then((value) => print(value)); Navigator.of(context).pushNamed(HOME); - // const request = new LoginRequest(); - // if (this.loginType === AuthenticationService.IDENTIFCIATION_LOGIN_TYPE) { - // request.PatientID = 0; - // } else { - // request.PatientID = Number(this.id); - // } - // this.newRating(request); - // } - // public newRating(request: any) { - // this.authService - // .checkIfRated( - // request, - // () => { - // this.gotoHome(); - // }, - // this.ts.trPK("general", "retry") - // ) - // .subscribe((result: CheckUserRatingResponse) => { - // if (this.cs.validResponse(result)) { - // this.cs.sharedService.setSharedData(result, AuthenticationService.SURVEY_DATA); - // if (result.IsLastAppoitmentRatedList.length === 0) { - // this.cs.openHome(); - // } else { - // this.ProjectID = result.IsLastAppoitmentRatedList[0].ProjectID; - // this.AppointmentNo = result.IsLastAppoitmentRatedList[0].AppointmentNo; - // this.cs.sharedService.setSharedData(true, "ratePage"); - // this.showRateModal(); - // } - // } - // }); + } loading(flag) { diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 146d47bc..1fa0f042 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -21,7 +21,7 @@ import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; - +import 'package:smart_progress_bar/smart_progress_bar.dart'; class Login extends StatefulWidget { @override _Login createState() => _Login(); @@ -57,9 +57,7 @@ class _Login extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).login, isShowAppBar: true, - body: isLoading == true - ? AppCircularProgressIndicator() - : SingleChildScrollView( + body: SingleChildScrollView( child: Container( padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), @@ -84,6 +82,7 @@ class _Login extends State { onCountryChange: (value) => countryCode = value), Container( child: TextFields( + fontWeight: FontWeight.normal, controller: nationalIDorFile, onChanged: (value) => {validateForm()}, prefixIcon: Icon( @@ -146,7 +145,7 @@ class _Login extends State { } checkUserAuthentication() { - showLoader(true); + // showLoader(true); var request = CheckPatientAuthenticationReq(); request.isRegister = false; request.patientMobileNumber = int.parse(mobileNo); @@ -162,7 +161,7 @@ class _Login extends State { } sharedPref.setObject(REGISTER_DATA_FOR_REGISTER, request); authService.checkPatientAuthentication(request).then((value) => { - showLoader(false), + //showLoader(false), if (value['isSMSSent']) { sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']), @@ -173,7 +172,11 @@ class _Login extends State { { if (value['IsAuthenticated']) {this.checkActivationCode()} } - }); + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + // SMSOTP.showLoadingDialog(context, false), } checkActivationCode({code}) async { @@ -181,7 +184,8 @@ class _Login extends State { // request.logInTokenID = await sharedPref.getString(LOGIN_TOKEN_ID); // request.activationCode = code ?? "0000"; // request.isSilentLogin = code != null ? false : true; - if (code == null) showLoader(true); + if (code == null) + //showLoader(true); request['PatientMobileNumber'] = int.parse(mobileNo); request['ZipCode'] = countryCode; request['SearchType'] = loginType; @@ -203,7 +207,7 @@ class _Login extends State { Navigator.of(context).pushNamed( HOME, ), - showLoader(false), + //showLoader(false), appointmentRateViewModel .getIsLastAppointmentRatedList() .then((value) => { @@ -225,14 +229,17 @@ class _Login extends State { ), ) } - }) + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) // SMSOTP.showLoadingDialog(context, false), }); } - showLoader(bool isTrue) { - setState(() { - isLoading = isTrue; - }); - } + // showLoader(bool isTrue) { + // setState(() { + // isLoading = isTrue; + // }); + // } } diff --git a/lib/pages/login/welcome.dart b/lib/pages/login/welcome.dart index b4b05900..8fe6ece1 100644 --- a/lib/pages/login/welcome.dart +++ b/lib/pages/login/welcome.dart @@ -60,7 +60,7 @@ class _WelcomeLogin extends State { textAlign: TextAlign.left, ), SizedBox( - height: SizeConfig.realScreenHeight * .2, + height: SizeConfig.realScreenHeight * .15, ) ]), ), diff --git a/lib/pages/medical/ask_doctor/doctor_response.dart b/lib/pages/medical/ask_doctor/doctor_response.dart index b6071a4c..846c9a05 100644 --- a/lib/pages/medical/ask_doctor/doctor_response.dart +++ b/lib/pages/medical/ask_doctor/doctor_response.dart @@ -30,7 +30,7 @@ class DoctorResponse extends StatelessWidget { height: 65, ), AppExpandableNotifier( - header: Padding( + headerWidget: Padding( padding: const EdgeInsets.all(8.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -110,7 +110,7 @@ class DoctorResponse extends StatelessWidget { ), ), AppExpandableNotifier( - header: Padding( + headerWidget: Padding( padding: const EdgeInsets.all(8.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/lib/uitl/LocalNotification.dart b/lib/uitl/LocalNotification.dart index ac4f5860..5b826f00 100644 --- a/lib/uitl/LocalNotification.dart +++ b/lib/uitl/LocalNotification.dart @@ -4,16 +4,14 @@ import 'dart:ui'; import 'package:flutter/cupertino.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; -final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); +final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = + FlutterLocalNotificationsPlugin(); class LocalNotification { - - static Future scheduleNotification( {@required DateTime scheduledNotificationDateTime, @required String title, @required String description}) async { - ///vibrationPattern var vibrationPattern = Int64List(4); vibrationPattern[0] = 0; @@ -26,8 +24,10 @@ class LocalNotification { 'ActivePrescriptions', 'ActivePrescriptionsDescription', // icon: 'secondary_icon', - sound: RawResourceAndroidNotificationSound('slow_spring_board'),///change it to be as ionic - // largeIcon: DrawableResourceAndroidBitmap('sample_large_icon'),///change it to be as ionic + sound: RawResourceAndroidNotificationSound('slow_spring_board'), + + ///change it to be as ionic + // largeIcon: DrawableResourceAndroidBitmap('sample_large_icon'),///change it to be as ionic vibrationPattern: vibrationPattern, enableLights: true, color: const Color.fromARGB(255, 255, 0, 0), @@ -35,15 +35,13 @@ class LocalNotification { ledOnMs: 1000, ledOffMs: 500); var iOSPlatformChannelSpecifics = - IOSNotificationDetails(sound: 'slow_spring_board.aiff');///change it to be as ionic - var platformChannelSpecifics = NotificationDetails( - androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.schedule( - 0, - title, - description, - scheduledNotificationDateTime, - platformChannelSpecifics); + IOSNotificationDetails(sound: 'slow_spring_board.aiff'); + + ///change it to be as ionic + // var platformChannelSpecifics = NotificationDetails( + // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.schedule(0, title, description, + // scheduledNotificationDateTime, platformChannelSpecifics); } ///Repeat notification every day at approximately 10:00:00 am @@ -54,14 +52,14 @@ class LocalNotification { 'repeatDailyAtTime channel name', 'repeatDailyAtTime description'); var iOSPlatformChannelSpecifics = IOSNotificationDetails(); - var platformChannelSpecifics = NotificationDetails( - androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.showDailyAtTime( - 0, - 'show daily title', - 'Daily notification shown at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', - time, - platformChannelSpecifics); + // var platformChannelSpecifics = NotificationDetails( + // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.showDailyAtTime( + // 0, + // 'show daily title', + // 'Daily notification shown at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', + // time, + // platformChannelSpecifics); } ///Repeat notification weekly on Monday at approximately 10:00:00 am @@ -72,15 +70,15 @@ class LocalNotification { 'show weekly channel name', 'show weekly description'); var iOSPlatformChannelSpecifics = IOSNotificationDetails(); - var platformChannelSpecifics = NotificationDetails( - androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.showWeeklyAtDayAndTime( - 0, - 'show weekly title', - 'Weekly notification shown on Monday at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', - Day.Monday, - time, - platformChannelSpecifics); + // var platformChannelSpecifics = NotificationDetails( + // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.showWeeklyAtDayAndTime( + // 0, + // 'show weekly title', + // 'Weekly notification shown on Monday at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', + // Day.Monday, + // time, + // platformChannelSpecifics); } static String _toTwoDigitString(int value) { diff --git a/lib/widgets/mobile-no/mobile_no.dart b/lib/widgets/mobile-no/mobile_no.dart index d916f570..399e346d 100644 --- a/lib/widgets/mobile-no/mobile_no.dart +++ b/lib/widgets/mobile-no/mobile_no.dart @@ -74,6 +74,7 @@ class _MobileNo extends State { Container( padding: EdgeInsets.all(5), decoration: BoxDecoration( + color: Colors.white, border: Border.all(color: Colors.grey), borderRadius: BorderRadius.circular(10)), child: Row(children: [ @@ -88,6 +89,7 @@ class _MobileNo extends State { child: Text( countryCode, overflow: TextOverflow.clip, + )), Expanded( flex: 4, diff --git a/lib/widgets/others/floating_button_search.dart b/lib/widgets/others/floating_button_search.dart index 37a3e3c0..2d5b6071 100644 --- a/lib/widgets/others/floating_button_search.dart +++ b/lib/widgets/others/floating_button_search.dart @@ -1,7 +1,43 @@ +import 'dart:collection'; +import 'dart:math'; +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart'; +import 'package:diplomaticquarterapp/pages/ErService/NearestEr.dart'; +import 'package:diplomaticquarterapp/pages/MyAppointments/MyAppointments.dart'; +import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; +import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; +import 'package:diplomaticquarterapp/pages/medical/doctor/doctor_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/labs/labs_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/patient_sick_leave_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/reports/report_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_screen.dart'; +import 'package:diplomaticquarterapp/pages/vaccine/my_vaccines_screen.dart'; +import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; +import 'package:diplomaticquarterapp/services/robo_search/search_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/robo-search/robosearch.dart'; -import 'package:diplomaticquarterapp/widgets/robo-search/search.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:flutter_tts/flutter_tts.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:speech_to_text/speech_recognition_error.dart'; +import 'package:speech_to_text/speech_recognition_result.dart'; +import 'package:speech_to_text/speech_to_text.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/DoctorProfile.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; +import 'package:flutter/cupertino.dart'; + +import 'package:smart_progress_bar/smart_progress_bar.dart'; class FloatingSearchButton extends StatefulWidget { @override @@ -10,36 +46,77 @@ class FloatingSearchButton extends StatefulWidget { class _FloatingSearchButton extends State with TickerProviderStateMixin { - Offset position = Offset(30.0, 40.0); - AlignmentDirectional _ironManAlignment = AlignmentDirectional(0.0, 0.7); + Offset position = Offset(250, 400); + bool activeAnimation = false; + bool isShow = true; + SearchProvider searchProvider = new SearchProvider(); + RobotProvider eventProvider = RobotProvider(); + bool isLoading = false; + bool isError = false; + final SpeechToText speech = SpeechToText(); + String error = ''; + String _currentLocaleId = ""; + String lastError; + double level = 0.0; + var searchText; + double minSoundLevel = 50000; + double maxSoundLevel = -50000; + String reconizedWord = ''; + FlutterTts flutterTts = FlutterTts(); + var selectedLang; + bool isSearching = false; + Map results = {}; + String lastStatus; + + bool _isInit = true; + var event = RobotProvider(); + bool _hasSpeech = false; @override void initState() { - // TODO: implement initState super.initState(); + event.controller.stream.listen((p) { + if (p['isRobot'] == 'true') { + setState(() { + position = Offset(250, 400); + activeAnimation = false; + }); + } + }); + requestPermissions(); + // Future.delayed(const Duration(seconds: 10), () { + initSpeechState().then((value) => {}); + // }); } @override Widget build(BuildContext context) { - return Positioned( - left: position.dx, - top: position.dy, - child: Draggable( - feedback: Container(child: getStack()), - child: Container( - child: AnimatedContainer( - duration: Duration(seconds: 2), - alignment: _ironManAlignment, - child: getStack(), - )), - childWhenDragging: Container( - color: Colors.transparent, - ), - onDragEnd: (details) { - setState(() { - position = details.offset; - }); - })); + return AnimatedPositioned( + onEnd: () { + // setState(() { + // this.isShow = false; + // position = Offset(250, 400); + // }); + }, + left: activeAnimation ? 300 : position.dx, + top: activeAnimation ? -150 : position.dy, + duration: activeAnimation + ? const Duration(seconds: 1) + : const Duration(seconds: 0), + // curve: Curves.bounceOut, + child: isShow + ? Draggable( + feedback: Container(child: getStack()), + child: getStack(), + childWhenDragging: Container( + color: Colors.transparent, + ), + onDragEnd: (details) { + setState(() { + position = details.offset; + }); + }) + : Container()); // Draggable( // feedback: getStack(), @@ -57,42 +134,518 @@ class _FloatingSearchButton extends State return Container( height: 150, width: 150, - child: Stack( - children: [ - Positioned( - top: 10, - right: 0, - child: GestureDetector( - onTap: () { - print("hi"); - setState(() { - _ironManAlignment = AlignmentDirectional(0.0, -0.20); - }); - }, // handle your image tap here - child: Image.asset( - 'assets/images/CloseIcon.png', - fit: BoxFit.cover, // this is the solution for border - width: 30.0, - height: 30.0, - )), + child: Stack(children: [ + // Column( + // mainAxisSize: MainAxisSize.min, + // crossAxisAlignment: CrossAxisAlignment.stretch, + // children: [ + GestureDetector( + child: Container( + child: SvgPicture.asset('assets/images/robort_svg.svg'), + ), + onTap: () { + new RoboSearch(context: context).showAlertDialog(context); + startVoiceSearch(); + }, + ), + // ], + // ), + Positioned( + right: 0.0, + top: 10, + child: GestureDetector( + onTap: () { + setState(() { + activeAnimation = true; + }); + }, + child: Align( + alignment: Alignment.topRight, + child: CircleAvatar( + radius: 14.0, + backgroundColor: Colors.red, + child: Icon(Icons.close, color: Colors.white), + ), + ), ), - GestureDetector( - onTap: () { - // animationController.forward(); - }, // handle your image tap here - child: SvgPicture.asset('assets/images/robort_svg.svg')) - // new RawMaterialButton( - // // shape: new CircleBorder(), - // elevation: 1.0, - // child: SvgPicture.asset('assets/images/robort_svg.svg'), - // onPressed: () {}, - // ), - ], - )); - } - - roboSearch(context) { - var dialog = RoboSearch(context: context); - dialog.showAlertDialog(context); + ), + ]) + + // Stack( + // fit: StackFit.loose, + // overflow: Overflow.visible, + // children: [ + // Container(), + // Positioned( + // child: GestureDetector( + // behavior: HitTestBehavior.translucent, + // onTapDown: (TapDownDetails details) => { + // setState(() { + // activeAnimation = true; + // }) + // }, // handle your image tap here + // child: Image.asset( + // 'assets/images/CloseIcon.png', + // fit: BoxFit.cover, // this is the solution for border + // width: 30.0, + // height: 30.0, + // ), + // )), + // Positioned( + // child: GestureDetector( + // onTap: () { + // this.roboSearch(context); + // }, // handle your image tap here + // child: SvgPicture.asset('assets/images/robort_svg.svg'))) + + // // new RawMaterialButton( + // // // shape: new CircleBorder(), + // // elevation: 1.0, + // // child: SvgPicture.asset('assets/images/robort_svg.svg'), + // // onPressed: () {}, + // // ), + // ], + // ) + + ); + } + + startVoiceSearch() async { + _currentLocaleId = + TranslationBase.of(AppGlobal.context).locale.languageCode == 'en' + ? 'en-US' + : 'ar-SA'; + speech.listen( + onResult: resultListener, + listenFor: Duration(seconds: 10), + localeId: _currentLocaleId, + onSoundLevelChange: soundLevelListener, + cancelOnError: true, + partialResults: true, + onDevice: true, + listenMode: ListenMode.deviceDefault); + } + + void resultListener(SpeechRecognitionResult result) { + // lastWords = "${result.recognizedWords} - ${result.finalResult}"; + + if (result.finalResult == true) { + // setState(() { + + + reconizedWord = result.recognizedWords; + event.setValue({"searchText": reconizedWord}); + setState(() { + searchText = reconizedWord; + }); + Future.delayed(const Duration(seconds: 1), () { + _speak(reconizedWord); + }); + } + //}); + } + + Future _speak(reconizedWord) async { + //await flutterTts.speak(reconizedWord); + RoboSearch.closeAlertDialog(context); + getPages(reconizedWord); + } + + void soundLevelListener(double level) { + minSoundLevel = min(minSoundLevel, level); + maxSoundLevel = max(maxSoundLevel, level); + // print("sound level $level: $minSoundLevel - $maxSoundLevel "); + //setState(() { + this.level = level; + // }); + } + + void requestPermissions() async { + Map statuses = await [ + Permission.microphone, + ].request(); + } + + Future initSpeechState() async { + bool hasSpeech = await speech.initialize( + onError: errorListener, onStatus: statusListener); + if (hasSpeech) { + _currentLocaleId = + TranslationBase.of(AppGlobal.context).locale.languageCode == 'en' + ? 'en-US' + : 'ar-SA'; // systemLocale.localeId; + + } + if (!mounted) return; + + setState(() { + _hasSpeech = hasSpeech; + }); + } + + void errorListener(SpeechRecognitionError error) { + //setState(() { + // reconizedWord = "${error.errorMsg} - ${error.permanent}"; + //}); + } + + void statusListener(String status) { + //setState(() { + reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....'; + + //}); + } + + getPages(text) { + var request = { + 'VoiceMessage': text, + 'Lang': TranslationBase.of(AppGlobal.context).locale.languageCode == 'en' + ? 'En' + : 'Ar' + }; + + searchProvider + .getBotPages(request) + .then((value) => {getCommands(value['Understand'])}); + } + + getCommands(result) async { + print(result); + results = result; + + switch (result["CommandNumber"]) { + case '100': + { + List clnicID = unique(result['ClinicId']); + if (result['ProjectId'] != 0 && + clnicID.length > 0 && + result['DoctorId'].length > 0) { + if (clnicID.length == 1) { + getDoctorsList( + result['ProjectId'], + clnicID[0], + context, + doctorId: result['DoctorId'], + doctorName: null, + ); + } else { + goToClinic(clnicID); + } + } else if (result['ProjectId'] != 0 && + clnicID.length > 0 && + result['DoctorId'].length == 0) { + if (clnicID.length == 1) { + getDoctorsList( + result['ProjectId'], + clnicID[0], + context, + ); + } else { + goToClinic(clnicID); + } + } else if (result['ProjectId'] == 0 && + clnicID.length > 0 && + result['DoctorId'].length == 0) { + if (clnicID.length == 1) { + getDoctorsList( + result['ProjectId'], + clnicID[0], + context, + ); + } else { + goToClinic(clnicID); + } + } else if (result['ProjectId'] == 0 && + clnicID.length > 0 && + result['DoctorId'].length > 0) { + if (clnicID.length == 1) { + getDoctorsList( + result['ProjectId'], + clnicID[0], + context, + doctorId: result['DoctorId'], + doctorName: null, + ); + } else { + goToClinic(clnicID); + } + } else { + goToClinic(clnicID); + } + // speak(); + } + break; + case '102': + { + getDoctorsList( + 0, + 0, + context, + doctorId: result['DoctorId'], + doctorName: null, + ); + } + break; + case '103': + { + List clnicID = unique(result['ClinicId']); + if (clnicID.length == 1) { + getDoctorsList( + 0, + clnicID[0], + context, + doctorId: null, + doctorName: null, + ); + } else { + goToClinic(clnicID); + } + } + break; + case '4': + { + Navigator.push(context, FadePage(page: LabsHomePage())); + } + break; + case '6': + { + Navigator.push(context, FadePage(page: RadiologyHomePage())); + } + break; + case '7': + { + Navigator.push( + context, + FadePage( + page: MyAppointments(), + ), + ); + } + break; + case '8': + { + Navigator.push( + context, + FadePage( + page: HomePrescriptionsPage(), + ), + ); + } + break; + case '9': + { + Navigator.push( + context, + FadePage( + page: DoctorHomePage(), + ), + ); + } + break; + case '10': + { + Navigator.push( + context, + FadePage( + page: VitalSignDetailsScreen(), + ), + ); + } + break; + case '11': + { + Navigator.push(context, FadePage(page: InsuranceUpdate())); + } + break; + case '12': + { + Navigator.push(context, FadePage(page: InsuranceApproval())); + } + break; + case '13': + { + Navigator.push(context, FadePage(page: MyVaccines())); + } + break; + case '14': + { + Navigator.push(context, FadePage(page: HomeReportPage())); + } + break; + case '5': + { + Navigator.push(context, FadePage(page: NearestEr())); + } + break; + case '15': + { + Navigator.push(context, FadePage(page: PatientSickLeavePage())); + } + break; + case '16': + { + Navigator.push(context, FadePage(page: LiveCareHome())); + } + break; + + case '200': + { + Navigator.push(context, FadePage(page: FeedbackHomePage())); + } + break; + + default: + Navigator.of(context).pushNamed(HOME); + speak(); + break; + } + + //searchProvider.setLisener(result); + } + + getDoctorProfile(projectId, clinicId, doctorId, context, doctorData) { + List docProfileList = []; + DoctorsListService service = new DoctorsListService(); + + service + .getDoctorsProfile(doctorId, clinicId, projectId, context) + .then((res) { + if (res['MessageStatus'] == 1) { + if (res['DoctorProfileList'].length != 0) { + res['DoctorProfileList'].forEach((v) { + docProfileList.add(new DoctorProfileList.fromJson(v)); + }); + } + + navigateToDoctorProfile(context, doctorData[0], docProfileList[0], + isAppo: true); + //speak(); + } + }).catchError((err) { + print(err); + }); + } + + getDoctorsList(projectId, clinicId, context, {doctorId, doctorName}) { + List doctorsList = []; + List arr = []; + List arrDistance = []; + DoctorsListService service = new DoctorsListService(); + service + .getDoctorsList(clinicId, projectId, false, context, + doctorId: doctorId, doctorName: doctorName) + .then((res) { + if (res['MessageStatus'] == 1) { + setState(() { + if (res['SearchDoctorsByTime_IsVoiceCommandList'] != null && + res['SearchDoctorsByTime_IsVoiceCommandList'].length != 0) { + doctorsList.clear(); + res['SearchDoctorsByTime_IsVoiceCommandList'].forEach((v1) { + v1['DoctorList'].forEach((v) { + doctorsList.add(new DoctorList.fromJson(v)); + arr.add(new DoctorList.fromJson(v).projectName); + arrDistance.add(new DoctorList.fromJson(v) + .projectDistanceInKiloMeters + .toString()); + }); + }); + if (doctorsList.length == 1) { + getDoctorProfile( + projectId, clinicId, doctorId[0], context, doctorsList); + + //speak(); + } else { + navigateToSearchResults(context, doctorsList, arr, arrDistance); + } + } else if (res['DoctorList'].length != 0) { + doctorsList.clear(); + + res['DoctorList'].forEach((v) { + doctorsList.add(new DoctorList.fromJson(v)); + arr.add(new DoctorList.fromJson(v).projectName); + arrDistance.add(new DoctorList.fromJson(v) + .projectDistanceInKiloMeters + .toString()); + }); + + if (doctorsList.length == 1) { + getDoctorProfile( + projectId, clinicId, doctorId[0], context, doctorsList); + + //speak(); + } else { + navigateToSearchResults(context, doctorsList, arr, arrDistance); + } + } + }); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + + Future navigateToDoctorProfile(context, docObject, docProfile, + {isAppo}) async { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => DoctorProfile( + doctor: docObject, + docProfileList: docProfile, + isOpenAppt: isAppo, + ))); + } + + Future navigateToSearchResults(context, docList, arr, arrDistance) async { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => SearchResults(doctorsList: docList))); + var result = LinkedHashSet.from(arr).toList(); + var numAll = result.length; + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => BranchView( + doctorsList: docList, + result: result, + num: numAll, + resultDistance: arrDistance), + ), + ); + } + + speak() async { + if (_currentLocaleId == 'en-US' && results['ReturnMessage'] != null) { + await flutterTts.setVoice("en-us-x-sfg#male_2-local"); + await flutterTts.setLanguage(_currentLocaleId); + await flutterTts.speak(results['ReturnMessage']); + } else if (results['ReturnMessage_Ar'] != null) { + await flutterTts.setLanguage(_currentLocaleId); + + await flutterTts.setVoice("ar-sa-x-sfg#male_1-local"); + await flutterTts.speak(results['ReturnMessage_Ar']); + } + // Future.delayed(const Duration(seconds: 10), () { + // initSpeechState().then((value) => startVoiceSearch()); + // }); + } + + goToClinic(List ids) { + Navigator.push( + AppGlobal.context, + MaterialPageRoute( + builder: (context) => Search( + type: 0, + clnicIds: ids, + ))); + speak(); + } + + List unique(List list) { + return list.toSet().toList(); } } diff --git a/lib/widgets/otp/sms-popup.dart b/lib/widgets/otp/sms-popup.dart index 376c2a4f..1a67ae8f 100644 --- a/lib/widgets/otp/sms-popup.dart +++ b/lib/widgets/otp/sms-popup.dart @@ -30,10 +30,10 @@ class SMSOTP { ); Map verifyAccountFormValue = { - 'digit1': null, - 'digit2': null, - 'digit3': null, - 'digit4': null, + 'digit1': '', + 'digit2': '', + 'digit3': '', + 'digit4': '', }; final focusD1 = FocusNode(); final focusD2 = FocusNode(); @@ -106,7 +106,7 @@ class SMSOTP { onChanged: (val) { if (val.length == 1) { FocusScope.of(context).requestFocus(focusD2); - verifyAccountFormValue['digit1'] = val; + verifyAccountFormValue['digit1'] = val.trim(); checkValue(); } }, @@ -130,7 +130,7 @@ class SMSOTP { if (val.length == 1) { FocusScope.of(context) .requestFocus(focusD3); - verifyAccountFormValue['digit2'] = val; + verifyAccountFormValue['digit2'] = val.trim(); checkValue(); } }, @@ -155,7 +155,7 @@ class SMSOTP { if (val.length == 1) { FocusScope.of(context) .requestFocus(focusD4); - verifyAccountFormValue['digit3'] = val; + verifyAccountFormValue['digit3'] = val.trim(); checkValue(); } }, @@ -175,7 +175,7 @@ class SMSOTP { }, onChanged: (val) { if (val.length == 1) { - verifyAccountFormValue['digit4'] = val; + verifyAccountFormValue['digit4'] = val.trim(); checkValue(); } }, @@ -241,10 +241,10 @@ class SMSOTP { checkValue() { //print(verifyAccountFormValue); - if (verifyAccountFormValue['digit1'] != null && - verifyAccountFormValue['digit2'] != null && - verifyAccountFormValue['digit3'] != null && - verifyAccountFormValue['digit4'] != null) { + if (verifyAccountFormValue['digit1'] != ''&& + verifyAccountFormValue['digit2'] != '' && + verifyAccountFormValue['digit3'] != '' && + verifyAccountFormValue['digit4'] != '') { onSuccess(verifyAccountFormValue['digit1'] + verifyAccountFormValue['digit2'] + verifyAccountFormValue['digit3'] + diff --git a/lib/widgets/robo-search/robosearch.dart b/lib/widgets/robo-search/robosearch.dart index ca28193b..35c2ec67 100644 --- a/lib/widgets/robo-search/robosearch.dart +++ b/lib/widgets/robo-search/robosearch.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/robo-search/search.dart'; import 'package:flutter/cupertino.dart'; @@ -6,7 +7,8 @@ import 'package:flutter/material.dart'; class RoboSearch { final BuildContext context; - + var event = RobotProvider(); + var searchText = null; RoboSearch({ @required this.context, }); @@ -16,14 +18,50 @@ class RoboSearch { // set up the AlertDialog AlertDialog alert = AlertDialog( - title: Center(child: Text(TranslationBase.of(context).search)), content: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { + setState((){ + event.controller.stream.listen((p) { + if (p['searchText']!=null) { + setState(() { + searchText = p['searchText']; + }); + } + }); + }); return Container( color: Colors.white, height: SizeConfig.realScreenHeight * 0.5, width: SizeConfig.realScreenWidth * 0.8, - child: Container()); + child: Container( + child: Column(children: [ + Expanded( + flex: 1, + child: Center( + child: Image.asset( + 'assets/images/habib-logo.png', + height: 75, + width: 75, + ))), + Expanded( + flex: 3, + child: Center( + child: Container( + margin: EdgeInsets.all(20), + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + border: Border.all(width: 2, color: Colors.red)), + child: Icon( + Icons.mic, + color: Colors.blue, + size: 48, + ), + ))), + Expanded( + flex: 1, child: Center(child: Text( searchText != null ? searchText : 'Try saying something' ))) + ]), + )); }), ); diff --git a/pubspec.yaml b/pubspec.yaml index 0106908a..4277dcd7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -117,7 +117,7 @@ dependencies: #local_notifications - flutter_local_notifications: ^1.4.4+4 + flutter_local_notifications: ^1.5.0 #rxdart rxdart: ^0.24.1