diff --git a/lib/config/config.dart b/lib/config/config.dart index a277afea..9214156f 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -15,7 +15,7 @@ const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; const PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; -//const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://uat.hmgwebservices.com/'; const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs @@ -26,6 +26,11 @@ const BASE_URL = 'https://hmgwebservices.com/'; const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/'; const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/'; +// // Pharmacy Pre-Production URLs +// const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapitest/api/'; +// const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapitest/api/'; + + // RC API URL const RC_BASE_URL = 'https://livecare.hmg.com/'; @@ -38,8 +43,7 @@ const GET_GEO_ZONES = 'Services/Patients.svc/REST/GeoF_GetAllPoints'; const LOG_GEO_ZONES = 'Services/Patients.svc/REST/GeoF_InsertPatientFileInfo'; // Delivery Driver -const DRIVER_LOCATION = - 'Services/Patients.svc/REST/PatientER_GetDriverLocation'; +const DRIVER_LOCATION = 'Services/Patients.svc/REST/PatientER_GetDriverLocation'; //weather const WEATHER_INDICATOR = 'Services/Weather.svc/REST/GetCityInfo'; @@ -47,60 +51,41 @@ const WEATHER_INDICATOR = 'Services/Weather.svc/REST/GetCityInfo'; const GET_PRIVILEGE = 'Services/Patients.svc/REST/Service_Privilege'; // Wifi Credentials -const WIFI_CREDENTIALS = - "Services/Patients.svc/Hmg_SMS_Get_By_ProjectID_And_PatientID"; +const WIFI_CREDENTIALS = "Services/Patients.svc/Hmg_SMS_Get_By_ProjectID_And_PatientID"; ///Doctor -const GET_MY_DOCTOR = - 'Services/Doctors.svc/REST/GetPatientDoctorAppointmentResult'; +const GET_MY_DOCTOR = 'Services/Doctors.svc/REST/GetPatientDoctorAppointmentResult'; const GET_DOCTOR_PROFILE = 'Services/Doctors.svc/REST/GetDocProfiles'; -const GET_DOCTOR_PRE_POST_IMAGES = - 'Services/Doctors.svc/REST/GetDoctorPrePostImages'; -const GET_DOCTOR_RATING_NOTES = - 'Services/Doctors.svc/REST/dr_GetNotesDoctorRating'; -const GET_DOCTOR_RATING_DETAILS = - 'Services/Doctors.svc/REST/dr_GetDoctorRatingDetails'; +const GET_DOCTOR_PRE_POST_IMAGES = 'Services/Doctors.svc/REST/GetDoctorPrePostImages'; +const GET_DOCTOR_RATING_NOTES = 'Services/Doctors.svc/REST/dr_GetNotesDoctorRating'; +const GET_DOCTOR_RATING_DETAILS = 'Services/Doctors.svc/REST/dr_GetDoctorRatingDetails'; const GET_DOCTOR_RATING = 'Services/Doctors.svc/REST/dr_GetAvgDoctorRating'; ///Prescriptions const PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList'; -const GET_PRESCRIPTIONS_ALL_ORDERS = - 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; -const GET_PRESCRIPTION_REPORT = - 'Services/Patients.svc/REST/INP_GetPrescriptionReport'; -const SEND_PRESCRIPTION_EMAIL = - 'Services/Notifications.svc/REST/SendPrescriptionEmail'; -const GET_PRESCRIPTION_REPORT_ENH = - 'Services/Patients.svc/REST/GetPrescriptionReport_enh'; +const GET_PRESCRIPTIONS_ALL_ORDERS = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; +const GET_PRESCRIPTION_REPORT = 'Services/Patients.svc/REST/INP_GetPrescriptionReport'; +const SEND_PRESCRIPTION_EMAIL = 'Services/Notifications.svc/REST/SendPrescriptionEmail'; +const GET_PRESCRIPTION_REPORT_ENH = 'Services/Patients.svc/REST/GetPrescriptionReport_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 SEND_LAB_RESULT_EMAIL = - 'Services/Notifications.svc/REST/SendLabReportEmail'; -const GET_Patient_LAB_RESULT = - 'Services/Patients.svc/REST/GetPatientLabResults'; -const GET_Patient_LAB_ORDERS_RESULT = - 'Services/Patients.svc/REST/GetPatientLabOrdersResults'; -const SEND_COVID_LAB_RESULT_EMAIL = - 'Services/Notifications.svc/REST/GenerateCOVIDReport'; -const COVID_PASSPORT_UPDATE = - 'Services/Patients.svc/REST/Covid19_Certificate_PassportUpdate'; -const GET_PATIENT_PASSPORT_NUMBER = - 'Services/Patients.svc/REST/Covid19_Certificate_GetPassport'; +const GET_Patient_LAB_SPECIAL_RESULT = 'Services/Patients.svc/REST/GetPatientLabSpecialResults'; +const SEND_LAB_RESULT_EMAIL = 'Services/Notifications.svc/REST/SendLabReportEmail'; +const GET_Patient_LAB_RESULT = 'Services/Patients.svc/REST/GetPatientLabResults'; +const GET_Patient_LAB_ORDERS_RESULT = 'Services/Patients.svc/REST/GetPatientLabOrdersResults'; +const SEND_COVID_LAB_RESULT_EMAIL = 'Services/Notifications.svc/REST/GenerateCOVIDReport'; +const COVID_PASSPORT_UPDATE = 'Services/Patients.svc/REST/Covid19_Certificate_PassportUpdate'; +const GET_PATIENT_PASSPORT_NUMBER = 'Services/Patients.svc/REST/Covid19_Certificate_GetPassport'; /// const GET_PATIENT_ORDERS = 'Services/Patients.svc/REST/GetPatientRadOrders'; -const GET_PATIENT_LAB_ORDERS_BY_APPOINTMENT = - 'Services/Patients.svc/REST/GetPatientLabResultsByAppointmentNo'; +const GET_PATIENT_LAB_ORDERS_BY_APPOINTMENT = 'Services/Patients.svc/REST/GetPatientLabResultsByAppointmentNo'; -const GET_PATIENT_ORDERS_DETAILS = - 'Services/Patients.svc/REST/Rad_UpdatePatientRadOrdersToRead'; +const GET_PATIENT_ORDERS_DETAILS = 'Services/Patients.svc/REST/Rad_UpdatePatientRadOrdersToRead'; const GET_RAD_IMAGE_URL = 'Services/Patients.svc/Rest/GetRadImageURL'; -const SEND_RAD_REPORT_EMAIL = - 'Services/Notifications.svc/REST/SendRadReportEmail'; +const SEND_RAD_REPORT_EMAIL = 'Services/Notifications.svc/REST/SendRadReportEmail'; ///Feedback const SEND_FEEDBACK = 'Services/COCWS.svc/REST/InsertCOCItemInSPList'; @@ -112,40 +97,28 @@ const GET_PATIENT_AppointmentHistory = 'Services' '/Doctors.svc/REST/PateintHasAppoimentHistory_Async'; ///VITAL SIGN -const GET_PATIENT_VITAL_SIGN = - 'Services/Doctors.svc/REST/Doctor_GetPatientVitalSign'; +const GET_PATIENT_VITAL_SIGN = 'Services/Doctors.svc/REST/Doctor_GetPatientVitalSign'; ///Er Nearest -const GET_NEAREST_HOSPITAL = - 'Services/Patients.svc/REST/Patient_GetProjectAvgERWaitingTime'; +const GET_NEAREST_HOSPITAL = 'Services/Patients.svc/REST/Patient_GetProjectAvgERWaitingTime'; ///ED Online -const ER_GET_VISUAL_TRIAGE_QUESTIONS = - "services/Doctors.svc/REST/ER_GetVisualTriageQuestions"; -const ER_SAVE_TRIAGE_INFORMATION = - "services/Doctors.svc/REST/ER_SaveTriageInformation"; -const ER_GetPatientPaymentInformationForERClinic = - "services/Doctors.svc/REST/ER_GetPatientPaymentInformationForERClinic"; +const ER_GET_VISUAL_TRIAGE_QUESTIONS = "services/Doctors.svc/REST/ER_GetVisualTriageQuestions"; +const ER_SAVE_TRIAGE_INFORMATION = "services/Doctors.svc/REST/ER_SaveTriageInformation"; +const ER_GetPatientPaymentInformationForERClinic = "services/Doctors.svc/REST/ER_GetPatientPaymentInformationForERClinic"; ///Er Nearest -const GET_AMBULANCE_REQUEST = - 'Services/Patients.svc/REST/PatientER_RRT_GetAllTransportationMethod'; -const GET_PATIENT_ALL_PRES_ORDERS = - 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; -const GET_PICK_UP_REQUEST_BY_PRES_ORDER_ID = - 'Services/Patients.svc/REST/PatientER_RRT_GetPickUpRequestByPresOrderID'; -const UPDATE_PRESS_ORDER = - 'Services/Patients.svc/REST/PatientER_UpdatePresOrder'; -const INSERT_ER_INERT_PRES_ORDER = - 'Services/Patients.svc/REST/PatientER_InsertPresOrder'; +const GET_AMBULANCE_REQUEST = 'Services/Patients.svc/REST/PatientER_RRT_GetAllTransportationMethod'; +const GET_PATIENT_ALL_PRES_ORDERS = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; +const GET_PICK_UP_REQUEST_BY_PRES_ORDER_ID = 'Services/Patients.svc/REST/PatientER_RRT_GetPickUpRequestByPresOrderID'; +const UPDATE_PRESS_ORDER = 'Services/Patients.svc/REST/PatientER_UpdatePresOrder'; +const INSERT_ER_INERT_PRES_ORDER = 'Services/Patients.svc/REST/PatientER_InsertPresOrder'; /// ER RRT const GET_ALL_RC_TRANSPORTATION = 'rc/api/Transportation/getalltransportation'; const GET_ALL_TRANSPORTATIONS_RC = 'rc/api/Transportation/getalltransportation'; -const GET_ALL_RRT_QUESTIONS = - 'Services/Patients.svc/REST/PatientER_RRT_GetAllQuestions'; -const GET_RRT_SERVICE_PRICE = - 'Services/Patients.svc/REST/PatientE_RealRRT_GetServicePrice'; +const GET_ALL_RRT_QUESTIONS = 'Services/Patients.svc/REST/PatientER_RRT_GetAllQuestions'; +const GET_RRT_SERVICE_PRICE = 'Services/Patients.svc/REST/PatientE_RealRRT_GetServicePrice'; const GET_ALL_TRANSPORTATIONS_ORDERS = 'rc/api/Transportation/get'; @@ -160,15 +133,13 @@ const GET_FINDUS_REQUEST = 'Services/Lists.svc/REST/Get_HMG_Locations'; const GET_LIVECHAT_REQUEST = 'Services/Patients.svc/REST/GetPatientICProjects'; ///babyInformation -const GET_BABYINFORMATION_REQUEST = - 'Services/Community.svc/REST/GetBabyByUserID'; +const GET_BABYINFORMATION_REQUEST = 'Services/Community.svc/REST/GetBabyByUserID'; ///Get Baby By User ID const GET_BABY_BY_USER_ID = 'Services/Community.svc/REST/GetBabyByUserID'; ///userInformation -const GET_USERINFORMATION_REQUEST = - 'Services/Community.svc/REST/GetUserInformation_New'; +const GET_USERINFORMATION_REQUEST = 'Services/Community.svc/REST/GetUserInformation_New'; ///Update email const UPDATE_PATENT_EMAIL = 'Services/Patients.svc/REST/UpdatePateintEmail'; @@ -190,34 +161,24 @@ const GET_TABLE_REQUEST = 'Services/Community.svc/REST/CreateVaccinationTable'; const GET_CITIES_REQUEST = 'Services/Lists.svc/REST/GetAllCities'; ///BloodDetails -const GET_BLOOD_REQUEST = - 'services/PatientVarification.svc/REST/BloodDonation_GetBloodGroupDetails'; +const GET_BLOOD_REQUEST = 'services/PatientVarification.svc/REST/BloodDonation_GetBloodGroupDetails'; -const SAVE_BLOOD_REQUEST = - 'Services/PatientVarification.svc/REST/BloodDonation_RegisterBloodType'; +const SAVE_BLOOD_REQUEST = 'Services/PatientVarification.svc/REST/BloodDonation_RegisterBloodType'; -const GET_BLOOD_AGREEMENT = - 'Services/PatientVarification.svc/REST/CheckUserAgreementForBloodDonation'; -const SAVE_BLOOD_AGREEMENT = - 'Services/PatientVarification.svc/REST/AddUserAgreementForBloodDonation'; +const GET_BLOOD_AGREEMENT = 'Services/PatientVarification.svc/REST/CheckUserAgreementForBloodDonation'; +const SAVE_BLOOD_AGREEMENT = 'Services/PatientVarification.svc/REST/AddUserAgreementForBloodDonation'; ///Reports const REPORTS = 'Services/Doctors.svc/REST/GetPatientMedicalReportStatusInfo'; -const INSERT_REQUEST_FOR_MEDICAL_REPORT = - 'Services/Doctors.svc/REST/InsertRequestForMedicalReport'; -const SEND_MEDICAL_REPORT_EMAIL = - 'Services/Notifications.svc/REST/SendMedicalReportEmail'; +const INSERT_REQUEST_FOR_MEDICAL_REPORT = 'Services/Doctors.svc/REST/InsertRequestForMedicalReport'; +const SEND_MEDICAL_REPORT_EMAIL = 'Services/Notifications.svc/REST/SendMedicalReportEmail'; ///Rate // const IS_LAST_APPOITMENT_RATED = 'Services/Doctors.svc/REST/IsLastAppoitmentRated'; -const IS_LAST_APPOITMENT_RATED = - 'Services/Doctors.svc/REST/IsLastAppoitmentRated_Async'; -const GET_APPOINTMENT_DETAILS_BY_NO = - 'Services/MobileNotifications.svc/REST/GetAppointmentDetailsByApptNo'; -const NEW_RATE_APPOINTMENT_URL = - "Services/Doctors.svc/REST/AppointmentsRating_InsertAppointmentRate"; -const NEW_RATE_DOCTOR_URL = - "Services/Doctors.svc/REST/DoctorsRating_InsertDoctorRate"; +const IS_LAST_APPOITMENT_RATED = 'Services/Doctors.svc/REST/IsLastAppoitmentRated_Async'; +const GET_APPOINTMENT_DETAILS_BY_NO = 'Services/MobileNotifications.svc/REST/GetAppointmentDetailsByApptNo'; +const NEW_RATE_APPOINTMENT_URL = "Services/Doctors.svc/REST/AppointmentsRating_InsertAppointmentRate"; +const NEW_RATE_DOCTOR_URL = "Services/Doctors.svc/REST/DoctorsRating_InsertDoctorRate"; const GET_QR_PARKING = 'Services/SWP.svc/REST/GetQRParkingByID'; @@ -225,8 +186,7 @@ const GET_QR_PARKING = 'Services/SWP.svc/REST/GetQRParkingByID'; const GET_CLINICS_LIST_URL = "Services/lists.svc/REST/GetClinicCentralized"; //URL to get active appointment list -const GET_ACTIVE_APPOINTMENTS_LIST_URL = - "Services/Doctors.svc/Rest/Dr_GetAppointmentActiveNumber"; +const GET_ACTIVE_APPOINTMENTS_LIST_URL = "Services/Doctors.svc/Rest/Dr_GetAppointmentActiveNumber"; //URL to get projects list const GET_PROJECTS_LIST = 'Services/Lists.svc/REST/GetProject'; @@ -235,128 +195,93 @@ 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"; //URL to insert appointment -const INSERT_SPECIFIC_APPOINTMENT = - "Services/Doctors.svc/REST/InsertSpecificAppointment"; +const INSERT_SPECIFIC_APPOINTMENT = "Services/Doctors.svc/REST/InsertSpecificAppointment"; //URL to get patient share -const GET_PATIENT_SHARE = - "Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNO"; +const GET_PATIENT_SHARE = "Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNO"; //URL to get patient appointment history -const GET_PATIENT_APPOINTMENT_HISTORY = - "Services/Doctors.svc/REST/PateintHasAppoimentHistory"; +const GET_PATIENT_APPOINTMENT_HISTORY = "Services/Doctors.svc/REST/PateintHasAppoimentHistory"; -const DOCTOR_SCHEDULE_URL = - 'Services/Doctors.svc/REST/GetDoctorWorkingHoursTable'; +const DOCTOR_SCHEDULE_URL = 'Services/Doctors.svc/REST/GetDoctorWorkingHoursTable'; -const SEND_REPORT_EYE_EMAIL = - "Services/Notifications.svc/REST/SendGlassesPrescriptionEmail"; +const SEND_REPORT_EYE_EMAIL = "Services/Notifications.svc/REST/SendGlassesPrescriptionEmail"; -const SEND_CONTACT_LENS_PRESCRIPTION_EMAIL = - "Services/Notifications.svc/REST/SendContactLensPrescriptionEmail"; +const SEND_CONTACT_LENS_PRESCRIPTION_EMAIL = "Services/Notifications.svc/REST/SendContactLensPrescriptionEmail"; //URL to get patient appointment curfew history // const GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = "Services/Doctors.svc/REST/AppoimentHistoryForCurfew"; -const GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = - "Services/Doctors.svc/REST/AppoimentHistoryForCurfew_Async"; +const GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = "Services/Doctors.svc/REST/AppoimentHistoryForCurfew_Async"; //URL to confirm appointment -const CONFIRM_APPOINTMENT = - "Services/MobileNotifications.svc/REST/ConfirmAppointment"; +const CONFIRM_APPOINTMENT = "Services/MobileNotifications.svc/REST/ConfirmAppointment"; -const INSERT_VIDA_REQUEST = - "Services/ER_VirtualCall.svc/REST/PatientER_VidaRequestInseart"; +const INSERT_VIDA_REQUEST = "Services/ER_VirtualCall.svc/REST/PatientER_VidaRequestInseart"; //URL to cancel appointment const CANCEL_APPOINTMENT = "Services/Doctors.svc/REST/CancelAppointment"; //URL get appointment QR -const GENERATE_QR_APPOINTMENT = - "Services/Doctors.svc/REST/GenerateQRAppointmentNo"; +const GENERATE_QR_APPOINTMENT = "Services/Doctors.svc/REST/GenerateQRAppointmentNo"; //URL send email appointment QR -const EMAIL_QR_APPOINTMENT = - "Services/Notifications.svc/REST/sendEmailForOnLineCheckin"; +const EMAIL_QR_APPOINTMENT = "Services/Notifications.svc/REST/sendEmailForOnLineCheckin"; //URL check payment status -const CHECK_PAYMENT_STATUS = - "Services/PayFort_Serv.svc/REST/GetRequestStatusByRequestID"; +const CHECK_PAYMENT_STATUS = "Services/PayFort_Serv.svc/REST/GetRequestStatusByRequestID"; //URL create advance payment const CREATE_ADVANCE_PAYMENT = "Services/Doctors.svc/REST/CreateAdvancePayment"; -const HIS_CREATE_ADVANCE_PAYMENT = - "Services/Patients.svc/REST/HIS_CreateAdvancePayment"; +const HIS_CREATE_ADVANCE_PAYMENT = "Services/Patients.svc/REST/HIS_CreateAdvancePayment"; -const ADD_ADVANCE_NUMBER_REQUEST = - 'Services/PayFort_Serv.svc/REST/AddAdvancedNumberRequest'; +const ADD_ADVANCE_NUMBER_REQUEST = 'Services/PayFort_Serv.svc/REST/AddAdvancedNumberRequest'; -const IS_ALLOW_ASK_DOCTOR = - 'Services/Doctors.svc/REST/GetPatientDoctorAppointmentResult'; -const GET_CALL_REQUEST_TYPE = - 'Services/Doctors.svc/REST/GetCallRequestType_LOV'; -const ADD_VIDA_REQUEST = - 'Services/ER_VirtualCall.svc/REST/PatientER_VidaRequestInseart'; +const IS_ALLOW_ASK_DOCTOR = 'Services/Doctors.svc/REST/GetPatientDoctorAppointmentResult'; +const GET_CALL_REQUEST_TYPE = 'Services/Doctors.svc/REST/GetCallRequestType_LOV'; +const ADD_VIDA_REQUEST = 'Services/ER_VirtualCall.svc/REST/PatientER_VidaRequestInseart'; const SEND_CALL_REQUEST = 'Services/Doctors.svc/REST/InsertCallInfo'; -const GET_LIVECARE_CLINICS = - 'Services/ER_VirtualCall.svc/REST/PatientER_GetClinics'; +const GET_LIVECARE_CLINICS = 'Services/ER_VirtualCall.svc/REST/PatientER_GetClinics'; -const GET_LIVECARE_SCHEDULE_CLINICS = - 'Services/Doctors.svc/REST/PatientER_GetClinicsHaveSchedule'; +const GET_LIVECARE_SCHEDULE_CLINICS = 'Services/Doctors.svc/REST/PatientER_GetClinicsHaveSchedule'; -const GET_LIVECARE_SCHEDULE_CLINIC_DOCTOR_LIST = - 'Services/Doctors.svc/REST/PatientER_GetDoctorByClinicID'; +const GET_LIVECARE_SCHEDULE_CLINIC_DOCTOR_LIST = 'Services/Doctors.svc/REST/PatientER_GetDoctorByClinicID'; -const GET_LIVECARE_SCHEDULE_DOCTOR_TIME_SLOTS = - 'Services/Doctors.svc/REST/PatientER_GetDoctorFreeSlots'; +const GET_LIVECARE_SCHEDULE_DOCTOR_TIME_SLOTS = 'Services/Doctors.svc/REST/PatientER_GetDoctorFreeSlots'; -const INSERT_LIVECARE_SCHEDULE_APPOINTMENT = - 'Services/Doctors.svc/REST/InsertSpecificAppoitmentForSchedule'; +const INSERT_LIVECARE_SCHEDULE_APPOINTMENT = 'Services/Doctors.svc/REST/InsertSpecificAppoitmentForSchedule'; -const GET_PATIENT_SHARE_LIVECARE = - "Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNOForLiveCare"; +const GET_PATIENT_SHARE_LIVECARE = "Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNOForLiveCare"; -const GET_LIVECARE_CLINIC_TIMING = - 'Services/ER_VirtualCall.svc/REST/PatientER_GetClinicsServiceTimingsSchedule'; +const GET_LIVECARE_CLINIC_TIMING = 'Services/ER_VirtualCall.svc/REST/PatientER_GetClinicsServiceTimingsSchedule'; -const GET_ER_APPOINTMENT_FEES = - 'Services/DoctorApplication.svc/REST/GetERAppointmentFees'; +const GET_ER_APPOINTMENT_FEES = 'Services/DoctorApplication.svc/REST/GetERAppointmentFees'; const GET_ER_APPOINTMENT_TIME = 'Services/ER_VirtualCall.svc/REST/GetRestTime'; -const ADD_NEW_CALL_FOR_PATIENT_ER = - 'Services/DoctorApplication.svc/REST/NewCallForPatientER'; +const ADD_NEW_CALL_FOR_PATIENT_ER = 'Services/DoctorApplication.svc/REST/NewCallForPatientER'; -const GET_LIVECARE_HISTORY = - 'Services/ER_VirtualCall.svc/REST/GetPatientErVirtualHistory'; -const CANCEL_LIVECARE_REQUEST = - 'Services/ER_VirtualCall.svc/REST/DeleteErRequest'; -const SEND_LIVECARE_INVOICE_EMAIL = - 'Services/Notifications.svc/REST/SendInvoiceForLiveCare'; +const GET_LIVECARE_HISTORY = 'Services/ER_VirtualCall.svc/REST/GetPatientErVirtualHistory'; +const CANCEL_LIVECARE_REQUEST = 'Services/ER_VirtualCall.svc/REST/DeleteErRequest'; +const SEND_LIVECARE_INVOICE_EMAIL = 'Services/Notifications.svc/REST/SendInvoiceForLiveCare'; -const APPLE_PAY_INSERT_REQUEST = - 'Services/PayFort_Serv.svc/REST/PayFort_ApplePayRequestData_Insert'; +const APPLE_PAY_INSERT_REQUEST = 'Services/PayFort_Serv.svc/REST/PayFort_ApplePayRequestData_Insert'; const GET_USER_TERMS = 'Services/Patients.svc/REST/GetUserTermsAndConditions'; -const UPDATE_HEALTH_TERMS = - 'services/Patients.svc/REST/UpdatePateintHealthSummaryReport'; +const UPDATE_HEALTH_TERMS = 'services/Patients.svc/REST/UpdatePateintHealthSummaryReport'; -const GET_PATIENT_HEALTH_STATS = - 'Services/Patients.svc/REST/Med_GetTransactionsSts'; +const GET_PATIENT_HEALTH_STATS = 'Services/Patients.svc/REST/Med_GetTransactionsSts'; -const SEND_CHECK_IN_NFC_REQUEST = - 'Services/Patients.svc/REST/Patient_CheckAppointmentValidation_ForNFC'; +const SEND_CHECK_IN_NFC_REQUEST = 'Services/Patients.svc/REST/Patient_CheckAppointmentValidation_ForNFC'; -const HAS_DENTAL_PLAN = - 'Services/Doctors.svc/REST/Dental_IsPatientHasOnGoingEstimation'; +const HAS_DENTAL_PLAN = 'Services/Doctors.svc/REST/Dental_IsPatientHasOnGoingEstimation'; //URL to get medicine and pharmacies list const CHANNEL = 3; @@ -377,21 +302,16 @@ var DeviceTypeID = Platform.isIOS ? 1 : 2; const LANGUAGE_ID = 2; const GET_PHARMCY_ITEMS = "Services/Lists.svc/REST/GetPharmcyItems_Region"; const GET_PHARMACY_LIST = "Services/Patients.svc/REST/GetPharmcyList"; -const GET_PAtIENTS_INSURANCE = - "Services/Patients.svc/REST/Get_PatientInsuranceDetails"; -const GET_PAtIENTS_INSURANCE_UPDATED = - "Services/Patients.svc/REST/PatientER_GetPatientInsuranceCardUpdateHistory"; +const GET_PAtIENTS_INSURANCE = "Services/Patients.svc/REST/Get_PatientInsuranceDetails"; +const GET_PAtIENTS_INSURANCE_UPDATED = "Services/Patients.svc/REST/PatientER_GetPatientInsuranceCardUpdateHistory"; const INSURANCE_DETAILS = "Services/Patients.svc/REST/Get_InsuranceCheckList"; -const GET_PATIENT_INSURANCE_DETAILS = - "Services/Patients.svc/REST/PatientER_GetPatientInsuranceDetails"; -const UPLOAD_INSURANCE_CARD = - 'Services/Patients.svc/REST/PatientER_PatientInfoForInsuranceCardUpdate'; +const GET_PATIENT_INSURANCE_DETAILS = "Services/Patients.svc/REST/PatientER_GetPatientInsuranceDetails"; +const UPLOAD_INSURANCE_CARD = 'Services/Patients.svc/REST/PatientER_PatientInfoForInsuranceCardUpdate'; const GET_VACCINES = "Services/Patients.svc/REST/GetDoneVaccinesByPatientID"; const GET_VACCINES_EMAIL = "Services/Notifications.svc/REST/SendVaccinesEmail"; -const GET_PAtIENTS_INSURANCE_APPROVALS = - "Services/Patients.svc/REST/GetApprovalStatus_Async"; +const GET_PAtIENTS_INSURANCE_APPROVALS = "Services/Patients.svc/REST/GetApprovalStatus_Async"; // const GET_PAtIENTS_INSURANCE_APPROVALS = "Services/Patients.svc/REST/GetApprovalStatus"; const SEARCH_BOT = 'HabibiChatBotApi/BotInterface/GetVoiceCommandResponse'; @@ -402,86 +322,54 @@ 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'; -const GET_COVID_DRIVETHRU_PROJECT_LIST = - 'Services/Doctors.svc/REST/COVID19_ProjectDriveThroughTestingCenter'; +const GET_COVID_DRIVETHRU_PROJECT_LIST = 'Services/Doctors.svc/REST/COVID19_ProjectDriveThroughTestingCenter'; -const GET_COVID_DRIVETHRU_PAYMENT_INFO = - 'Services/Doctors.svc/REST/COVID19_GetPatientPaymentInormation'; +const GET_COVID_DRIVETHRU_PAYMENT_INFO = 'Services/Doctors.svc/REST/COVID19_GetPatientPaymentInormation'; -const GET_COVID_DRIVETHRU_FREE_SLOTS = - 'Services/Doctors.svc/REST/COVID19_GetFreeSlots'; +const GET_COVID_DRIVETHRU_FREE_SLOTS = 'Services/Doctors.svc/REST/COVID19_GetFreeSlots'; -const GET_COVID_DRIVETHRU_PROCEDURES_LIST = - 'Services/Doctors.svc/REST/COVID19_GetTestProcedures'; +const GET_COVID_DRIVETHRU_PROCEDURES_LIST = 'Services/Doctors.svc/REST/COVID19_GetTestProcedures'; ///Smartwatch Integration Services -const GET_PATIENT_LAST_RECORD = - 'Services/Patients.svc/REST/Med_GetPatientLastRecord'; -const INSERT_PATIENT_HEALTH_DATA = - 'Services/Patients.svc/REST/Med_InsertTransactions'; +const GET_PATIENT_LAST_RECORD = 'Services/Patients.svc/REST/Med_GetPatientLastRecord'; +const INSERT_PATIENT_HEALTH_DATA = 'Services/Patients.svc/REST/Med_InsertTransactions'; ///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 UPDATE_DIABETIC_RESULT = - 'Services/Patients.svc/REST/Patient_UpdateDiabeticResult'; - -const SEND_AVERAGE_BLOOD_SUGAR_REPORT = - 'Services/Notifications.svc/REST/SendAverageBloodSugarReport'; -const DEACTIVATE_DIABETIC_STATUS = - 'services/Patients.svc/REST/Patient_DeactivateDiabeticStatus'; -const DEACTIVATE_BLOOD_PRESSURES_STATUS = - 'services/Patients.svc/REST/Patient_DeactivateBloodPressureStatus'; - -const UPDATE_BLOOD_PRESSURE_RESULT = - 'Services/Patients.svc/REST/Patient_UpdateBloodPressureResult'; -const SEND_AVERAGE_BLOOD_WEIGHT_REPORT = - 'Services/Notifications.svc/REST/SendAverageBodyWeightReport'; -const SEND_AVERAGE_BLOOD_PRESSURE_REPORT = - 'Services/Notifications.svc/REST/SendAverageBloodPressureReport'; - -const UPDATE_WEIGHT_PRESSURE_RESULT = - 'Services/Patients.svc/REST/Patient_UpdateWeightMeasurementResult'; -const DEACTIVATE_WEIGHT_PRESSURE_RESULT = - 'services/Patients.svc/REST/Patient_DeactivateWeightMeasurementStatus'; +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 UPDATE_DIABETIC_RESULT = 'Services/Patients.svc/REST/Patient_UpdateDiabeticResult'; + +const SEND_AVERAGE_BLOOD_SUGAR_REPORT = 'Services/Notifications.svc/REST/SendAverageBloodSugarReport'; +const DEACTIVATE_DIABETIC_STATUS = 'services/Patients.svc/REST/Patient_DeactivateDiabeticStatus'; +const DEACTIVATE_BLOOD_PRESSURES_STATUS = 'services/Patients.svc/REST/Patient_DeactivateBloodPressureStatus'; + +const UPDATE_BLOOD_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_UpdateBloodPressureResult'; +const SEND_AVERAGE_BLOOD_WEIGHT_REPORT = 'Services/Notifications.svc/REST/SendAverageBodyWeightReport'; +const SEND_AVERAGE_BLOOD_PRESSURE_REPORT = 'Services/Notifications.svc/REST/SendAverageBloodPressureReport'; + +const UPDATE_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_UpdateWeightMeasurementResult'; +const DEACTIVATE_WEIGHT_PRESSURE_RESULT = 'services/Patients.svc/REST/Patient_DeactivateWeightMeasurementStatus'; 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'; @@ -489,35 +377,25 @@ 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_DETAIL = - "Services/H2ORemainder.svc/REST/H2O_GetUserDetails_New"; -const H2O_UPDATE_USER_DETAIL = - "Services/H2ORemainder.svc/REST/H2O_UpdateUserDetails_New"; -const H2O_UNDO_USER_ACTIVITY = - "Services/H2ORemainder.svc/REST/H2o_UndoUserActivity"; +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_DETAIL = "Services/H2ORemainder.svc/REST/H2O_GetUserDetails_New"; +const H2O_UPDATE_USER_DETAIL = "Services/H2ORemainder.svc/REST/H2O_UpdateUserDetails_New"; +const H2O_UNDO_USER_ACTIVITY = "Services/H2ORemainder.svc/REST/H2o_UndoUserActivity"; //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"; // Encillary Orders -const GET_ANCILLARY_ORDERS = - 'Services/Doctors.svc/REST/GetOnlineAncillaryOrderList'; +const GET_ANCILLARY_ORDERS = 'Services/Doctors.svc/REST/GetOnlineAncillaryOrderList'; -const GET_ANCILLARY_ORDERS_DETAILS = - 'Services/Doctors.svc/REST/GetOnlineAncillaryOrderProcList'; +const GET_ANCILLARY_ORDERS_DETAILS = 'Services/Doctors.svc/REST/GetOnlineAncillaryOrderProcList'; //Pharmacy wishlist // const GET_WISHLIST = "http://swd-pharapp-01:7200/api/shopping_cart_items/"; @@ -550,50 +428,32 @@ const GET_SHIPPING_OPTIONS = "get_shipping_option/"; const DELETE_SHOPPING_CART = "delete_shopping_cart_items/"; const DELETE_SHOPPING_CART_ALL = "delete_shopping_cart_item_by_customer/"; const ORDER_SHOPPING_CART = "orders"; -const GET_LACUM_ACCOUNT_INFORMATION = - "Services/Patients.svc/REST/GetLakumAccountInformation"; -const GET_LACUM_GROUP_INFORMATION = - "Services/Patients.svc/REST/GetlakumInQueryInfoGrouping"; -const LACUM_ACCOUNT_ACTIVATE = - "Services/Patients.svc/REST/LakumAccountActivation"; -const LACUM_ACCOUNT_DEACTIVATE = - "Services/Patients.svc/REST/LakumAccountDeactivation"; -const CREATE_LAKUM_ACCOUNT = - "Services/Patients.svc/REST/PHR_CreateLakumAccount"; -const TRANSFER_YAHALA_LOYALITY_POINTS = - "Services/Patients.svc/REST/TransferYaHalaLoyaltyPoints"; -const LAKUM_GET_USER_TERMS_AND_CONDITIONS = - "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy"; +const GET_LACUM_ACCOUNT_INFORMATION = "Services/Patients.svc/REST/GetLakumAccountInformation"; +const GET_LACUM_GROUP_INFORMATION = "Services/Patients.svc/REST/GetlakumInQueryInfoGrouping"; +const LACUM_ACCOUNT_ACTIVATE = "Services/Patients.svc/REST/LakumAccountActivation"; +const LACUM_ACCOUNT_DEACTIVATE = "Services/Patients.svc/REST/LakumAccountDeactivation"; +const CREATE_LAKUM_ACCOUNT = "Services/Patients.svc/REST/PHR_CreateLakumAccount"; +const TRANSFER_YAHALA_LOYALITY_POINTS = "Services/Patients.svc/REST/TransferYaHalaLoyaltyPoints"; +const LAKUM_GET_USER_TERMS_AND_CONDITIONS = "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy"; const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList'; const GET_RECOMMENDED_PRODUCT = 'alsoProduct/'; const GET_MOST_VIEWED_PRODUCTS = "mostview"; const GET_NEW_PRODUCTS = "newproducts"; // Home Health Care -const HHC_GET_ALL_SERVICES = - "Services/Patients.svc/REST/PatientER_HHC_GetAllServices"; -const HHC_GET_ALL_CMC_SERVICES = - "Services/Patients.svc/REST/PatientER_CMC_GetAllServices"; -const PATIENT_ER_UPDATE_PRES_ORDER = - "Services/Patients.svc/REST/PatientER_UpdatePresOrder"; -const GET_ORDER_DETAIL_BY_ID = - "Services/Patients.svc/REST/PatientER_HHC_GetTransactionsForOrder"; -const GET_CMC_ORDER_DETAIL_BY_ID = - "Services/Patients.svc/REST/PatientER_CMC_GetTransactionsForOrder"; +const HHC_GET_ALL_SERVICES = "Services/Patients.svc/REST/PatientER_HHC_GetAllServices"; +const HHC_GET_ALL_CMC_SERVICES = "Services/Patients.svc/REST/PatientER_CMC_GetAllServices"; +const PATIENT_ER_UPDATE_PRES_ORDER = "Services/Patients.svc/REST/PatientER_UpdatePresOrder"; +const GET_ORDER_DETAIL_BY_ID = "Services/Patients.svc/REST/PatientER_HHC_GetTransactionsForOrder"; +const GET_CMC_ORDER_DETAIL_BY_ID = "Services/Patients.svc/REST/PatientER_CMC_GetTransactionsForOrder"; const GET_CHECK_UP_ITEMS = "Services/Patients.svc/REST/GetCheckUpItems"; -const PUSH_NOTIFICATION_GET_ALL_NOTIFICATIONS = - 'Services/MobileNotifications.svc/REST/PushNotification_GetAllNotifications'; -const PUSH_NOTIFICATION_SET_MESSAGES_FROM_POOL_AS_READ = - 'Services/MobileNotifications.svc/REST/PushNotification_SetMessagesFromPoolAsRead'; -const GET_PATIENT_ALL_PRES_ORD = - 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; -const PATIENT_ER_INSERT_PRES_ORDER = - 'Services/Patients.svc/REST/PatientER_InsertPresOrder'; +const PUSH_NOTIFICATION_GET_ALL_NOTIFICATIONS = 'Services/MobileNotifications.svc/REST/PushNotification_GetAllNotifications'; +const PUSH_NOTIFICATION_SET_MESSAGES_FROM_POOL_AS_READ = 'Services/MobileNotifications.svc/REST/PushNotification_SetMessagesFromPoolAsRead'; +const GET_PATIENT_ALL_PRES_ORD = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; +const PATIENT_ER_INSERT_PRES_ORDER = 'Services/Patients.svc/REST/PatientER_InsertPresOrder'; const PHARMACY_MAKE_REVIEW = 'epharmacy/api/insertreviews'; -const BLOOD_DONATION_REGISTER_BLOOD_TYPE = - 'Services/PatientVarification.svc/REST/BloodDonation_RegisterBloodType'; -const ADD_USER_AGREEMENT_FOR_BLOOD_DONATION = - 'Services/PatientVarification.svc/REST/AddUserAgreementForBloodDonation'; +const BLOOD_DONATION_REGISTER_BLOOD_TYPE = 'Services/PatientVarification.svc/REST/BloodDonation_RegisterBloodType'; +const ADD_USER_AGREEMENT_FOR_BLOOD_DONATION = 'Services/PatientVarification.svc/REST/AddUserAgreementForBloodDonation'; // HHC RC SERVICES const HHC_GET_ALL_SERVICES_RC = "rc/api/HHC/getallhhc"; @@ -618,6 +478,7 @@ const GET_ALL_PRESCRIPTION_ORDERS_RC = "rc/api/prescription/list"; const GET_ALL_PRESCRIPTION_INFO_RC = "rc/api/Prescription/info"; const UPDATE_PRESCRIPTION_ORDER_RC = 'rc/api/prescription/update'; + //Pharmacy wishlist const GET_WISHLIST = "shopping_cart_items/"; const DELETE_WISHLIST = "delete_shopping_cart_item_by_product?customer_id="; @@ -636,21 +497,17 @@ const GET_CUSTOMER_INFO = "VerifyCustomer"; //Pharmacy -const GET_PHARMACY_CATEGORISE = - 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=0'; +const GET_PHARMACY_CATEGORISE = 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=0'; const GET_OFFERS_CATEGORISE = 'discountcategories'; const GET_OFFERS_PRODUCTS = 'offerproducts/'; -const GET_CATEGORISE_PARENT = - 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id='; +const GET_CATEGORISE_PARENT = 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id='; const GET_PARENT_PRODUCTS = 'products?categoryid='; -const GET_SUB_CATEGORISE = - 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id='; +const GET_SUB_CATEGORISE = 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id='; const GET_SUB_PRODUCTS = 'products?categoryid='; const GET_FINAL_PRODUCTS = 'products?fields=id,reviews,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage&CategoryId='; const GET_CLINIC_CATEGORY = 'Services/Doctors.svc/REST/DP_GetClinicCategory'; -const GET_DISEASE_BY_CLINIC_ID = - 'Services/Doctors.svc/REST/DP_GetDiseasesByClinicID'; +const GET_DISEASE_BY_CLINIC_ID = 'Services/Doctors.svc/REST/DP_GetDiseasesByClinicID'; const SEARCH_DOCTOR_BY_TIME = 'Services/Doctors.svc/REST/SearchDoctorsByTime'; const TIMER_MIN = 10; @@ -666,17 +523,13 @@ const SCAN_QR_CODE = 'productbysku/'; const FILTERED_PRODUCTS = 'products?categoryids='; -const GET_DOCTOR_LIST_CALCULATION = - "Services/Doctors.svc/REST/GetCallculationDoctors"; +const GET_DOCTOR_LIST_CALCULATION = "Services/Doctors.svc/REST/GetCallculationDoctors"; -const GET_ALL_APPOINTMENTS_FOR_DENTAL_CLINIC = - "Services/Patients.svc/REST/GetDentalAppointments"; +const GET_ALL_APPOINTMENTS_FOR_DENTAL_CLINIC = "Services/Patients.svc/REST/GetDentalAppointments"; -const GET_DENTAL_APPOINTMENT_INVOICE = - "Services/Patients.svc/REST/HIS_eInvoiceForDentalByAppointmentNo"; +const GET_DENTAL_APPOINTMENT_INVOICE = "Services/Patients.svc/REST/HIS_eInvoiceForDentalByAppointmentNo"; -const SEND_DENTAL_APPOINTMENT_INVOICE_EMAIL = - "Services/Notifications.svc/REST/SendInvoiceForDental"; +const SEND_DENTAL_APPOINTMENT_INVOICE_EMAIL = "Services/Notifications.svc/REST/SendInvoiceForDental"; class AppGlobal { static var context; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 46f010bd..54a04592 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -630,6 +630,16 @@ const Map localizedValues = { "years-old": {"en": "years old", "ar": "سنة"}, "drag-point": {"en": "Drag point to change your age", "ar": "اسحب لتغيير عمرك"}, "refine": {"en": "Refine", "ar": "تصفية"}, + "max": {"en": "Max", "ar": "اعلى"}, + "addToCompareMsg": {"en": "You have added a product to the Compare list", "ar": "تمت الاضافه لقائمة المقارنه"}, + "itInListMsg": {"en": "Item is already in the list", "ar": "المنتج موجود في القائمه"}, + "compareListFull": {"en": "Your compare list is full", "ar": "قائمة المقارنة ممتلئه"}, + "addQuantity": {"en": "You should add quantity", "ar": "اختر الكمية"}, + "addToCartMsg": {"en": "You have added a product to the cart", "ar": "تمت اضافة المنتج بنجاح"}, + "addToWishlistMsg": {"en": "You have added a product to the Wishlist", "ar": "تمت الاضافة لقائمة الرغبات"}, + "notifyMeMsg": {"en": "You will be notified when product available", "ar": "سيتم اخبارك في حال توفر المنتج"}, + "removeFromWishlistMsg": {"en": "You have removed a product from the Wishlist", "ar": "تمت ازالة المنتج بنجاح"}, + "min": {"en": "Min", "ar": "اقل"}, "reset": {"en": "Reset", "ar": "اعادة تعيين"}, "apply": {"en": "Apply", "ar": "تطبيق"}, "viewCategorise": {"en": "View All Categories", "ar": "عرض جميع الفئات"}, @@ -1631,10 +1641,50 @@ const Map localizedValues = { "RRTTitle": {"en": "RRT", "ar": "خدمة فريق"}, "RRTSubTitle": {"en": "Service", "ar": "الاستجابة السريع"}, "transportation": {"en": "Transportation", "ar": "النقل"}, + "neck": {"en": "Neck", "ar": "رقبه"}, "waist": {"en": "Waist", "ar": "وسط"}, "hip": {"en": "Hip", "ar": "ورك او نتوء"}, "carbsProtin": {"en": "Carbs, Protein and Fat", "ar": "الكربوهيدرات والبروتينات والدهون"}, + "usefulInfo": {"en": "Useful Information", "ar": "معلومات مفيدة"}, + "babyAge": {"en": "Baby Age", "ar": "عمر الطفل الآن:"}, + "babyAgeAvail": {"en": "baby age is not available", "ar": "عمر الطفل غير متوفر"}, + "deliveryDue": {"en": "The delivery due date is estimated to be on the", "ar": "من المقدر أن يكون تاريخ استحقاق التسليم في"}, + + "almostInactive": {"en": "Almost Inactive(Little or no exercises)", "ar": "شبه غير نشط (تمارين قليلة أو معدومة)"}, + "lightActive1": {"en": "Lighty Active (1-3) days per week", "ar": "Lighty Active (1-3) أيام في الأسبوع"}, + "veryActive": {"en": "very Active(6-7) days per week", "ar": "نشط جدا (6-7) أيام في الأسبوع"}, + "superActive": {"en": "Super Active(very hard exercises)", "ar": "سوبر نشط (تمارين صعبة للغاية)"}, + + "dailyIntake": {"en": "Daily intake is", "ar": "المدخول اليومي"}, + "calculateAmount": {"en": "Calculates the amount of energy that the person’s body expends in a day", "ar": "تحسب كمية الطاقة التي يبذلها جسم الشخص في اليوم"}, + "bodyWillBurn": {"en": "This means the body will burn", "ar": "هذا يعني أن الجسم سوف يحترق"}, + "caloriesEachDay": {"en": "calories each day, if engaged in no activity for the entire day.. Note: Daily calorie requirement is", "ar": "السعرات الحرارية في كل يوم ، إذا لم تمارس أي نشاط طوال اليوم .. ملاحظة: متطلبات السعرات الحرارية اليومية هي"}, + "maintainWeight": {"en": "calories, to maintain the current weight.", "ar": "السعرات الحرارية للحفاظ على الوزن الحالي."}, + + "mediumFinger": {"en": "Medium(fingers touch)", "ar": "متوسطة (لمسة الأصابع)"}, + "smallFinger": {"en": "Small(fingers overlap)", "ar": "صغير (أصابع متداخلة)"}, + "largeFinger": {"en": "Large(fingers don\'n touch)", "ar": "كبير (لا تلمس الأصابع)"}, + "idealBodyWeight": {"en": "Calculates the ideal body weight based on height, Weight, and Body Size", "ar": "يحسب وزن الجسم المثالي بناءً على الطول والوزن وحجم الجسم"}, + "bodyFrameSize": {"en": "Body Frame Size", "ar": "حجم إطار الجسم"}, + + "idealWeightRange": {"en": "Ideal weight range is", "ar": "نطاق الوزن المثالي هو"}, + "currentWeightPerfect": {"en": "Congratulations! The current weight is perfect and considered healthy", "ar": "تهانينا! الوزن الحالي مثالي ويعتبر صحي"}, + "littleBitWeightMore": {"en": "This means that the weight is a little bit more than ideal weight by", "ar": "هذا يعني أن الوزن أكثر قليلاً من الوزن المثالي به"}, + "consultWithDoctor": {"en": "May wish to consult with the doctor for medical help. Click to view our list of Doctors", "ar": "قد ترغب في استشارة الطبيب للحصول على مساعدة طبية. انقر لعرض قائمة الأطباء لدينا"}, + "excessiveObesity": {"en": "Means that you suffer from excessive obesity by", "ar": "يعني أنك تعاني من السمنة المفرطة بها"}, + "mayWish": {"en": "May wish to consult with the doctor for medical help. Click to view our list of\n Doctors", "ar": "قد ترغب في استشارة الطبيب للحصول على مساعدة طبية. انقر لعرض قائمة الأطباء \ n الخاصة بنا"}, + + "essential": {"en": "The category falls under essential", "ar": "الفئة تندرج تحت الأساسية"}, + "athlete": {"en": "The category falls under athlete", "ar": "فئة تندرج تحت رياضي"}, + "fitness": {"en": "The category falls under fitness", "ar": "الفئة تندرج تحت اللياقة البدنية"}, + "acceptable": {"en": "The category falls under acceptable", "ar": "الفئة تندرج تحت مقبول"}, + "underObese": {"en": "The category falls under obese", "ar": "تندرج الفئة تحت السمنة"}, + "crossedLimits": {"en": "Please check the value you have entered, since the body fat percentage has crosed the limits.", "ar": "يرجى التحقق من القيمة التي أدخلتها ، لأن نسبة الدهون في الجسم تجاوزت الحدود."}, + "lowLimits": {"en": "Please check the value you have entered, since the body fat percentage cannot be this low.", "ar": "يرجى التحقق من القيمة التي أدخلتها ، حيث لا يمكن أن تكون نسبة الدهون في الجسم منخفضة."}, + "estimates": {"en": "Estimates the total body fat based on\nthe size", "ar": "تقدير إجمالي الدهون في الجسم بناءً على \ n الحجم"}, + + "myCart": {"en": "Cart", "ar": "عربة التسوق"}, "browseOffers": {"en": "Browse offers by clinic", "ar": "تصفح العروض حسب العيادة"}, "inactiveAct":{"en":"Almost inactive (little or no exercise)","ar":"غير نشط تقريبا (ممارسة الرياضة قليلة أو منعدمة)"}, @@ -1650,10 +1700,7 @@ const Map localizedValues = { "bodyFrameMedium": {"en": "Medium (fingers touch)", "ar": "متوسط (الأصابع تتلامس)"}, "bodyFrameLarge": {"en": "Large (fingers don't touch)", "ar": "عريض (الأصابع لا تتلامس)"}, "bodyFatDesc": {"en": "Estimates the total body fat based on the size", "ar": "حساب الدهون في الجسم بناءاً على الحجم"}, - "essential":{"en":"The category falls under Essential Fat.","ar":"تندرج تحت فئة دهون أساسية"}, - "athlete":{"en":" The category falls under Athlete.","ar":"تندرج تحت فئة دهون جسم رياضي"}, - "fitness":{"en":" The category falls under Fitness.","ar":"تندرج تحت فئة دهون جسم صحي"}, - "acceptable":{"en":"The category falls under Acceptable","ar":"تندرج تحت فئة دهون مقبولة"}, + "obeseBodyFat":{"en":"The category falls under Obese.","ar":"تندرج تحت فئة دهون جسم سمين"}, "invalid":{"en":"Invalid input for calculation.","ar":"البيانات المدخلة غير صالحة للحساب"}, "more":{"en":"Please check the value you have entered, since the body fat percentage has crossed the limits.","ar":"يرجى التحقق من القيمة التي أدخلتها ، نظرًا لأن نسبة الدهون في الجسم قد تجاوزت الحدود"}, @@ -1667,4 +1714,10 @@ const Map localizedValues = { "dietModerate":{"en":"Moderate Carb","ar":"حمية معتدلة الكربوهيدرات"}, "dietUSDA":{"en":"USDA Guidelines","ar":"ارشادات وزارة الزراعة الأمريكية"}, "dietZone":{"en":"Zone Diet","ar":"حمية زون"}, + + "Protein": {"en": "Protein", "ar": "بروتين"}, + "Cals": {"en": "Cals", "ar": "كالس"}, + "gramsPerDay": {"en": "Grams Per Day", "ar": "غرام في اليوم"}, + "gr": {"en": "gr", "ar": "غرام"}, + "gramsPerMeal": {"en": "Grams Per Meal", "ar": "عدد الجرامات لكل وجبة"}, }; diff --git a/lib/core/service/medical/prescriptions_service.dart b/lib/core/service/medical/prescriptions_service.dart index 4349f218..0a7d9e68 100644 --- a/lib/core/service/medical/prescriptions_service.dart +++ b/lib/core/service/medical/prescriptions_service.dart @@ -225,13 +225,12 @@ class PrescriptionsService extends BaseService { }, body: _requestPrescriptionReportEnh.toJson()); } - Future updatePressOrderRC({@required int presOrderID, @required String patientID}) async { + Future updatePressOrderRC({@required int presOrderID}) async { hasError = false; Map body = Map(); body['Id'] = presOrderID; body['StatusId'] = 6; body['ClickButton'] = 14; - body['PatientID'] = patientID; await baseAppClient.post(UPDATE_PRESCRIPTION_ORDER_RC, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart index 2ae935dd..68483a93 100644 --- a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart @@ -31,6 +31,8 @@ class ProductDetailViewModel extends BaseViewModel { String get stockAvailability => _productDetailService.stockAvailability; + String get stockAvailabilityn => _productDetailService.stockAvailabilityn; + bool get isStockAvailable => _productDetailService.isStockAvailable; Future getProductReviewsData(productID) async { @@ -55,10 +57,10 @@ class ProductDetailViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future notifyMe(customerId, itemID) async { + Future notifyMe(customerId, itemID, context) async { hasError = false; setState(ViewState.BusyLocal); - await _productDetailService.notifyMe(customerId, itemID); + await _productDetailService.notifyMe(customerId, itemID, context); if (_productDetailService.hasError) { error = _productDetailService.error; setState(ViewState.ErrorLocal); @@ -66,10 +68,10 @@ class ProductDetailViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future addToCartData(quantity, itemID) async { + Future addToCartData(quantity, itemID, context) async { hasError = false; setState(ViewState.BusyLocal); - var resp = await _productDetailService.addToCart(quantity, itemID); + var resp = await _productDetailService.addToCart(quantity, itemID, context); ShoppingCartResponse object = _handleGetShoppingCartResponse(resp); if (_productDetailService.hasError) { error = _productDetailService.error; @@ -103,11 +105,11 @@ class ProductDetailViewModel extends BaseViewModel { return cartResponse; } - Future addToWishlistData(itemID) async { + Future addToWishlistData(itemID, context) async { hasError = false; setState(ViewState.BusyLocal); GifLoaderDialogUtils.showMyDialog(locator().navigatorKey.currentContext); - await _productDetailService.addToWishlist(itemID); + await _productDetailService.addToWishlist(itemID, context); GifLoaderDialogUtils.hideDialog(locator().navigatorKey.currentContext); if (_productDetailService.hasError) { @@ -128,11 +130,11 @@ class ProductDetailViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future deleteWishlistData(itemID) async { + Future deleteWishlistData(itemID, context) async { hasError = false; setState(ViewState.BusyLocal); GifLoaderDialogUtils.showMyDialog(locator().navigatorKey.currentContext); - await _productDetailService.deleteItemFromWishlist(itemID); + await _productDetailService.deleteItemFromWishlist(itemID, context); GifLoaderDialogUtils.hideDialog(locator().navigatorKey.currentContext); if (_productDetailService.hasError) { diff --git a/lib/models/Authentication/send_activation_request.dart b/lib/models/Authentication/send_activation_request.dart index e9512102..867d2d95 100644 --- a/lib/models/Authentication/send_activation_request.dart +++ b/lib/models/Authentication/send_activation_request.dart @@ -25,6 +25,9 @@ class SendActivationRequest { String dob; int isHijri; String healthId; + int responseID; + int status; + SendActivationRequest( {this.patientMobileNumber, this.mobileNo, @@ -51,7 +54,9 @@ class SendActivationRequest { this.sMSSignature, this.dob, this.isHijri, - this.healthId}); + this.healthId, + this.responseID, + this.status}); SendActivationRequest.fromJson(Map json) { patientMobileNumber = json['PatientMobileNumber']; @@ -80,6 +85,8 @@ class SendActivationRequest { dob = json['DOB']; isHijri = json['IsHijri']; healthId = json['HealthId']; + responseID = json['ReponseID']; + status = json['Status']; } Map toJson() { @@ -110,6 +117,8 @@ class SendActivationRequest { data['DOB'] = dob; data['IsHijri'] = isHijri; data['HealthId'] = healthId; + data['ResponseID'] = responseID; + data['Status'] = status; return data; } } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart index 974cd748..62020a62 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart @@ -2,7 +2,8 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -48,7 +49,7 @@ class _BmrCalculatorState extends State { // int height = 0; // int weight = 0; double bmrResult = 0; - String dropdownValue = ''; + String dropdownValue = null; double calories = 0; void updateColor(int type) { @@ -121,14 +122,14 @@ class _BmrCalculatorState extends State { bmrResult = bmrResult.roundToDouble(); } - void calculateCalories() { - if (dropdownValue == TranslationBase.of(context).inactiveAct) { + void calculateCalories(BuildContext context) { + if (dropdownValue == TranslationBase.of(context).almostInactive) { calories = bmrResult * 1.2; - } else if (dropdownValue == TranslationBase.of(context).light) { + } else if (dropdownValue == TranslationBase.of(context).lightActive1) { calories = bmrResult * 1.375; - } else if (dropdownValue == TranslationBase.of(context).very) { + } else if (dropdownValue == TranslationBase.of(context).veryActive) { calories = bmrResult * 1.55; - } else if (dropdownValue == TranslationBase.of(context).superAct) { + } else if (dropdownValue == TranslationBase.of(context).superActive) { calories = bmrResult * 1.725; } else if (dropdownValue == "") { calories = bmrResult * 10.725; @@ -137,7 +138,7 @@ class _BmrCalculatorState extends State { @override Widget build(BuildContext context) { - dropdownValue = TranslationBase.of(context).light; + if (dropdownValue == null) dropdownValue = TranslationBase.of(context).lightActive1; ProjectViewModel projectViewModel = Provider.of(context); _weightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)]; _heightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)]; @@ -148,7 +149,16 @@ class _BmrCalculatorState extends State { showNewAppBarTitle: true, showNewAppBar: true, appBarTitle: TranslationBase.of(context).bmr, - showHomeAppBarIcon: true, + showHomeAppBarIcon: false, + appBarIcons: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 7.0), + child: Icon( + Icons.info_outline, + color: Colors.white, + ), + ) + ], body: Container( height: double.infinity, width: double.infinity, @@ -162,7 +172,7 @@ class _BmrCalculatorState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - TranslationBase.of(context).bmrDesc, + TranslationBase.of(context).calculateAmount, style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, @@ -347,7 +357,7 @@ class _BmrCalculatorState extends State { height: 18, child: DropdownButtonHideUnderline( child: DropdownButton( - value: dropdownValue, + value: dropdownValue, key: clinicDropdownKey, icon: Icon(Icons.arrow_downward), iconSize: 0, elevation: 16, @@ -363,14 +373,14 @@ class _BmrCalculatorState extends State { }); }, items: [ - TranslationBase.of(context).inactiveAct, - TranslationBase.of(context).light, - TranslationBase.of(context).very, - TranslationBase.of(context).superAct, + TranslationBase.of(context).almostInactive, + TranslationBase.of(context).lightActive1, + TranslationBase.of(context).veryActive, + TranslationBase.of(context).superActive ].map>((String value) { return DropdownMenuItem( value: value, - child: Text(value, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontSize: 11, letterSpacing: -0.44, fontWeight: FontWeight.w600)), + child: Text(value), ); }).toList(), ), @@ -397,12 +407,14 @@ class _BmrCalculatorState extends State { Container( margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), color: Colors.white, - child: DefaultButton( - TranslationBase.of(context).calculate, - () { + child: SecondaryButton( + label: TranslationBase.of(context).calculate, + color: CustomColors.accentColor, + onTap: () { setState(() { calculateBmr(); - calculateCalories(); + calculateCalories(context); + { Navigator.push( context, diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart index aee77829..4ef6ad08 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart @@ -5,7 +5,9 @@ import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -24,7 +26,6 @@ class BmrResultPage extends StatelessWidget { isShowDecPage: false, showNewAppBarTitle: true, showNewAppBar: true, - showHomeAppBarIcon: true, appBarTitle: TranslationBase.of(context).bmr, body: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, @@ -36,7 +37,7 @@ class BmrResultPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Calories", + TranslationBase.of(context).calories, style: TextStyle( fontSize: 19, letterSpacing: -1.34, @@ -64,7 +65,7 @@ class BmrResultPage extends StatelessWidget { height: 5.0, ), Text( - 'Calories', + TranslationBase.of(context).calories, style: TextStyle( fontSize: 18, letterSpacing: -1.08, @@ -79,23 +80,31 @@ class BmrResultPage extends StatelessWidget { ), mHeight(20), Text( - 'This means the body will burn (${bmrResult.toStringAsFixed(1)}) calories each day, if engaged in no activity for the entire day.. Note: Daily calorie requirement is (${calories.toStringAsFixed(1)}) calories, to maintain the current weight.', - style: TextStyle(fontSize: 14, letterSpacing: -0.56, fontWeight: FontWeight.w600, color: CustomColors.textColor), + TranslationBase.of(context).bodyWillBurn+' ( ${bmrResult.toStringAsFixed(1)} )'+TranslationBase.of(context).caloriesEachDay+'( ${calories.toStringAsFixed(1)} ) '+TranslationBase.of(context).maintainWeight, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + fontWeight: FontWeight.w600, + color: CustomColors.textColor + ), ), ], ).withBorderedContainer, ), mFlex(1), + Container( margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), color: Colors.white, - child: DefaultButton( - TranslationBase.of(context).viewDocList, - () { + child: SecondaryButton( + label: TranslationBase.of(context).viewDocList, + color: CustomColors.accentColor, + onTap: () { getDoctorsList(context); }, ), ), + ], ), ); @@ -154,19 +163,18 @@ class BmrResultPage extends StatelessWidget { }); } } - extension BorderedContainer on Widget { Widget get withBorderedContainer => Container( - padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - color: Colors.white, - border: Border.all( - color: Color(0xffefefef), - width: 1, - ), - ), - child: this, - ); -} + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: this, + ); +} \ No newline at end of file diff --git a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart index a7bdbe0e..6aab447a 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart @@ -175,7 +175,7 @@ class _BodyFatState extends State { } } - void showTextResult() { + void showTextResult(BuildContext context) { if (isMale == false) { if (bodyFat > 9 && bodyFat <= 13) { textResult = TranslationBase.of(context).essential; @@ -186,11 +186,11 @@ class _BodyFatState extends State { } else if (bodyFat > 24 && bodyFat <= 31) { textResult = TranslationBase.of(context).acceptable; } else if (bodyFat > 31 && bodyFat <= 60) { - textResult = TranslationBase.of(context).obeseBodyFat; + textResult = TranslationBase.of(context).underObese; } else if (bodyFat > 60) { - textResult = TranslationBase.of(context).more; + textResult = TranslationBase.of(context).crossedLimits; } else if (bodyFat <= 9) { - textResult = TranslationBase.of(context).less; + textResult = TranslationBase.of(context).lowLimits; } } else { if (bodyFat > 5 && fat <= 13) { @@ -200,11 +200,11 @@ class _BodyFatState extends State { } else if (bodyFat > 17 && bodyFat <= 24) { textResult = TranslationBase.of(context).fitness; } else if (bodyFat > 24 && bodyFat <= 45) { - textResult = TranslationBase.of(context).obeseBodyFat; + textResult = TranslationBase.of(context).underObese; } else if (bodyFat > 45) { - textResult = TranslationBase.of(context).more; + textResult = TranslationBase.of(context).crossedLimits; } else if (bodyFat <= 5) { - textResult = TranslationBase.of(context).less; + textResult = TranslationBase.of(context).lowLimits; } } } @@ -222,8 +222,16 @@ class _BodyFatState extends State { isShowDecPage: false, showNewAppBarTitle: true, showNewAppBar: true, - showHomeAppBarIcon: true, appBarTitle: TranslationBase.of(context).bodyFatTitle, + appBarIcons: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 7.0), + child: Icon( + Icons.info_outline, + color: Colors.white, + ), + ) + ], body: Column( children: [ Expanded( @@ -449,7 +457,7 @@ class _BodyFatState extends State { onTap: () { setState(() { calculateBodyFat(); - showTextResult(); + showTextResult(context); { Navigator.push( diff --git a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart index b47ca233..b7e00652 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart @@ -2,7 +2,8 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -84,8 +85,16 @@ class _CalorieCalculatorState extends State { isShowDecPage: false, showNewAppBar: true, showNewAppBarTitle: true, - showHomeAppBarIcon: true, appBarTitle: "${TranslationBase.of(context).calories} ${TranslationBase.of(context).calcHealth}", + appBarIcons: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 7.0), + child: Icon( + Icons.info_outline, + color: Colors.black, + ), + ) + ], body: Column( children: [ Expanded( @@ -252,6 +261,7 @@ class _CalorieCalculatorState extends State { SizedBox( height: 12.0, ), + InkWell( onTap: () { // dropdownKey.currentState; @@ -280,6 +290,7 @@ class _CalorieCalculatorState extends State { child: DropdownButtonHideUnderline( child: DropdownButton( value: dropdownValue, + key: clinicDropdownKey, icon: Icon(Icons.arrow_downward), iconSize: 0, elevation: 16, @@ -295,15 +306,14 @@ class _CalorieCalculatorState extends State { }); }, items: [ - TranslationBase.of(context).inactiveAct, - TranslationBase.of(context).light, - TranslationBase.of(context).very, - TranslationBase.of(context).superAct, + TranslationBase.of(context).almostInactive, + TranslationBase.of(context).lightActive, + TranslationBase.of(context).lightActive1, + TranslationBase.of(context).superActive, ].map>((String value) { return DropdownMenuItem( value: value, - child: Text(value, - style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontSize: 11, letterSpacing: -0.44, fontWeight: FontWeight.w600)), + child: Text(value), ); }).toList(), ), @@ -328,9 +338,10 @@ class _CalorieCalculatorState extends State { Container( margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), color: Colors.white, - child: DefaultButton( - TranslationBase.of(context).calculate, - () { + child: SecondaryButton( + label: TranslationBase.of(context).calculate, + color: CustomColors.accentColor, + onTap: () { setState(() { calculateCalories(); print(calories); diff --git a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart index 9202fdc2..68bd2d2c 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart @@ -5,7 +5,9 @@ import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -35,7 +37,7 @@ class CalorieResultPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - TranslationBase.of(context).calories, + TranslationBase.of(context).calories, style: TextStyle( fontSize: 19, letterSpacing: -1.34, @@ -73,14 +75,18 @@ class CalorieResultPage extends StatelessWidget { ], ), progressColor: CustomColors.accentColor, - backgroundColor: CustomColors.darkGreyColor, + backgroundColor: Colors.white, ), ), mHeight(20), Text( - TranslationBase.of(context).resultCalories.replaceAll("(#)", calorie.toStringAsFixed(1)), - // 'Daily intake is ${calorie.toStringAsFixed(1)} calories', - style: TextStyle(fontSize: 14, letterSpacing: -0.56, fontWeight: FontWeight.w600, color: CustomColors.textColor), + TranslationBase.of(context).dailyIntake+' ${calorie.toStringAsFixed(1)} '+TranslationBase.of(context).calories, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + fontWeight: FontWeight.w600, + color: CustomColors.textColor + ), ), ], ).withBorderedContainer, @@ -89,13 +95,15 @@ class CalorieResultPage extends StatelessWidget { Container( margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), color: Colors.white, - child: DefaultButton( - TranslationBase.of(context).viewDocList, - () { + child: SecondaryButton( + label: TranslationBase.of(context).viewDocList, + color: CustomColors.accentColor, + onTap: () { getDoctorsList(context); }, ), ), + ], ), ); diff --git a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart index 31990a6b..9f2c6842 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart @@ -171,7 +171,7 @@ class _CarbsState extends State { height: 18, child: DropdownButtonHideUnderline( child: DropdownButton( - value: dropdownValue, + value: dropdownValue, key: clinicDropdownKey, icon: Icon(Icons.arrow_downward), iconSize: 0, elevation: 16, diff --git a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart index 43019deb..44363734 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart @@ -91,10 +91,10 @@ class CarbsResult extends StatelessWidget { tableRow.add( TableRow( children: [ - Utils.tableColumnTitle("Description"), - Utils.tableColumnTitle("Protein"), - Utils.tableColumnTitle("Carbohydrate"), - Utils.tableColumnTitle("Fat"), + Utils.tableColumnTitle(TranslationBase.of(context).description), + Utils.tableColumnTitle(TranslationBase.of(context).Protein), + Utils.tableColumnTitle(TranslationBase.of(context).carbohydrate), + Utils.tableColumnTitle(TranslationBase.of(context).fat), ], ), ); @@ -102,10 +102,10 @@ class CarbsResult extends StatelessWidget { tableRow.add( TableRow( children: [ - Utils.tableColumnValue("Calories Per Day", isCapitable: false, mProjectViewModel: projectViewModel), - Utils.tableColumnValue(pCal.ceil().toString() + ' Cals', isCapitable: false, mProjectViewModel: projectViewModel), - Utils.tableColumnValue(cCal.ceil().toString() + ' Cals', isCapitable: false, mProjectViewModel: projectViewModel), - Utils.tableColumnValue(cCal.ceil().toString() + ' Cals', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(TranslationBase.of(context).calDay, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(pCal.ceil().toString() + ' '+TranslationBase.of(context).Cals, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(cCal.ceil().toString() + ' '+TranslationBase.of(context).Cals, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(cCal.ceil().toString() + ' '+TranslationBase.of(context).Cals, isCapitable: false, mProjectViewModel: projectViewModel), ], ), ); @@ -113,20 +113,20 @@ class CarbsResult extends StatelessWidget { tableRow.add( TableRow( children: [ - Utils.tableColumnValue("Grams Per Day", isCapitable: false, mProjectViewModel: projectViewModel), - Utils.tableColumnValue(pCalGram.ceil().toString() + ' gr', isCapitable: false, mProjectViewModel: projectViewModel), - Utils.tableColumnValue(cCalGram.ceil().toString() + ' gr', isCapitable: false, mProjectViewModel: projectViewModel), - Utils.tableColumnValue(fCalGram.ceil().toString() + ' gr', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(TranslationBase.of(context).gramsPerDay, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(pCalGram.ceil().toString() + ' '+TranslationBase.of(context).gr, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(cCalGram.ceil().toString() + ' '+TranslationBase.of(context).gr, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(fCalGram.ceil().toString() + ' '+TranslationBase.of(context).gr, isCapitable: false, mProjectViewModel: projectViewModel), ], ), ); tableRow.add( TableRow( children: [ - Utils.tableColumnValue('Grams Per Meal', isCapitable: false, mProjectViewModel: projectViewModel), - Utils.tableColumnValue(pCalMeal.ceil().toString() + ' gr', isCapitable: false, mProjectViewModel: projectViewModel), - Utils.tableColumnValue(cCalMeal.ceil().toString() + ' gr', isCapitable: false, mProjectViewModel: projectViewModel), - Utils.tableColumnValue(fCalMeal.ceil().toString() + ' gr', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(TranslationBase.of(context).gramsPerMeal, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(pCalMeal.ceil().toString() + ' '+TranslationBase.of(context).gr, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(cCalMeal.ceil().toString() + ' '+TranslationBase.of(context).gr, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(fCalMeal.ceil().toString() + ' '+TranslationBase.of(context).gr, isCapitable: false, mProjectViewModel: projectViewModel), ], ), ); diff --git a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart index 1ada0ca1..b8528ea6 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart @@ -1,6 +1,8 @@ +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -44,103 +46,114 @@ class _DeliveryDueState extends State { showNewAppBarTitle: true, isShowDecPage: false, appBarTitle: TranslationBase.of(context).pregnancyTitle, - body: Padding( - padding: EdgeInsets.symmetric(horizontal: 35.0, vertical: 20.0), - child: SingleChildScrollView( - child: Container( - child: Column( - children: [ - Texts( - TranslationBase.of(context).pregnancyDesc, - ), - Divider( - //height: 2, - thickness: 2, - ), - Column( + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + padding: EdgeInsets.symmetric(horizontal: 21.0, vertical: 21.0), + child: Column( children: [ - Texts( - TranslationBase.of(context).pregnancyDateLabel, + Text( + TranslationBase.of(context).pregnancyDesc, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + ), ), - InkWell( - onTap: () { - DatePicker.showDatePicker( - context, - showTitleActions: true, - minTime: DateTime(DateTime.now().year - 1, 1, 1), - maxTime: DateTime.now(), - onConfirm: (date) { - print('confirm $date'); - setState(() { - bloodSugarDate = date; - dateFrom = date.add(Duration(days: 10)); + Divider( + //height: 2, + thickness: 1, + ), + Column( + children: [ + Text( + TranslationBase.of(context).pregnancyDateLabel, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + ), + ), + InkWell( + onTap: () { + DatePicker.showDatePicker( + context, + showTitleActions: true, + minTime: DateTime(DateTime.now().year - 1, 1, 1), + maxTime: DateTime.now(), + onConfirm: (date) { + print('confirm $date'); + setState(() { + bloodSugarDate = date; + dateFrom = date.add(Duration(days: 10)); - dateTo = date.add(Duration(days: 20)); - conceivedDate = date.add(Duration(days: 14)); - deliveryDue = date.add(Duration(days: 280)); - firstTrimester = date.add(Duration(days: 85)); - secondTrimester = date.add(Duration(days: 190)); - thirdTrimester = date.add(Duration(days: 280)); - }); + dateTo = date.add(Duration(days: 20)); + conceivedDate = date.add(Duration(days: 14)); + deliveryDue = date.add(Duration(days: 280)); + firstTrimester = date.add(Duration(days: 85)); + secondTrimester = date.add(Duration(days: 190)); + thirdTrimester = date.add(Duration(days: 280)); + }); + }, + currentTime: DateTime.now(), + ); }, - currentTime: DateTime.now(), - ); - }, - child: Container( - padding: EdgeInsets.all(12), - margin: EdgeInsets.only(top: 15.0), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( + child: Container( + padding: EdgeInsets.all(12), + margin: EdgeInsets.only(top: 15.0), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Icon(Icons.date_range), - Texts(TranslationBase.of(context).date), + Row( + children: [ + Icon(Icons.date_range), + Texts(TranslationBase.of(context).date), + ], + ), + Texts(getDate()), ], ), - Texts(getDate()), - ], + ), ), - ), + ], ), + ], ), - SizedBox( - height: 280.0, - ), - Container( - height: 50.0, - width: 350.0, - child: DefaultButton( - TranslationBase.of(context).calculate, - () { - setState(() { - { - Navigator.push( - context, - FadePage( - page: DeliveryDueResult( - conceivedDate: conceivedDate, - dateFrom: dateFrom, - dateTo: dateTo, - deliveryDue: deliveryDue, - firstTrimester: firstTrimester, - secondTrimester: secondTrimester, - thirdTrimester: thirdTrimester, - )), - ); - } - }); - }, - ), - ), - ], + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).calculate, + color: CustomColors.accentColor, + onTap: () { + setState(() { + { + Navigator.push( + context, + FadePage( + page: DeliveryDueResult( + conceivedDate: conceivedDate, + dateFrom: dateFrom, + dateTo: dateTo, + deliveryDue: deliveryDue, + firstTrimester: firstTrimester, + secondTrimester: secondTrimester, + thirdTrimester: thirdTrimester, + )), + ); + } + }); + }, ), ), - ), + ], ), ); } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due_result_page.dart index b546426b..f7431d1a 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due_result_page.dart @@ -1,9 +1,12 @@ import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -29,78 +32,102 @@ class DeliveryDueResult extends StatelessWidget { showNewAppBarTitle: true, isShowDecPage: false, appBarTitle: TranslationBase.of(context).pregnancyTitle, - body: Padding( - padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 12.0), - child: SingleChildScrollView( - child: Container( - height: 750.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Texts( - TranslationBase.of(context).ovulationPeriod, - fontWeight: FontWeight.w400, - ), - Texts( - TranslationBase.of(context).from, - fontWeight: FontWeight.w400, - ), - Texts(DateFormat.yMMMEd().format(dateFrom), fontWeight: FontWeight.w800, fontSize: 21.0, color: Color(0xffC5272D)), - Texts( - TranslationBase.of(context).to, - fontWeight: FontWeight.w400, - ), - Texts(DateFormat.yMMMEd().format(dateTo), fontWeight: FontWeight.w800, fontSize: 21.0, color: Color(0xffC5272D)), - Texts( - TranslationBase.of(context).conceive, - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(conceivedDate), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - TranslationBase.of(context).firstTri, - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(firstTrimester), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - TranslationBase.of(context).secondTri, - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(secondTrimester), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - TranslationBase.of(context).thirdTri, - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(thirdTrimester), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Container( - width: 350, - child: DefaultButton( - TranslationBase.of(context).seeDoctorsList, - () { - getDoctorsList(context); - }, - ), - ), - ], + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + padding: EdgeInsets.symmetric(horizontal: 21.0, vertical: 21.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Text( + TranslationBase.of(context).pregnancyTitle, + style: TextStyle( + fontSize: 19, + letterSpacing: -1.14, + fontWeight: FontWeight.w600, + ), + ), + Text( + TranslationBase.of(context).ovulationPeriod, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + fontWeight: FontWeight.w600, + color: CustomColors.textColor, + ), + ), + mHeight(20), + showItem(TranslationBase.of(context).from, DateFormat.yMMMEd().format(dateFrom), titleColor: CustomColors.accentColor), + mHeight(12), + showItem(TranslationBase.of(context).to, DateFormat.yMMMEd().format(dateTo), titleColor: CustomColors.accentColor), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + showItem(TranslationBase.of(context).conceive, DateFormat.yMMMEd().format(conceivedDate)), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + showItem(TranslationBase.of(context).firstTri, DateFormat.yMMMEd().format(firstTrimester)), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + showItem(TranslationBase.of(context).secondTri, DateFormat.yMMMEd().format(secondTrimester)), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + showItem(TranslationBase.of(context).thirdTri, DateFormat.yMMMEd().format(thirdTrimester)), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + ], + ).withBorderedContainer, + ), ), ), - ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).seeDoctorsList, + color: CustomColors.accentColor, + onTap: () { + getDoctorsList(context); + }, + ), + ), + ], + ), + ); + } + + Widget showItem(String title, String value, {Color titleColor}) { + return Container( + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + color: titleColor ?? Colors.black, + fontWeight: FontWeight.w500, + // fontWeight: FontWeight.w600, + ), + ), + Text( + value, + style: TextStyle( + fontSize: 18, + letterSpacing: -1.08, + fontWeight: FontWeight.w600, + ), + ), + ], ), ); } @@ -145,20 +172,11 @@ class DeliveryDueResult extends StatelessWidget { if (doctorByHospital.length != 0) { _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); } else { - _patientDoctorAppointmentListHospital - .add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: "0", patientDoctorAppointment: element)); + _patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: "0", patientDoctorAppointment: element)); } }); - Navigator.push( - context, - FadePage( - page: SearchResults( - isLiveCareAppointment: false, - doctorsList: doctorsList, - patientDoctorAppointmentListHospital: - _patientDoctorAppointmentListHospital))); - + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: doctorsList, patientDoctorAppointmentListHospital: _patientDoctorAppointmentListHospital))); } } }).catchError((err) { @@ -167,3 +185,19 @@ class DeliveryDueResult extends StatelessWidget { }); } } + +extension BorderedContainer on Widget { + Widget get withBorderedContainer => Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: this, + ); +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart index 24ca617b..a594846e 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart @@ -1,13 +1,11 @@ -import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:provider/provider.dart'; import 'ideal_body_result_page.dart'; @@ -36,7 +34,7 @@ class _IdealBodyState extends State { double overWeightBy; int weight = 0; double idealWeight = 0; - String dropdownValue = TranslationBase.of(AppGlobal.context).bodyFrameMedium; + String dropdownValue = null; double calories = 0; String textResult = ''; double maxIdealWeight; @@ -54,15 +52,17 @@ class _IdealBodyState extends State { List _heightPopupList = List(); List _weightPopupList = List(); + + void calculateIdealWeight() { heightInches = int.parse(_heightController.text) * .39370078740157477; heightFeet = heightInches / 12; idealWeight = (50 + 2.3 * (heightInches - 60)); - if (dropdownValue == TranslationBase.of(context).bodyFrameSmall) { + if (dropdownValue == TranslationBase.of(context).smallFinger) { idealWeight = idealWeight - 10; - } else if (dropdownValue == TranslationBase.of(context).bodyFrameMedium) { + } else if (dropdownValue == TranslationBase.of(context).mediumFinger) { idealWeight = idealWeight; - } else if (dropdownValue == TranslationBase.of(context).bodyFrameLarge) { + } else if (dropdownValue == TranslationBase.of(context).largeFinger) { idealWeight = idealWeight + 10; } @@ -75,7 +75,8 @@ class _IdealBodyState extends State { @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + if(dropdownValue==null) + dropdownValue=TranslationBase.of(context).mediumFinger; _weightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)]; _heightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)]; @@ -85,7 +86,16 @@ class _IdealBodyState extends State { showNewAppBarTitle: true, showNewAppBar: true, appBarTitle: TranslationBase.of(context).idealBody, - showHomeAppBarIcon: true, + showHomeAppBarIcon: false, + appBarIcons: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 7.0), + child: Icon( + Icons.info_outline, + color: Colors.white, + ), + ) + ], body: Column( children: [ Expanded( @@ -95,7 +105,7 @@ class _IdealBodyState extends State { child: Column( children: [ Text( - TranslationBase.of(context).idealWeightDesc, + TranslationBase.of(context).idealBodyWeight, style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, @@ -178,7 +188,7 @@ class _IdealBodyState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - TranslationBase.of(context).bodyFrame, + TranslationBase.of(context).bodyFrameSize, style: TextStyle( fontSize: 11, letterSpacing: -0.44, @@ -190,7 +200,7 @@ class _IdealBodyState extends State { child: DropdownButtonHideUnderline( child: DropdownButton( value: dropdownValue, - icon: Icon(Icons.arrow_downward), + icon: Icon(Icons.arrow_downward), key: clinicDropdownKey, iconSize: 0, elevation: 16, isExpanded: true, @@ -205,14 +215,13 @@ class _IdealBodyState extends State { }); }, items: [ - TranslationBase.of(context).bodyFrameSmall, - TranslationBase.of(context).bodyFrameMedium, - TranslationBase.of(context).bodyFrameLarge, + TranslationBase.of(context).smallFinger, + TranslationBase.of(context).mediumFinger, + TranslationBase.of(context).largeFinger, ].map>((String value) { return DropdownMenuItem( value: value, - child: Text(value, - style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontSize: 11, letterSpacing: -0.44, fontWeight: FontWeight.w600)), + child: Text(value), ); }).toList(), ), @@ -500,3 +509,5 @@ class CommonDropDownView extends StatelessWidget { ); } } + + diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart index 6eec6dd8..a29d4bf0 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart @@ -40,7 +40,7 @@ class IdealBodyResult extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'Ideal weight range is', + TranslationBase.of(context).idealWeightRange, style: TextStyle( fontSize: 19, letterSpacing: -1.34, @@ -60,7 +60,7 @@ class IdealBodyResult extends StatelessWidget { Padding( padding: EdgeInsets.only(top: 8.0, left: 4.0), child: Text( - 'Kg', + " "+TranslationBase.of(context).kg+" ", style: TextStyle(color: Colors.red), ), ), @@ -80,7 +80,7 @@ class IdealBodyResult extends StatelessWidget { Padding( padding: EdgeInsets.only(top: 8.0, left: 4.0), child: Text( - 'Kg', + " "+TranslationBase.of(context).kg+" ", style: TextStyle(color: Colors.red), ), ), @@ -93,7 +93,7 @@ class IdealBodyResult extends StatelessWidget { ? Column( children: [ Texts( - 'Congratulations! The current weight is perfect and considered healthy', + TranslationBase.of(context).currentWeightPerfect, fontSize: 20.0, ), ], @@ -101,9 +101,9 @@ class IdealBodyResult extends StatelessWidget { : overWeightBy > 10 && overWeightBy < 17 ? Column( children: [ - Texts('This means that the weight is a little bit more than ideal weight by'), + Texts(TranslationBase.of(context).littleBitWeightMore), Texts(overWeightBy.toStringAsFixed(1)), - Texts('May wish to consult with the doctor for medical help. Click to view our list of Doctors'), + Texts(TranslationBase.of(context).consultWithDoctor), ], ) : overWeightBy >= 18 @@ -112,7 +112,7 @@ class IdealBodyResult extends StatelessWidget { child: Column( children: [ Texts( - 'Means that you suffer from excessive obesity by', + TranslationBase.of(context).excessiveObesity, ), SizedBox( height: 12.0, @@ -128,7 +128,7 @@ class IdealBodyResult extends StatelessWidget { SizedBox( height: 12.0, ), - Texts('May wish to consult with the doctor for medical help. Click to view our list of\n Doctors'), + Texts(TranslationBase.of(context).mayWish), ], ), ) @@ -139,7 +139,7 @@ class IdealBodyResult extends StatelessWidget { Padding( padding: const EdgeInsets.all(8.0), child: Texts( - 'Under Weight', + TranslationBase.of(context).underWeight, fontSize: 18.0, ), ), @@ -161,7 +161,7 @@ class IdealBodyResult extends StatelessWidget { child: Column( children: [ Text( - 'under wheight', + TranslationBase.of(context).underWeight, style: TextStyle( fontSize: 17, fontWeight: FontWeight.bold, @@ -182,7 +182,7 @@ class IdealBodyResult extends StatelessWidget { SizedBox( height: 12.0, ), - Texts('May wish to consult with the doctor for medical help. Click to view our list of Doctors'), + Texts(TranslationBase.of(context).mayWish), ], ), ), diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart index 86699ed4..69894df3 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart @@ -1,6 +1,8 @@ +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -20,8 +22,9 @@ class _OvulationPeriodState extends State { DateTime bloodSugarDate = DateTime.now(); DateTime timeSugarDate = DateTime.now(); DateTime selectedDateTime = DateTime.now(); - int cycleLength = 0; - int lutealPhaseLength = 0; + + // int cycleLength = 0; + // int lutealPhaseLength = 0; String selectedDate; var dateFrom = DateTime.now(); var babyAgeWeeks; @@ -33,6 +36,9 @@ class _OvulationPeriodState extends State { var newFormat = DateFormat("yy-MM-dd"); String updatedDt; + TextEditingController cycleLengthController = new TextEditingController(); + TextEditingController lutelLengthController = new TextEditingController(); + String getTime() { return " ${timeSugarDate.hour}:${timeSugarDate.minute}"; } @@ -64,286 +70,176 @@ class _OvulationPeriodState extends State { showNewAppBarTitle: true, isShowDecPage: false, appBarTitle: TranslationBase.of(context).ovulation, - body: Padding( - padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0), - child: SingleChildScrollView( - child: Container( - height: 700.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(TranslationBase.of(context).ovulationDesc), - SizedBox( - height: 12.0, - ), - Divider( - //height: 2, - thickness: 2, - ), - SizedBox( - height: 12.0, - ), - InkWell( - onTap: () { - DatePicker.showDatePicker( - context, - showTitleActions: true, - minTime: DateTime(DateTime.now().year - 1, 1, 1), - maxTime: DateTime.now(), - onConfirm: (date) { - print('confirm $date'); - setState(() { - selectedDateTime = date; - }); - }, - currentTime: DateTime.now(), - ); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(TranslationBase.of(context).date), - Texts(getDate()), - ], - ), - ), - ), - SizedBox( - height: 5.0, - ), - Texts( - TranslationBase.of(context).cycleLabel, - fontWeight: FontWeight.w400, - ), - SizedBox( - height: 5.0, - ), - Row( + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + padding: EdgeInsets.all(21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: 340.0, - height: 60.0, - decoration: BoxDecoration( - color: Colors.white, + Text( + TranslationBase.of(context).ovulationDesc, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.54, + color: Colors.black, + fontWeight: FontWeight.w600, ), - child: Row( - children: [ - Padding( - padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 8.0), - child: Center( - child: Container( - width: 60.0, - foregroundDecoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - border: Border.all( - color: Colors.blueGrey, - width: 2.0, - ), - ), - child: Row( - children: [ - Expanded( - child: Center( - child: Text(cycleLength.toString()), - ), - ), - Container( - height: 38.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - if (cycleLength < 45) cycleLength++; - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - if (cycleLength > 0) cycleLength--; - }); - }, - ), - ], - ), - ), - ], - ), - ), - ), - ), - Expanded( - child: Slider( - value: cycleLength.toDouble(), - min: 0, - max: 45, - onChanged: (double newValue) { - setState(() { - cycleLength = newValue.round(); - }); - }, - activeColor: Color(0xffC5272D), - inactiveColor: Color(0xffF3C5C6), - ), - ), - ], + ), + SizedBox( + height: 12.0, + ), + InkWell( + onTap: () { + DatePicker.showDatePicker( + context, + showTitleActions: true, + minTime: DateTime(DateTime.now().year - 1, 1, 1), + maxTime: DateTime.now(), + onConfirm: (date) { + print('confirm $date'); + setState(() { + selectedDateTime = date; + }); + }, + currentTime: DateTime.now(), + ); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(TranslationBase.of(context).date), + Texts(getDate()), + ], + ), ), ), + SizedBox( + height: 12.0, + ), + inputWidget(TranslationBase.of(context).cycleLabel, "0", cycleLengthController), + SizedBox( + height: 12.0, + ), + inputWidget(TranslationBase.of(context).lutealLabel, "0", lutelLengthController), ], ), - Texts( - TranslationBase.of(context).lutealLabel, - fontWeight: FontWeight.w400, - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Container( - width: 340.0, - height: 60.0, - decoration: BoxDecoration( - color: Colors.white, + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).calculate, + color: CustomColors.accentColor, + onTap: () { + calculateBabyInformation(); + Navigator.push( + context, + FadePage( + page: OvulationResult( + conceivedDate: conceivedDate, + dateFrom: dateFrom, + dateTo: dateTo, + deliveryDue: deliveryDue, + babyAge: babyAgeWeeks, + babyAgeDays: babyAgeDays, + ), + ), + ); + }, + ), + ), + ], + ), + ); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.number, + controller: _controller, + onChanged: (value) => {}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, ), - child: Row( - children: [ - Padding( - padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 8.0), - child: Center( - child: Container( - width: 60.0, - foregroundDecoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - border: Border.all( - color: Colors.blueGrey, - width: 2.0, - ), - ), - child: Row( - children: [ - Expanded( - child: Center( - child: Text(lutealPhaseLength.toString()), - ), - ), - Container( - height: 38.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - if (lutealPhaseLength < 15) lutealPhaseLength++; - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - if (lutealPhaseLength > 0) lutealPhaseLength--; - }); - }, - ), - ], - ), - ), - ], - ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, ), ), - ), - Expanded( - child: Slider( - value: lutealPhaseLength.toDouble(), - min: 0, - max: 15, - onChanged: (double newValue) { - setState(() { - lutealPhaseLength = newValue.round(); - }); - }, - activeColor: Color(0xffC5272D), - inactiveColor: Color(0xffF3C5C6), - ), - ), - ], - ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, ), - ], - ), - SizedBox( - height: 220.0, - ), - Container( - height: 50.0, - width: 350.0, - child: DefaultButton( - TranslationBase.of(context).calculate, - () { - calculateBabyInformation(); - Navigator.push( - context, - FadePage( - page: OvulationResult( - conceivedDate: conceivedDate, - dateFrom: dateFrom, - dateTo: dateTo, - deliveryDue: deliveryDue, - babyAge: babyAgeWeeks, - babyAgeDays: babyAgeDays, - )), - ); - }, ), - ), - ], + ], + ), ), - ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], ), ), ); diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart index bc345711..67ec7dea 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart @@ -1,9 +1,12 @@ import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -26,6 +29,7 @@ class OvulationResult extends StatelessWidget { this.babyAge, this.babyAgeDays, }); + //var newFormat = DateFormat("yy-MM-dd"); @override @@ -35,81 +39,105 @@ class OvulationResult extends StatelessWidget { showNewAppBarTitle: true, isShowDecPage: false, appBarTitle: TranslationBase.of(context).ovulation, - body: Padding( - padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 15.0), - child: SingleChildScrollView( - child: Container( - height: 750.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Texts( - 'The next ovulation period is estimated to be:', - fontWeight: FontWeight.w400, - ), - Texts( - 'From:', - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(dateFrom), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - 'To:', - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(dateTo), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - 'Useful Information:', - color: Color(0xffC5272D), - ), - Texts( - 'You have conceived on:', - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(conceivedDate), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - 'The baby\'s age right now:', - fontWeight: FontWeight.w400, - ), - Texts( - babyAge <= 0 ? "baby age is not available" : babyAge.toString() + " Weeks", - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - 'The delivery due date is estimated to be on the: ', - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(deliveryDue), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Container( - width: 350, - child: DefaultButton( - TranslationBase.of(context).seeDoctorsList, - () { - getDoctorsList(context); - }, - ), - ), - ], + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).ovulation, + style: TextStyle( + fontSize: 19, + letterSpacing: -1.14, + fontWeight: FontWeight.w600, + ), + ), + mHeight(20), + Text( + TranslationBase.of(context).ovulationPeriod, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + fontWeight: FontWeight.w600, + color: CustomColors.textColor, + ), + ), + mHeight(20), + showItem(TranslationBase.of(context).from, DateFormat.yMMMEd().format(dateFrom), titleColor: CustomColors.accentColor), + mHeight(12), + showItem(TranslationBase.of(context).to, DateFormat.yMMMEd().format(dateTo), titleColor: CustomColors.accentColor), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + Text( + TranslationBase.of(context).useFullInfo, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + color: CustomColors.accentColor, + fontWeight: FontWeight.w500, + ), + ), + mHeight(12), + showItem(TranslationBase.of(context).conceive, DateFormat.yMMMEd().format(conceivedDate)), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + showItem(TranslationBase.of(context).babyAge, babyAge <= 0 ? TranslationBase.of(context).babyAgeAvail : babyAge.toString() + TranslationBase.of(context).week), + + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), showItem(TranslationBase.of(context).deliveryDue, DateFormat.yMMMEd().format(deliveryDue)), + ], + ).withBorderedContainer, + ), ), ), - ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).viewDocList, + color: CustomColors.accentColor, + onTap: () { + getDoctorsList(context); + }, + ), + ), + ], + ), + ); + } + + Widget showItem(String title, String value, {Color titleColor}) { + return Container( + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + color: titleColor ?? Colors.black, + fontWeight: FontWeight.w500, + // fontWeight: FontWeight.w600, + ), + ), + Text( + value, + style: TextStyle( + fontSize: 18, + letterSpacing: -1.08, + fontWeight: FontWeight.w600, + ), + ), + ], ), ); } @@ -148,26 +176,17 @@ class OvulationResult extends StatelessWidget { List doctorByHospital = _patientDoctorAppointmentListHospital .where( (elementClinic) => elementClinic.filterName == element.projectName, - ) + ) .toList(); if (doctorByHospital.length != 0) { _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); } else { - _patientDoctorAppointmentListHospital - .add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: "0", patientDoctorAppointment: element)); + _patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: "0", patientDoctorAppointment: element)); } }); - Navigator.push( - context, - FadePage( - page: SearchResults( - isLiveCareAppointment: false, - doctorsList: doctorsList, - patientDoctorAppointmentListHospital: - _patientDoctorAppointmentListHospital))); - + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: doctorsList, patientDoctorAppointmentListHospital: _patientDoctorAppointmentListHospital))); } } }).catchError((err) { @@ -175,5 +194,20 @@ class OvulationResult extends StatelessWidget { print(err); }); } +} +extension BorderedContainer on Widget { + Widget get withBorderedContainer => Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: this, + ); } diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 585e862d..bdf387d6 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -88,6 +88,7 @@ class _BookConfirmState extends State { null, widget.doctor.noOfPatientsRate, "", + ), isNeedToShowButton: false, ), diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index 794ece31..1e2e48df 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -78,7 +78,8 @@ class DoctorView extends StatelessWidget { if (doctor.projectName != null) MyRichText(TranslationBase.of(context).branch, doctor.projectName, projectViewModel.isArabic), if (doctor.speciality != null) Text( - getDoctorSpeciality(this.doctor.speciality).trim(), + this.doctor.speciality[0].trim(), + // getDoctorSpeciality(this.doctor.speciality).trim(), style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12), ), if (doctor.nearestFreeSlot != null) diff --git a/lib/pages/DrawerPages/family/add-family-member.dart b/lib/pages/DrawerPages/family/add-family-member.dart index 9fb20630..6d9064d7 100644 --- a/lib/pages/DrawerPages/family/add-family-member.dart +++ b/lib/pages/DrawerPages/family/add-family-member.dart @@ -1,7 +1,6 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/model/family-file/add_family_file_request.dart'; -import 'package:diplomaticquarterapp/core/model/family-file/insert_share_file_request.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; @@ -17,7 +16,6 @@ import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; -import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -41,6 +39,7 @@ class _AddMember extends State { var familyFileProvider = FamilyFilesProvider(); var patientShareRequestID; + var patientShareResponseID; @override void initState() { @@ -50,67 +49,71 @@ class _AddMember extends State { @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: TranslationBase.of(context).myFamilyFiles, - isShowAppBar: true, - showNewAppBar: true, - showNewAppBarTitle: true, - body: isLoading == true - ? AppCircularProgressIndicator() - : SingleChildScrollView( - child: Container( - padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), + appBarTitle: TranslationBase.of(context).myFamilyFiles, + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + body: isLoading == true + ? AppCircularProgressIndicator() + : SingleChildScrollView( + child: Container( + padding: EdgeInsets.all(21.0), height: SizeConfig.realScreenHeight * .9, width: SizeConfig.realScreenWidth, - child: Column(children: [ - Expanded( - flex: 2, - child: AppText( - TranslationBase.of(context).enterNationalId, - fontSize: SizeConfig.textMultiplier * 3.5, - textAlign: TextAlign.left, - )), - Expanded( - flex: 4, - child: Column( - // mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - PhoneNumberSelectorWidget(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value), - //MobileNo(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value), - // Container( - // child: TextFields( - // controller: nationalIDorFile, - // onChanged: (value) => {validateForm()}, - // prefixIcon: Icon(loginType == 1 ? Icons.chrome_reader_mode : Icons.receipt, color: Colors.red), - // padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10), - // hintText: loginType == 1 ? TranslationBase.of(context).nationalID : TranslationBase.of(context).fileNo, - // )) - SizedBox( - height: 12, - ), - inputWidget(loginType == 1 ? TranslationBase.of(context).nationalIdNumber : TranslationBase.of(context).medicalFileNumber, "Xxxxxxxxx", nationalIDorFile), - ], - ), - ), - Expanded( - flex: 3, + child: Column( + children: [ + Expanded( + flex: 1, + child: Text( + loginType == 1 ? TranslationBase.of(context).enterNationalId : TranslationBase.of(context).enterFile, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + )), + Expanded( + flex: 4, child: Column( - mainAxisAlignment: MainAxisAlignment.end, children: [ - Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).add, - () => {this.addMember()}, - color: isButtonDisabled == true ? Colors.grey : CustomColors.accentColor, - textColor: Colors.white, - )) - ], + PhoneNumberSelectorWidget(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value), + SizedBox( + height: 12, ), + inputWidget(loginType == 1 ? TranslationBase.of(context).nationalIdNumber : TranslationBase.of(context).medicalFileNumber, "Xxxxxxxxx", nationalIDorFile), ], - )) - ]), - ))); + ), + ), + // Expanded( + // flex: 3, + // child: Column( + // mainAxisAlignment: MainAxisAlignment.end, + // children: [ + // Row( + // children: [ + // Expanded( + // child: DefaultButton( + // TranslationBase.of(context).add, + // () => {this.addMember()}, + // color: isButtonDisabled == true ? Colors.grey : CustomColors.accentColor, + // textColor: Colors.white, + // ), + // ) + // ], + // ), + // ], + // ), + // ) + ], + ), + ), + ), + bottomSheet: Container( + color: Colors.white, + padding: EdgeInsets.all(21.0), + child: DefaultButton( + TranslationBase.of(context).add, + () => {this.addMember()}, + color: isButtonDisabled == true ? Colors.grey : CustomColors.accentColor, + textColor: Colors.white, + )), + ); } void validateForm() { @@ -158,31 +161,30 @@ class _AddMember extends State { } insertFamilyData(addMemberResult) { - var request = InsertSharePatientFileReq(); - request.responseID = addMemberResult['ShareFamilyFileObj']['ReponseID']; - request.shareFamilyPatientName = addMemberResult['ShareFamilyFileObj']['SharedPatientName']; - request.status = 2; - if (request.patientOutSA == 1) { - request.regionID = 2; - } else { - request.regionID = 1; - } - loading(true); - familyFileProvider.insertNewMember(request).then((value) => sendActivationCode(value)).catchError((err){ - loading(false); - AppToast.showErrorToast(message: err); - }); + sendActivationCode(addMemberResult); + // var request = InsertSharePatientFileReq(); + // request.responseID = addMemberResult['ShareFamilyFileObj']['ReponseID']; + // request.shareFamilyPatientName = addMemberResult['ShareFamilyFileObj']['SharedPatientName']; + // request.status = 2; + // if (request.patientOutSA == 1) { + // request.regionID = 2; + // } else { + // request.regionID = 1; + // } + // loading(true); + // familyFileProvider.insertNewMember(request).then((value) => sendActivationCode(value)).catchError((err) { + // loading(false); + // AppToast.showErrorToast(message: err); + // }); } sendActivationCode(result) { // var request = this.getCommonRequest(); loading(true); - patientShareRequestID = result['PatientShareRequestID']; - familyFileProvider.sendActivationCode(mobileNo, countryCode, nationalIDorFile.text).then((result) => { - if (result != null && result['isSMSSent'] == true) {this.startSMSService(1, result)} - // {loading(false), this.startSMSService(type)} - // else - // {loading(false)} + patientShareResponseID = result['ShareFamilyFileObj']['ReponseID']; + familyFileProvider.sendActivationCode(mobileNo, countryCode, nationalIDorFile.text, patientShareResponseID).then((res) => { + patientShareRequestID = res['PatientShareRequestID'], + if (res != null && res['isSMSSent'] == true) {this.startSMSService(1, res)} }); } @@ -207,7 +209,7 @@ class _AddMember extends State { checkActivationCode(value, result) { Navigator.pop(context); GifLoaderDialogUtils.showMyDialog(context); - familyFileProvider.checkActivationCode(result['LogInTokenID'], value, nationalIDorFile.text, mobileNo).then((result) { + familyFileProvider.checkActivationCode(result['LogInTokenID'], value, nationalIDorFile.text, mobileNo, patientShareRequestID, patientShareResponseID).then((result) { SMSOTP.hideSMSBox(context); handleFamilyRequests(this.patientShareRequestID, 3); }).catchError((err) { @@ -219,12 +221,12 @@ class _AddMember extends State { } handleFamilyRequests(id, stauts) { - familyFileProvider.acceptAndRejectRecievedRequests(id, stauts).then((result) => { - sharedPref.remove(FAMILY_FILE), - Navigator.of(context).pushNamed( - MY_FAMILIY, - ) - }); + // familyFileProvider.acceptAndRejectRecievedRequests(id, stauts).then((result) => { + sharedPref.remove(FAMILY_FILE); + Navigator.of(context).pushNamed( + MY_FAMILIY, + ); + // }); } loading(flag) { diff --git a/lib/pages/DrawerPages/family/add-family_type.dart b/lib/pages/DrawerPages/family/add-family_type.dart index 533669c7..60e396c6 100644 --- a/lib/pages/DrawerPages/family/add-family_type.dart +++ b/lib/pages/DrawerPages/family/add-family_type.dart @@ -26,11 +26,11 @@ class AddFamilyMemberType extends StatelessWidget { padding: EdgeInsets.zero, physics: BouncingScrollPhysics(), children: [ - SizedBox(height: 12), + SizedBox(height: 21), HabibLogoWidget(), - SizedBox(height: 50), + SizedBox(height: 21), Text( - TranslationBase.of(context).logintypeRadio, + TranslationBase.of(context).registerInfoFamily, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), ), GridView( diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index 1d2b470b..f3658fae 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -27,7 +27,6 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; @@ -159,113 +158,115 @@ class _MyFamily extends State with TickerProviderStateMixin { if (snapshot.hasError) return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable)); else - return ListView.separated( - itemBuilder: (context, index) { - if (snapshot.data.getAllSharedRecordsByStatusList[index].status == 3) - return Container( - margin: EdgeInsets.all(5), - decoration: cardRadius( - 15, - elevation: 0, - color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0xffFDA4B0) : Color(0xff6EA8FF), - ), - child: Container( - // height: 130,0xffFDA4B0 - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - snapshot.data.getAllSharedRecordsByStatusList[index].patientName.toLowerCase().capitalizeFirstofEach, - fontSize: 18, - fontWeight: FontWeight.bold, - color: Colors.white, - ), - Texts(TranslationBase.of(context).fileNumber + ': ' + snapshot.data.getAllSharedRecordsByStatusList[index].responseID.toString(), - fontSize: 12, color: Colors.white), - Texts( - snapshot.data.getAllSharedRecordsByStatusList[index].age.toString() + - ' ' + - TranslationBase.of(context).years + - ', ' + - snapshot.data.getAllSharedRecordsByStatusList[index].genderDescription, - fontSize: 12, - color: Colors.white), - ], - ), - Column( + return checkActive(snapshot.data.getAllSharedRecordsByStatusList) > 0 + ? ListView.separated( + itemBuilder: (context, index) { + if (snapshot.data.getAllSharedRecordsByStatusList[index].status == 3) + return Container( + margin: EdgeInsets.all(5), + decoration: cardRadius( + 15, + elevation: 0, + color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0xffFDA4B0) : Color(0xff6EA8FF), + ), + child: Container( + // height: 130,0xffFDA4B0 + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - SizedBox(height: 10), - InkWell( - onTap: () { - switchUser(snapshot.data.getAllSharedRecordsByStatusList[index], context); - }, - child: Container( - decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)), - padding: EdgeInsets.fromLTRB(15, 10, 15, 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SvgPicture.asset("assets/images/new-design/switch.svg", - height: 22, color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white), - SizedBox( - width: 5, - ), - // CupertinoSwitch( - // value: isSwitchUser, - // onChanged: (value) { - // setState(() { - // isSwitchUser = value; - // }); - // if (isSwitchUser == true) switchUser(snapshot.data.getAllSharedRecordsByStatusList[index], context); - // }, - // ), - Texts(TranslationBase.of(context).switchUser, - color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white, - fontSize: 12, - fontWeight: FontWeight.w600) - ], - ))), - SizedBox( - height: 10, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + snapshot.data.getAllSharedRecordsByStatusList[index].patientName.toLowerCase().capitalizeFirstofEach, + fontSize: 18, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + Texts(TranslationBase.of(context).fileNumber + ': ' + snapshot.data.getAllSharedRecordsByStatusList[index].responseID.toString(), + fontSize: 12, color: Colors.white), + Texts( + snapshot.data.getAllSharedRecordsByStatusList[index].age.toString() + + ' ' + + TranslationBase.of(context).years + + ', ' + + snapshot.data.getAllSharedRecordsByStatusList[index].genderDescription, + fontSize: 12, + color: Colors.white), + ], + ), + Column( + children: [ + SizedBox(height: 10), + InkWell( + onTap: () { + switchUser(snapshot.data.getAllSharedRecordsByStatusList[index], context); + }, + child: Container( + decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)), + padding: EdgeInsets.fromLTRB(15, 10, 15, 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SvgPicture.asset("assets/images/new-design/switch.svg", + height: 22, color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white), + SizedBox( + width: 5, + ), + // CupertinoSwitch( + // value: isSwitchUser, + // onChanged: (value) { + // setState(() { + // isSwitchUser = value; + // }); + // if (isSwitchUser == true) switchUser(snapshot.data.getAllSharedRecordsByStatusList[index], context); + // }, + // ), + Texts(TranslationBase.of(context).switchUser, + color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white, + fontSize: 12, + fontWeight: FontWeight.w600) + ], + ))), + SizedBox( + height: 10, + ), + InkWell( + onTap: () { + deleteFamily(snapshot.data.getAllSharedRecordsByStatusList[index], context); + }, + child: Container( + decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)), + padding: EdgeInsets.fromLTRB(15, 10, 15, 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SvgPicture.asset("assets/images/new-design/delete.svg", + height: 22, color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white), + SizedBox( + width: 5, + ), + Texts(TranslationBase.of(context).delete, + color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white, + fontSize: 12, + fontWeight: FontWeight.w600), + ], + ))), + SizedBox(height: 10), + ], ), - InkWell( - onTap: () { - deleteFamily(snapshot.data.getAllSharedRecordsByStatusList[index], context); - }, - child: Container( - decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)), - padding: EdgeInsets.fromLTRB(15, 10, 15, 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SvgPicture.asset("assets/images/new-design/delete.svg", - height: 22, color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white), - SizedBox( - width: 5, - ), - Texts(TranslationBase.of(context).delete, - color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white, - fontSize: 12, - fontWeight: FontWeight.w600), - ], - ))), - SizedBox(height: 10), ], - ), - ], - ))); - else if (checkActive(snapshot.data.getAllSharedRecordsByStatusList) == 0) - return getNoDataWidget(context); - else - return SizedBox(height: 0); - }, - separatorBuilder: (context, index) => SizedBox(height: 0), - itemCount: snapshot.data.getAllSharedRecordsByStatusList.length); + ))); + // else if (checkActive(snapshot.data.getAllSharedRecordsByStatusList) == 0) + // return getNoDataWidget(context); + else + return SizedBox(height: 0); + }, + separatorBuilder: (context, index) => SizedBox(height: 0), + itemCount: snapshot.data.getAllSharedRecordsByStatusList.length) + : getNoDataWidget(context); } }, ), @@ -290,176 +291,98 @@ class _MyFamily extends State with TickerProviderStateMixin { child: Column( children: [ FractionallySizedBox( - widthFactor: 1.0, - child: AppExpandableNotifier( - title: TranslationBase.of(context).userViewRequest, - bodyWidget: FutureBuilder( - future: getUserViewRequest(), // async work - builder: (BuildContext context, AsyncSnapshot snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return SizedBox(); + widthFactor: 1.0, + child: AppExpandableNotifier( + title: TranslationBase.of(context).userViewRequest, + bodyWidget: FutureBuilder( + future: getUserViewRequest(), // async work + builder: (BuildContext context, AsyncSnapshot snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.waiting: + return SizedBox(); - default: - if (snapshot.hasError) - return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable)); - else - return ListView.separated( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), - itemBuilder: (context, _index) { - return Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - border: Border.all(width: 1, color: Color(0xffEFEFEF)), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - //spreadRadius: 5, - blurRadius: 27, - offset: Offset(0, -3), - ), - ], - color: Colors.white), - child: Column( - children: [ - Column(children: [ - Padding( - padding: EdgeInsets.all(10), - child: Row(children: [ - Expanded(flex: 3, child: AppText(TranslationBase.of(context).name, fontWeight: FontWeight.w600)), - Expanded(flex: 1, child: AppText(TranslationBase.of(context).allow, fontWeight: FontWeight.w600)), - Expanded(flex: 1, child: AppText(TranslationBase.of(context).reject, fontWeight: FontWeight.w600)), - ])), - Padding( - padding: const EdgeInsets.only(left: 10.0, right: 10.0), - child: Divider(color: Colors.black, height: 1.5, thickness: 1.5), - ), - Column( - children: familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.map((result) { - return Container( - padding: EdgeInsets.all(10), - child: Row( - children: [ - Expanded( - flex: 3, - child: Texts( - result.patientName, - fontWeight: FontWeight.w600, - fontSize: 12, - )), - Expanded( - flex: 1, - child: IconButton( - icon: SvgPicture.asset("assets/images/new-design/allow.svg", height: 22), - onPressed: () { - acceptRemoveRequest(result.iD, 3, context); - }, - )), - Expanded( - flex: 1, - child: IconButton( - icon: SvgPicture.asset("assets/images/new-design/reject.svg", height: 22), - color: Colors.white, - onPressed: () { - acceptRemoveRequest(result.iD, 4, context); - }, - )) - ], - )); - }).toList()) - ]) - ], - )); - }, - separatorBuilder: (context, index) => SizedBox(height: 14), - itemCount: 1); - } - }, - ))), - - // RoundedContainer( - // child: ExpansionTile( - // title: Text( - // TranslationBase.of(context).userViewRequest, - // style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, color: Colors.black), - // ), - // children: [ - // FutureBuilder( - // future: getUserViewRequest(), // async work - // builder: (BuildContext context, AsyncSnapshot snapshot) { - // switch (snapshot.connectionState) { - // case ConnectionState.waiting: - // return Padding(padding: EdgeInsets.only(top: 50), child: Text('Loading....')); - // default: - // if (snapshot.hasError) - // return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable)); - // else - // return Container( - // padding: EdgeInsets.all(15), - // child: Card( - // elevation: 3, - // shape: cardRadius(8), - // child: Column( - // children: [ - // Column(children: [ - // Padding( - // padding: EdgeInsets.all(10), - // child: Row(children: [ - // Expanded(flex: 3, child: AppText(TranslationBase.of(context).name, fontWeight: FontWeight.w600)), - // Expanded(flex: 1, child: AppText(TranslationBase.of(context).allow, fontWeight: FontWeight.w600)), - // Expanded(flex: 1, child: AppText(TranslationBase.of(context).reject, fontWeight: FontWeight.w600)), - // ])), - // Divider(color: Colors.black, height: 1.5, thickness: 1.5), - // Column( - // children: familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.map((result) { - // return Container( - // padding: EdgeInsets.all(10), - // child: Row( - // children: [ - // Expanded( - // flex: 3, - // child: Texts( - // result.patientName, - // fontWeight: FontWeight.w600, - // fontSize: 12, - // )), - // Expanded( - // flex: 1, - // child: IconButton( - // icon: Icon( - // Icons.check_circle, - // color: Color(0xff349745), - // ), - // onPressed: () { - // acceptRemoveRequest(result.iD, 3, context); - // }, - // )), - // Expanded( - // flex: 1, - // child: IconButton( - // icon: Icon( - // Icons.close, - // color: Colors.red[900], - // ), - // onPressed: () { - // acceptRemoveRequest(result.iD, 4, context); - // }, - // )) - // ], - // )); - // }).toList()) - // ]) - // ], - // ))); - // } - // }) - // ], - // ), - // ), + default: + if (snapshot.hasError) + return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable)); + else + return ListView.separated( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), + itemBuilder: (context, _index) { + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all(width: 1, color: Color(0xffEFEFEF)), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white), + child: Column( + children: [ + Column(children: [ + Padding( + padding: EdgeInsets.all(10), + child: Row(children: [ + Expanded(flex: 3, child: AppText(TranslationBase.of(context).name, fontWeight: FontWeight.w600)), + Expanded(flex: 1, child: AppText(TranslationBase.of(context).allow, fontWeight: FontWeight.w600)), + Expanded(flex: 1, child: AppText(TranslationBase.of(context).reject, fontWeight: FontWeight.w600)), + ])), + Padding( + padding: const EdgeInsets.only(left: 10.0, right: 10.0), + child: Divider(color: Colors.black, height: 1.5, thickness: 1.5), + ), + Column( + children: familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.map((result) { + return Container( + padding: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + flex: 3, + child: Texts( + result.patientName, + fontWeight: FontWeight.w600, + fontSize: 12, + )), + Expanded( + flex: 1, + child: IconButton( + icon: SvgPicture.asset("assets/images/new-design/allow.svg", height: 22), + onPressed: () { + acceptRemoveRequest(result.iD, 3, context); + }, + )), + Expanded( + flex: 1, + child: IconButton( + icon: SvgPicture.asset("assets/images/new-design/reject.svg", height: 22), + color: Colors.white, + onPressed: () { + acceptRemoveRequest(result.iD, 4, context); + }, + )) + ], + )); + }).toList()) + ]) + ], + )); + }, + separatorBuilder: (context, index) => SizedBox(height: 14), + itemCount: 1); + } + }, + ), + ), + ), SizedBox(height: 15), FractionallySizedBox( widthFactor: 1.0, @@ -521,18 +444,21 @@ class _MyFamily extends State with TickerProviderStateMixin { fontSize: 12, )), Expanded( - flex: 1, - child: Card( - // shape: cardRadius(10), - color: result.status == 3 ? Color(0xff349745) : Color(0xffD02127), - child: Padding( - padding: EdgeInsets.all(5), - child: AppText( - result.statusDescription, - color: Colors.white, - textAlign: TextAlign.center, - fontSize: 12, - )))), + flex: 1, + child: Card( + // shape: cardRadius(10), + color: result.status == 3 ? Color(0xff349745) : Color(0xffD02127), + child: Padding( + padding: EdgeInsets.all(5), + child: AppText( + result.statusDescription != null ? result.statusDescription : "", + color: Colors.white, + textAlign: TextAlign.center, + fontSize: 12, + ), + ), + ), + ), ], )); }).toList(), diff --git a/lib/pages/final_products_page.dart b/lib/pages/final_products_page.dart index ea5ee011..91e953ad 100644 --- a/lib/pages/final_products_page.dart +++ b/lib/pages/final_products_page.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; @@ -9,16 +10,19 @@ import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart' as utils ; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; import 'base/base_view.dart'; + dynamic languageID; class FinalProductsPage extends StatefulWidget { @@ -58,6 +62,8 @@ class _FinalProductsPageState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) { if (widget.productType == 1) { @@ -225,7 +231,7 @@ class _FinalProductsPageState extends State { ), child: model.finalProducts[index].rxMessage != null ? Texts( - languageID == 'ar' ? model.finalProducts[index].rxMessagen : model.finalProducts[index].rxMessage, + projectProvider.isArabic ? model.finalProducts[index].rxMessagen : model.finalProducts[index].rxMessage, color: Colors.white, regular: true, fontSize: 10, @@ -259,8 +265,8 @@ class _FinalProductsPageState extends State { ), ), ), - Texts( - model.finalProducts[index].name, + Texts(projectViewModel.isArabic ? model.finalProducts[index].namen : model.finalProducts[index].name, +// model.finalProducts[index].name, regular: true, fontSize: 12, fontWeight: FontWeight.w400, @@ -387,13 +393,22 @@ class _FinalProductsPageState extends State { color: Color(0xffb23838), borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), ), - child: Texts( - model.finalProducts[index].rxMessage != null ? model.finalProducts[index].rxMessage : "", + child:model.finalProducts[index].rxMessage != null + ? Texts( + projectProvider.isArabic ? model.finalProducts[index].rxMessagen : model.finalProducts[index].rxMessage, color: Colors.white, regular: true, fontSize: 10, fontWeight: FontWeight.w600, - ), + ) + : Texts(""), +// Texts( +// model.finalProducts[index].rxMessage != null ? model.finalProducts[index].rxMessage : "", +// color: Colors.white, +// regular: true, +// fontSize: 10, +// fontWeight: FontWeight.w600, +// ), ), ], ), @@ -414,8 +429,8 @@ class _FinalProductsPageState extends State { ), Container( width: MediaQuery.of(context).size.width * 0.64, - child: Texts( - model.finalProducts[index].name, + child: Texts(projectViewModel.isArabic ? model.finalProducts[index].namen : model.finalProducts[index].name, +// model.finalProducts[index].name, regular: true, fontSize: 13.2, fontWeight: FontWeight.w500, @@ -474,7 +489,10 @@ class _FinalProductsPageState extends State { GifLoaderDialogUtils.showMyDialog(context); await addToCartFunction(1, model.finalProducts[index].id); GifLoaderDialogUtils.hideDialog(context); - Navigator.push(context, FadePage(page: CartOrderPage())); + // Navigator.push(context, FadePage(page: CartOrderPage())); + utils.Utils.navigateToCartPage(); + + } else { AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); } @@ -527,6 +545,6 @@ class _FinalProductsPageState extends State { addToCartFunction(quantity, itemID) async { ProductDetailViewModel x = new ProductDetailViewModel(); - await x.addToCartData(quantity, itemID); + await x.addToCartData(quantity, itemID, context); } } diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index cb26c8b7..2bca7a9e 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -241,14 +241,14 @@ class _LandingPageState extends State with WidgetsBindingObserver { pageController = PageController(keepPage: true); _firebaseMessaging.setAutoInitEnabled(true); - signalRUtil = new SignalRUtil(hubName: "https://VCallApi.hmg.com/WebRTCHub?source=mobile&username=2001273", context: context); + // signalRUtil = new SignalRUtil(hubName: "https://VCallApi.hmg.com/WebRTCHub?source=mobile&username=2001273", context: context); locationUtils = new LocationUtils(isShowConfirmDialog: false, context: context); WidgetsBinding.instance.addPostFrameCallback((_) { if (projectViewModel.isLogin && !projectViewModel.isLoginChild) { familyFileProvider.getSharedRecordByStatus(); } - if (!signalRUtil.getConnectionState()) signalRUtil.startSignalRConnection(); + // if (!signalRUtil.getConnectionState()) signalRUtil.startSignalRConnection(); }); // HMG (Guest/Internet) Wifi Access [Zohaib Kambrani] //for now commented to reduce this call will enable it when needed diff --git a/lib/pages/offers_categorise_page.dart b/lib/pages/offers_categorise_page.dart index 263aef5c..a4708830 100644 --- a/lib/pages/offers_categorise_page.dart +++ b/lib/pages/offers_categorise_page.dart @@ -28,6 +28,7 @@ class _OffersCategorisePageState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectProvider = Provider.of(context); return BaseView( onModelReady: (model) => model.getOffersCategorise(), @@ -99,9 +100,8 @@ class _OffersCategorisePageState extends State { .height * 0.09, child: Center( - child: Texts( - model.categorise[index] - .name, + child: Texts(projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name, +// model.categorise[index].name, fontWeight: FontWeight.w600, fontSize: 13.8, @@ -117,8 +117,8 @@ class _OffersCategorisePageState extends State { String ids = model.categorise[index].id; - categoriseName = model - .categorise[index].name; + categoriseName = projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name; + //model.categorise[index].name; }), ], ), @@ -275,7 +275,7 @@ class _OffersCategorisePageState extends State { bottom: 5.0, ), child: Texts( - 'offer' + TranslationBase.of(context).offers .toUpperCase(), color: Colors .red, @@ -338,25 +338,28 @@ class _OffersCategorisePageState extends State { .circular( 6)), ), - child: Texts( - model - .products[ - index] - .rxMessage != - null - ? model - .products[ - index] - .rxMessage - : "", - color: - Colors.white, + child: model.products[index].rxMessage != null + ? Texts( + projectProvider.isArabic + ? model.products[index].rxMessagen + : model.products[index].rxMessage, + color: Colors.white, regular: true, fontSize: 10, - fontWeight: - FontWeight - .w400, - ), + fontWeight: FontWeight.w400, + ): Texts("") +// Texts( +// model.products[index].rxMessage != null ? +// model.products[index].rxMessage +// : "", +// color: +// Colors.white, +// regular: true, +// fontSize: 10, +// fontWeight: +// FontWeight +// .w400, +// ), ), ], ), @@ -403,11 +406,8 @@ class _OffersCategorisePageState extends State { ), ), ), - Texts( - model - .products[ - index] - .name, + Texts( projectViewModel.isArabic ? model.products[index].namen : model.products[index].name, + // model.products[index].name, regular: true, fontSize: 12.58, fontWeight: @@ -511,7 +511,7 @@ class _OffersCategorisePageState extends State { child: Center( child: Texts( - 'offer' + TranslationBase.of(context).offers .toUpperCase(), color: Colors .red, @@ -579,25 +579,28 @@ class _OffersCategorisePageState extends State { .circular( 6)), ), - child: Texts( - model - .products[ - index] - .rxMessage != - null - ? model - .products[ - index] - .rxMessage - : "", - color: - Colors.white, + child: model.products[index].rxMessage != null + ? Texts( + projectProvider.isArabic + ? model.products[index].rxMessagen + : model.products[index].rxMessage, + color: Colors.white, regular: true, fontSize: 10, - fontWeight: - FontWeight - .w400, - ), + fontWeight: FontWeight.w400, + ): Texts("") +// Texts( +// model.products[index].rxMessage != null +// ? model.products[index].rxMessage +// : "", +// color: +// Colors.white, +// regular: true, +// fontSize: 10, +// fontWeight: +// FontWeight +// .w400, +// ), ), ], ), @@ -649,9 +652,8 @@ class _OffersCategorisePageState extends State { SizedBox( height: 4.0, ), - Texts( - model.products[index] - .name, + Texts( projectViewModel.isArabic ? model.products[index].namen : model.products[index].name, + // model.products[index].name, regular: true, fontSize: 14.0, fontWeight: diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index 6a59b122..b1ad22de 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; @@ -32,14 +33,12 @@ class ParentCategorisePage extends StatefulWidget { String id; String titleName; - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); ParentCategorisePage({this.id, this.titleName}); @override - _ParentCategorisePageState createState() => - _ParentCategorisePageState(id: id, titleName: titleName); + _ParentCategorisePageState createState() => _ParentCategorisePageState(id: id, titleName: titleName); } class _ParentCategorisePageState extends State { @@ -76,6 +75,7 @@ class _ParentCategorisePageState extends State { TextEditingController minField = TextEditingController(); TextEditingController maxField = TextEditingController(); ProjectViewModel projectViewModel = Provider.of(context); + ProjectViewModel projectProvider = Provider.of(context); return BaseView( onModelReady: (model) => model.getCategoriseParent( i: id, pageIndex: pageIndex, isLoading: false), @@ -144,13 +144,14 @@ class _ParentCategorisePageState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( + InkWell( + child:Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Padding( padding: EdgeInsets.all(10.0), - child: InkWell( + child: Container( child: Texts( TranslationBase.of(context) @@ -159,7 +160,10 @@ class _ParentCategorisePageState extends State { fontWeight: FontWeight.w300, ), ), - onTap: () { + ), + Icon(Icons.arrow_forward) + ], + ), onTap: () { Navigator.push( context, FadePage( @@ -168,62 +172,8 @@ class _ParentCategorisePageState extends State { // id: model.categorise[0].id, // titleName: model.categorise[0].name, )), - ); -// showModalBottomSheet( -// isScrollControlled: true, -// context: context, -// builder: (BuildContext context) { -// return Container( -// // height: MediaQuery.of(context) -// // .size -// // .height * -// // 0.89, -// color: Colors.white, -// child: Center( -// child: ListView.builder( -// scrollDirection: Axis.vertical, -// itemCount: model.categoriseParent.length, -// itemBuilder: (BuildContext context, int index) { -// return Container( -// child: Padding( -// padding: EdgeInsets.all(4.0), -// child: InkWell( -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// Texts(projectViewModel.isArabic -// ? model.categoriseParent[index].namen -// : model.categoriseParent[index].name), -// Divider( -// thickness: 0.6, -// color: Colors.black12, -// ) -// ], -// ), -// onTap: () { -// Navigator.push( -// context, -// FadePage( -// page: SubCategorisePage( -// title: model.categoriseParent[index].name, -// id: model.categoriseParent[index].id, -// parentId: id, -// )), -// ); -// }, -// ), -// ), -// ); -// }), -// ), -// ); -// }, -// ); - }, - ), - ), - Icon(Icons.arrow_forward) - ], + + );} ), Divider( thickness: 1.0, @@ -312,7 +262,8 @@ class _ParentCategorisePageState extends State { context, FadePage( page: SubCategorisePage( - title: model + title: projectViewModel.isArabic ? model.categoriseParent[index].namen : model.categoriseParent[index].name, +// title:model .categoriseParent[index] .name, id: model @@ -350,7 +301,7 @@ class _ParentCategorisePageState extends State { width: 10.0, ), Texts( - 'Refine', + TranslationBase.of(context).refine, fontWeight: FontWeight.w600, ), ], @@ -398,15 +349,13 @@ class _ParentCategorisePageState extends State { .refine, // 'Refine', - fontWeight: - FontWeight - .w600, - ), - SizedBox( - width: 250.0, - ), - InkWell( - child: Texts( + fontWeight: FontWeight.w600, + ), + SizedBox( + width: 250.0, + ), + InkWell( + child: Texts( // 'Close', TranslationBase.of( context) @@ -540,7 +489,7 @@ class _ParentCategorisePageState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ - Texts('Min'), + Texts(TranslationBase.of(context).min), Container( color: Colors.white, width: 200, @@ -558,7 +507,7 @@ class _ParentCategorisePageState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ - Texts('Max'), + Texts(TranslationBase.of(context).max), Container( color: Colors.white, width: 200, @@ -645,47 +594,39 @@ class _ParentCategorisePageState extends State { } } - GifLoaderDialogUtils.showMyDialog( - context); + GifLoaderDialogUtils.showMyDialog(context); - await model.getFilteredProducts( - min: minField.text.toString(), - max: maxField.text.toString(), - categoryId: categoriesId, - brandId: brandIds); - GifLoaderDialogUtils.hideDialog( - context); + await model.getFilteredProducts( + min: minField.text.toString(), max: maxField.text.toString(), categoryId: categoriesId, brandId: brandIds); + GifLoaderDialogUtils.hideDialog(context); - Navigator.pop( - context); - }, - label: TranslationBase.of(context) - .apply, - backgroundColor: - Colors.green, - ), - ), - ], - ), + Navigator.pop(context); + }, + label: TranslationBase.of(context).apply, + backgroundColor: Colors.green, ), - ], - ), - ], + ), + ], + ), ), - ), - ); - }); - }, - ); - }, - ), - Row( - children: [ - Container( - height: 44.0, - child: VerticalDivider( - color: Colors.black45, - thickness: 1.0, + ], + ), + ], + ), + ), + ); + }); + }, + ); + }, + ), + Row( + children: [ + Container( + height: 44.0, + child: VerticalDivider( + color: Colors.black45, + thickness: 1.0, //width: 0.3, // indent: 0.0, ), @@ -838,7 +779,7 @@ class _ParentCategorisePageState extends State { ), child: Texts( - 'offer' + TranslationBase.of(context).offers .toUpperCase(), color: Colors.red, @@ -901,23 +842,33 @@ class _ParentCategorisePageState extends State { topLeft: Radius.circular(6)), ), - child: Texts( - model.parentProducts[index].rxMessage != + child:model.parentProducts[index].rxMessage != null ? + Texts(projectProvider.isArabic + ? model.parentProducts[index].rxMessagen + : model.parentProducts[index].rxMessage, + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ) + : Texts(""), +// Texts( + // model.parentProducts[index].rxMessage != null ? model .parentProducts[index] .rxMessage : "", - color: Colors + // color: Colors .white, - regular: + // regular: true, - fontSize: + // fontSize: 10, - fontWeight: + // fontWeight: FontWeight .w400, - ), + // ), ), ], ), @@ -1003,233 +954,145 @@ class _ParentCategorisePageState extends State { // ? (model.parentProducts[index].approvedRatingSum.toDouble() / model.parentProducts[index].approvedRatingSum.toDouble()).toDouble() // : 0, // forceStars: true), - RatingBar - .readOnly( - initialRating: model - .parentProducts[index] - .approvedRatingSum - .toDouble(), - size: - 15.0, - filledColor: - Colors.yellow[700], - emptyColor: - Colors.grey[500], - isHalfAllowed: - true, - halfFilledIcon: - Icons.star_half, - filledIcon: - Icons.star, - emptyIcon: - Icons.star, - ), - Texts( - "(${model.parentProducts[index].approvedTotalReviews})", - regular: - true, - fontSize: - 10, - fontWeight: - FontWeight.w400, - ) - ], - ), - ], + RatingBar.readOnly( + initialRating: model.parentProducts[index].approvedRatingSum.toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, ), - ), - ], - ), + Texts( + "(${model.parentProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ) + ], + ), + ], ), ), - onTap: () => { - Navigator.push( - context, - FadePage( - page: ProductDetailPage( - model.parentProducts[ - index]), - )), - }, - )); + ], + ), + ), + ), + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage(model.parentProducts[index]), + )), }, - ), - ) - : Container( - height: model.parentProducts.length * - MediaQuery.of(context) - .size - .height * - 0.122, - child: ListView.builder( - physics: - NeverScrollableScrollPhysics(), - itemCount: - model.parentProducts.length, - itemBuilder: - (BuildContext context, - int index) { - return InkWell( - child: Card( - child: Row( + )); + }, + ), + ) + : Container( + height: model.parentProducts.length * MediaQuery.of(context).size.height * 0.122, + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + itemCount: model.parentProducts.length, + itemBuilder: (BuildContext context, int index) { + return InkWell( + child: Card( + child: Row( + children: [ + Stack( + children: [ + Column( children: [ - Stack( - children: [ - Column( - children: [ - Container( - decoration: - BoxDecoration(), - child: - Padding( - padding: - EdgeInsets - .only( - left: 9.0, - top: 8.0, - right: - 10.0, - ), - ), - ), - Container( - margin: EdgeInsets - .fromLTRB( - 0, - 0, - 0, - 0), - alignment: - Alignment - .center, - child: model - .parentProducts[ - index] - .images - .isNotEmpty - ? Image - .network( - model - .parentProducts[index] - .images[0] - .thumb, - fit: BoxFit - .contain, - height: - 70, - ) - : Text(TranslationBase.of( - context) - .noImage), - ), - ], - ), - Column( - children: [ - Container( - width: model.parentProducts[index].rxMessage != - null - ? MediaQuery.of(context) - .size - .width / - 5.3 - : 0, - padding: - EdgeInsets - .all( - 4), - decoration: - BoxDecoration( - color: Color( - 0xffb23838), - borderRadius: - BorderRadius.only( - topLeft: - Radius.circular(6)), - ), - child: Texts( - model.parentProducts[index].rxMessage != - null - ? model - .parentProducts[index] - .rxMessage - : "", - color: Colors - .white, - regular: - true, - fontSize: - 10, - fontWeight: - FontWeight - .w400, - ), - ), - ], + Container( + decoration: BoxDecoration(), + child: Padding( + padding: EdgeInsets.only( + left: 9.0, + top: 8.0, + right: 10.0, ), - ], + ), ), Container( - margin: EdgeInsets - .symmetric( - horizontal: 0, - vertical: 0, + margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + alignment: Alignment.center, + child: model.parentProducts[index].images.isNotEmpty + ? Image.network( + model.parentProducts[index].images[0].thumb, + fit: BoxFit.contain, + height: 70, + ) + : Text(TranslationBase.of(context).noImage), + ), + ], + ), + Column( + children: [ + Container( + width: model.parentProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 5.3 : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), ), - child: Column( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - SizedBox( - height: 4.0, - ), - Container( - width: MediaQuery.of( - context) - .size - .width * - 0.635, - child: Texts( - projectViewModel - .isArabic - ? model - .parentProducts[ - index] - .namen - : model - .parentProducts[ - index] - .name, - regular: true, - fontSize: - 13.2, - fontWeight: - FontWeight - .w500, - maxLines: 5, - ), - ), - SizedBox( - height: 8.0, - ), - Padding( - padding: - const EdgeInsets - .only( - top: 4, - bottom: - 4), - child: Texts( - "SAR ${model.parentProducts[index].price}", - bold: true, - fontSize: 14, - ), - ), - Row( - children: [ + child: model.parentProducts[index].rxMessage != null ? + Texts(projectProvider.isArabic + ? model.parentProducts[index].rxMessagen + : model.parentProducts[index].rxMessage, + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ) + : Texts(""), +// Texts( +// model.parentProducts[index].rxMessage != null ? model.parentProducts[index].rxMessage : "", +// color: Colors.white, +// regular: true, +// fontSize: 10, +// fontWeight: FontWeight.w400, +// ), + ), + ], + ), + ], + ), + Container( + margin: EdgeInsets.symmetric( + horizontal: 0, + vertical: 0, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 4.0, + ), + Container( + width: MediaQuery.of(context).size.width * 0.635, + child: Texts( + projectViewModel.isArabic ? model.parentProducts[index].namen : model.parentProducts[index].name, + regular: true, + fontSize: 13.2, + fontWeight: FontWeight.w500, + maxLines: 5, + ), + ), + SizedBox( + height: 8.0, + ), + Padding( + padding: const EdgeInsets.only(top: 4, bottom: 4), + child: Texts( + "SAR ${model.parentProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ // StarRating( // totalAverage: model.parentProducts[index].approvedRatingSum > 0 // ? (model.parentProducts[index].approvedRatingSum.toDouble() / model.parentProducts[index].approvedRatingSum.toDouble()).toDouble() @@ -1298,8 +1161,7 @@ class _ParentCategorisePageState extends State { await addToCartFunction(1, model.parentProducts[index].id); GifLoaderDialogUtils.hideDialog(context); - Navigator.push(context, - FadePage(page: CartOrderPage())); + Utils.navigateToCartPage(); } else { AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); } @@ -1342,8 +1204,8 @@ class _ParentCategorisePageState extends State { Padding( padding: const EdgeInsets.all(8.0), - child: Text( - 'There is no data', + child: Text(TranslationBase.of(context).noData, + // 'There is no data', style: TextStyle(fontSize: 30), ), @@ -1362,12 +1224,11 @@ class _ParentCategorisePageState extends State { addToCartFunction(quantity, itemID) async { ProductDetailViewModel x = new ProductDetailViewModel(); - await x.addToCartData(quantity, itemID); + await x.addToCartData(quantity, itemID, context); } bool isEntityListSelected(CategoriseParentModel masterKey) { - Iterable history = - entityList.where((element) => masterKey.id == element.id); + Iterable history = entityList.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } @@ -1375,8 +1236,7 @@ class _ParentCategorisePageState extends State { } bool isEntityListSelectedBrands(CategoriseParentModel masterKey) { - Iterable history = - entityListBrands.where((element) => masterKey.id == element.id); + Iterable history = entityListBrands.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } diff --git a/lib/pages/pharmacies/ProductCheckTypeWidget.dart b/lib/pages/pharmacies/ProductCheckTypeWidget.dart index 2b88d30a..46c5e7a3 100644 --- a/lib/pages/pharmacies/ProductCheckTypeWidget.dart +++ b/lib/pages/pharmacies/ProductCheckTypeWidget.dart @@ -48,7 +48,7 @@ class _ProductCheckTypeWidgetState extends State { deleteWishListItem(itemID) async { ProductDetailViewModel x = new ProductDetailViewModel(); GifLoaderDialogUtils.showMyDialog(context); - await x.deleteWishlistData(itemID); + await x.deleteWishlistData(itemID, context); await widget.model.getWishlistData(isLocalLoader: true); GifLoaderDialogUtils.hideDialog(context); } diff --git a/lib/pages/pharmacies/compare-list.dart b/lib/pages/pharmacies/compare-list.dart index c4da5ba2..afa5382f 100644 --- a/lib/pages/pharmacies/compare-list.dart +++ b/lib/pages/pharmacies/compare-list.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; class CompareList with ChangeNotifier { @@ -7,20 +8,28 @@ class CompareList with ChangeNotifier { List get productListItems => _product; - void addItem(data) { + void addItem(data, context) { if (_product.length == 0) { _product.add(data); - AppToast.showSuccessToast(message: 'You have added a product to the Compare list'); + AppToast.showSuccessToast(message:TranslationBase.of(context).addToCompareMsg + // 'You have added a product to the Compare list' + ); } else { for (int i = 0; i < _product.length; i++) { if (_product.length <= 4 && _product[i].id != data.id) { _product.add(data); - AppToast.showSuccessToast(message: 'You have added a product to the Compare list'); + AppToast.showSuccessToast(message:TranslationBase.of(context).addToCompareMsg + // 'You have added a product to the Compare list' + ); break; } else if(_product[i].id == data.id){ - AppToast.showErrorToast(message: 'the item is already in the list'); + AppToast.showErrorToast(message:TranslationBase.of(context).itInListMsg + // 'the item is already in the list' + ); } else if(_product.length == 4){ - AppToast.showErrorToast(message: 'your compare list is full'); + AppToast.showErrorToast(message: TranslationBase.of(context).compareListFull + // 'your compare list is full' + ); } } } diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart index b246e7d9..cefa5dd7 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -22,6 +23,7 @@ import 'package:provider/provider.dart'; import 'cart-order-preview.dart'; class CartOrderPage extends StatefulWidget { + final Function(int) changeTab; const CartOrderPage({Key key, this.changeTab}) : super(key: key); @@ -45,213 +47,216 @@ class _CartOrderPageState extends State { OrderPreviewViewModel model = Provider.of(context); final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; - AppScaffold appScaffold; - return NetworkBaseView( - isLoading: isLoading, - isLocalLoader: true, - child: appScaffold = AppScaffold( - appBarTitle: TranslationBase.of(context).shoppingCart, - isShowAppBar: true, - isPharmacy: true, - showHomeAppBarIcon: false, - isShowDecPage: false, - isMainPharmacyPages: true, - isBottomBar: true, - showPharmacyCart: true, - baseViewModel: model, - backgroundColor: Colors.white, - body: !(model.cartResponse.shoppingCarts == null || - model.cartResponse.shoppingCarts.length == 0) + return AppScaffold( + appBarTitle: TranslationBase.of(context).shoppingCart, + isShowAppBar: true, + isPharmacy: true, + showHomeAppBarIcon: false, + isShowDecPage: false, + isMainPharmacyPages: true, + showPharmacyCart: false, + baseViewModel: model, + backgroundColor: Colors.white, + body: NetworkBaseView( + isLoading: isLoading, + isLocalLoader: true, + child: !(model.cartResponse.shoppingCarts == null || + model.cartResponse.shoppingCarts.length == 0) ? Container( - height: height * 0.85, - width: double.infinity, - child: SingleChildScrollView( - child: Container( - margin: EdgeInsets.all(10), + height: height * 0.85, + width: double.infinity, + child: SingleChildScrollView( + child: Container( + margin: EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + GestureIconButton( + TranslationBase.of(context).deleteAllItems, + Icon( + Icons.delete_outline_sharp, + color: Colors.grey.shade700, + ), + onTap: () => {model.deleteShoppingCart()}, + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Container( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: [ - GestureIconButton( - TranslationBase.of(context).deleteAllItems, - Icon( - Icons.delete_outline_sharp, - color: Colors.grey.shade700, - ), - onTap: () => {model.deleteShoppingCart()}, - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Container( - child: Column( - children: [ - ...List.generate( - model.cartResponse.shoppingCarts != null - ? model.cartResponse.shoppingCarts.length - : 0, - (index) => ProductOrderItem( - model.cartResponse - .shoppingCarts[index], () { - print(model.cartResponse - .shoppingCarts[index].quantity); - model - .changeProductQuantity(model - .cartResponse - .shoppingCarts[index]) - .then((value) { - if (model.state != ViewState.Error) { - // appScaffold.appBar.badgeUpdater( - // '${value.quantityCount ?? 0}'); - } - if (model.state == - ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - } - }); - }, () { - model - .deleteProduct(model.cartResponse - .shoppingCarts[index]) - .then((value) { - if (model.state != ViewState.Error) { - // appScaffold.appBar.badgeUpdater( - // '${value.quantityCount ?? 0}'); - } - }); - })) - ], - ), - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 2, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).subtotal, - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - "${TranslationBase.of(context).vat}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).total, - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalWithVat).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Image.asset( - "assets/images/pharmacy_module/payment.png", - width: mediaQuery.size.width - 20, - height: 30.0, - fit: BoxFit.scaleDown, - ), - SizedBox( - height: 120, - ) + ...List.generate( + model.cartResponse.shoppingCarts != null + ? model + .cartResponse.shoppingCarts.length + : 0, + (index) => ProductOrderItem( + model.cartResponse + .shoppingCarts[index], () { + print(model.cartResponse + .shoppingCarts[index].quantity); + model + .changeProductQuantity(model + .cartResponse + .shoppingCarts[index]) + .then((value) { + if (model.state != + ViewState.Error) { + // appScaffold.appBar.badgeUpdater( + // '${value.quantityCount ?? 0}'); + } + if (model.state == + ViewState.ErrorLocal) { + Utils.showErrorToast( + model.error); + } + }); + }, () { + model + .deleteProduct(model + .cartResponse + .shoppingCarts[index]) + .then((value) { + if (model.state != + ViewState.Error) { + // appScaffold.appBar.badgeUpdater( + // '${value.quantityCount ?? 0}'); + } + }); + })) ], ), ), - ), - ) - : Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Image.asset( - 'assets/images/new-design/empty_box.png', - width: 100, - height: 100, - fit: BoxFit.cover, + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 2, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).subtotal, + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - TranslationBase.of(context).noData, -// 'There is no data', - style: TextStyle(fontSize: 30), + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, ), - ) - ], + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + "${TranslationBase.of(context).vat}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).total, + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalWithVat).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Image.asset( + "assets/images/pharmacy_module/payment.png", + width: mediaQuery.size.width - 20, + height: 30.0, + fit: BoxFit.scaleDown, + ), + SizedBox( + height: 120, + ) + ], + ), + ), + ), + ) + : Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Image.asset( + 'assets/images/new-design/empty_box.png', + width: 100, + height: 100, + fit: BoxFit.cover, ), ), - bottomSheet: Container( - height: !(model.cartResponse.shoppingCarts == null || - model.cartResponse.shoppingCarts.length == 0) - ? height * 0.15 - : 0, - color: Colors.white, - child: OrderBottomWidget(model.addresses, height), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + TranslationBase.of(context).noData, +// 'There is no data', + style: TextStyle(fontSize: 30), + ), + ) + ], + ), ), ), + bottomSheet: Container( + height: !(model.cartResponse.shoppingCarts == null || + model.cartResponse.shoppingCarts.length == 0) + ? height * 0.15 + : 0, + color: Colors.white, + child: OrderBottomWidget(model.addresses, height, model), + ), ); } @@ -267,8 +272,9 @@ class _CartOrderPageState extends State { class OrderBottomWidget extends StatefulWidget { final List addresses; final double height; + final OrderPreviewViewModel model; - OrderBottomWidget(this.addresses, this.height); + OrderBottomWidget(this.addresses, this.height, this.model); @override _OrderBottomWidgetState createState() => _OrderBottomWidgetState(); @@ -280,9 +286,9 @@ class _OrderBottomWidgetState extends State { @override Widget build(BuildContext context) { ProjectViewModel projectProvider = Provider.of(context); - OrderPreviewViewModel cart = Provider.of(context); - return !(cart.cartResponse.shoppingCarts == null || - cart.cartResponse.shoppingCarts.length == 0) + + return !(widget.model.cartResponse.shoppingCarts == null || + widget.model.cartResponse.shoppingCarts.length == 0) ? Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -372,7 +378,7 @@ class _OrderBottomWidgetState extends State { child: Row( children: [ Texts( - "${TranslationBase.of(context).sar} ${(cart.cartResponse.subtotalWithVat).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(widget.model.cartResponse.subtotalWithVat).toStringAsFixed(2)}", fontSize: projectProvider.isArabic ? 12 : 14, fontWeight: FontWeight.bold, ), @@ -390,7 +396,7 @@ class _OrderBottomWidgetState extends State { ), ), Texts( - "${cart.cartResponse.quantityCount} ${TranslationBase.of(context).items}", + "${widget.model.cartResponse.quantityCount} ${TranslationBase.of(context).items}", fontSize: 10, color: Colors.grey, fontWeight: FontWeight.bold, @@ -402,7 +408,7 @@ class _OrderBottomWidgetState extends State { onPressed: isAgree // && cart.cartResponse.shoppingCarts[1].product.stockQuantity ==0 ? () => { - if (cart.isCartItemsOutOfStock()) + if (widget.model.isCartItemsOutOfStock()) { // Toast msg AppToast.showErrorToast( @@ -411,11 +417,13 @@ class _OrderBottomWidgetState extends State { } else { - Navigator.push( - context, - FadePage( - page: OrderPreviewPage( - widget.addresses))) + _navigateToAddressPage(widget + .model.user.patientIdentificationNo) + // Navigator.push( + // context, + // FadePage( + // page: + // OrderPreviewPage(widget.addresses))) } } : null, @@ -427,30 +435,9 @@ class _OrderBottomWidgetState extends State { fontSize: 14), ), color: Color(0xFF4CAF50), - disabledColor: Color(0xFF848484), + disabledColor:Color(0xFF848484), // disabledColor: Color(0xff005aff), ) -// RaisedButton( -// onPressed: isAgree -//// && cart.cartResponse.shoppingCarts[1].product.stockQuantity ==0 -// ? () => { -// Navigator.push( -// context, -// FadePage( -// page: -// OrderPreviewPage(widget.addresses))) -// } -// : null, -// child: new Text( -// "${TranslationBase.of(context).checkOut}", -// style: new TextStyle( -// color: -// isAgree ? Colors.white : Colors.grey.shade300, -// fontSize: 14), -// ), -// color: Color(0xff005aff), -// disabledColor: Color(0xff005aff), -// ) ], ), ), @@ -458,4 +445,24 @@ class _OrderBottomWidgetState extends State { ) : Container(); } + + _navigateToAddressPage(String identificationNo) { + Navigator.push( + context, + FadePage( + page: PharmacyAddressesPage( + orderPreviewViewModel: widget.model, + ))).then((result) async { + if (result != null) { + GifLoaderDialogUtils.showMyDialog(context); + var address = result; + widget.model.paymentCheckoutData.address = + Addresses.fromJson(address.toJson()); + await widget.model.getInformationsByAddress(identificationNo); + await widget.model.getShoppingCart(); + // widget.changeMainState(); + GifLoaderDialogUtils.hideDialog(context); + } + }); + } } diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart index 50cee7c3..cc2e1edc 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart @@ -15,8 +15,9 @@ import 'lakum_widget.dart'; class OrderPreviewPage extends StatefulWidget { final List addresses; + final OrderPreviewViewModel model; - OrderPreviewPage(this.addresses); + OrderPreviewPage({this.addresses, this.model}); @override _OrderPreviewPageState createState() => _OrderPreviewPageState(); @@ -43,7 +44,7 @@ class _OrderPreviewPageState extends State { Widget build(BuildContext context) { final mediaQuery = MediaQuery.of(context); final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; - OrderPreviewViewModel model = Provider.of(context); + // OrderPreviewViewModel widget.model = Provider.of(context); return AppScaffold( appBarTitle: "${TranslationBase.of(context).checkOut}", isShowAppBar: true, @@ -52,7 +53,7 @@ class _OrderPreviewPageState extends State { isLoading: isLoading, isLocalLoader: true, backgroundColor: Colors.white, - // baseViewModel: model, + // baseViewModel: widget.model, body: Container( color: Color(0xFFF1F1F1), height: height * 0.90, @@ -61,19 +62,19 @@ class _OrderPreviewPageState extends State { color: Color(0xFFF1F1F1), child: Column( children: [ - SelectAddressWidget(model, widget.addresses, changeMainState), + SelectAddressWidget(widget.model, widget.addresses, changeMainState, isUpdating: true,), SizedBox( height: 10, ), - SelectPaymentOptionWidget(model, changeMainState), + SelectPaymentOptionWidget(widget.model, changeMainState,isUpdating: true,), SizedBox( height: 10, ), - model.paymentCheckoutData.lacumInformation != null + widget.model.paymentCheckoutData.lacumInformation != null ? Container( child: Column( children: [ - LakumWidget(model), + LakumWidget(widget.model), SizedBox( height: 10, ), @@ -95,8 +96,8 @@ class _OrderPreviewPageState extends State { color: Colors.black, ), ...List.generate( - model.cartResponse.shoppingCarts != null ? model.cartResponse.shoppingCarts.length : 0, - (index) => ProductOrderPreviewItem(model.cartResponse.shoppingCarts[index]), + widget.model.cartResponse.shoppingCarts != null ? widget.model.cartResponse.shoppingCarts.length : 0, + (index) => ProductOrderPreviewItem(widget.model.cartResponse.shoppingCarts[index]), ), ], ), @@ -104,7 +105,7 @@ class _OrderPreviewPageState extends State { Container( width: double.infinity, padding: EdgeInsets.all(8), - child: model.cartResponse.subtotal != null + child: widget.model.cartResponse.subtotal != null ? Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -127,7 +128,7 @@ class _OrderPreviewPageState extends State { fontWeight: FontWeight.w500, ), Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(widget.model.cartResponse.subtotal).toStringAsFixed(2)}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.w500, @@ -151,7 +152,7 @@ class _OrderPreviewPageState extends State { fontWeight: FontWeight.w500, ), Texts( - "${TranslationBase.of(context).sar} ${(model.totalAdditionalShippingCharge).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(widget.model.totalAdditionalShippingCharge).toStringAsFixed(2)}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.w500, @@ -175,7 +176,7 @@ class _OrderPreviewPageState extends State { fontWeight: FontWeight.w500, ), Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(widget.model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.w500, @@ -199,7 +200,7 @@ class _OrderPreviewPageState extends State { fontWeight: FontWeight.bold, ), Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(widget.model.cartResponse.subtotal).toStringAsFixed(2)}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.bold, @@ -214,7 +215,7 @@ class _OrderPreviewPageState extends State { : Container(), ), SizedBox( - height: model.cartResponse.shoppingCarts != null ? height * 0.10 : 0, + height: widget.model.cartResponse.shoppingCarts != null ? height * 0.10 : 0, ) ], ), @@ -222,9 +223,9 @@ class _OrderPreviewPageState extends State { ), ), bottomSheet: Container( - height: model.cartResponse.shoppingCarts != null ? height * 0.10 : 0, + height: widget.model.cartResponse.shoppingCarts != null ? height * 0.10 : 0, color: Colors.white, - child: PaymentBottomWidget(model), + child: PaymentBottomWidget(widget.model), ), ); } diff --git a/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart b/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart index e03a4b35..a1634e21 100644 --- a/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart @@ -13,8 +13,10 @@ class SelectAddressWidget extends StatefulWidget { final OrderPreviewViewModel model; final List addresses; final Function changeMainState; + final bool isUpdating; - SelectAddressWidget(this.model, this.addresses, this.changeMainState); + SelectAddressWidget(this.model, this.addresses, this.changeMainState, + {this.isUpdating = false}); @override _SelectAddressWidgetState createState() => _SelectAddressWidgetState(); @@ -24,7 +26,7 @@ class _SelectAddressWidgetState extends State { AddressInfo address; _navigateToAddressPage(String identificationNo) { - Navigator.push(context, FadePage(page: PharmacyAddressesPage())).then((result) async { + Navigator.push(context, FadePage(page: PharmacyAddressesPage(orderPreviewViewModel: widget.model,isUpdate: widget.isUpdating,changeMainState: widget.changeMainState,))).then((result) async { if (result != null) { GifLoaderDialogUtils.showMyDialog(context); address = result; @@ -39,15 +41,15 @@ class _SelectAddressWidgetState extends State { @override void initState() { - if (widget.model.paymentCheckoutData.address != null) { - address = AddressInfo.fromJson(widget.model.paymentCheckoutData.address.toJson()); - } super.initState(); } @override Widget build(BuildContext context) { OrderPreviewViewModel model = Provider.of(context); + if (widget.model.paymentCheckoutData.address != null) { + address = AddressInfo.fromJson(widget.model.paymentCheckoutData.address.toJson()); + } return Container( color: Colors.white, child: address == null diff --git a/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart b/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart index 825e2577..67692c5d 100644 --- a/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart @@ -9,8 +9,10 @@ import 'package:flutter/material.dart'; class SelectPaymentOptionWidget extends StatefulWidget { final OrderPreviewViewModel model; final Function changeMainState; + final bool isUpdating; - SelectPaymentOptionWidget(this.model, this.changeMainState); + + SelectPaymentOptionWidget(this.model, this.changeMainState, {this.isUpdating = false}); @override _SelectPaymentOptionWidgetState createState() => _SelectPaymentOptionWidgetState(); @@ -20,7 +22,7 @@ class _SelectPaymentOptionWidgetState extends State { PaymentOption paymentOption; _navigateToPaymentOption() { - Navigator.push(context, FadePage(page: PaymentMethodSelectPage())) + Navigator.push(context, FadePage(page: PaymentMethodSelectPage(model: widget.model,changeMainState:widget.changeMainState,isUpdating: widget.isUpdating,))) .then((result) => { setState(() { if (result != null) { @@ -35,14 +37,14 @@ class _SelectPaymentOptionWidgetState extends State { @override void initState() { - if (widget.model.paymentCheckoutData.paymentOption != null) { - paymentOption = widget.model.paymentCheckoutData.paymentOption; - } super.initState(); } @override Widget build(BuildContext context) { + if (widget.model.paymentCheckoutData.paymentOption != null) { + paymentOption = widget.model.paymentCheckoutData.paymentOption; + } return Container( color: Colors.white, child: paymentOption == null diff --git a/lib/pages/pharmacies/screens/order-preview-page.dart b/lib/pages/pharmacies/screens/order-preview-page.dart deleted file mode 100644 index 6b5f4f51..00000000 --- a/lib/pages/pharmacies/screens/order-preview-page.dart +++ /dev/null @@ -1,48 +0,0 @@ -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:flutter/material.dart'; - -class OrderPreviewPage extends StatelessWidget { - @override - Widget build(BuildContext context) { - return BaseView( - builder: (_, model, wi) => AppScaffold( - title: TranslationBase.of(context).shoppingCart, - isShowAppBar: true, - isShowDecPage: false, - baseViewModel: model, - backgroundColor: Colors.white, - body: Container( - width: double.infinity, - child: SingleChildScrollView( - child: Container( - margin: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GestureIconButton( - TranslationBase.of(context).deleteAllItems, - Icon(Icons.delete_outline_sharp, color: Colors.grey.shade800,), - onTap: () => {}, - ), - const Divider( - color: Colors.grey, - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - - ], - ), - ), - ), - ), - ), - ); - } -} - diff --git a/lib/pages/pharmacies/screens/payment-method-select-page.dart b/lib/pages/pharmacies/screens/payment-method-select-page.dart index 92065102..978afae3 100644 --- a/lib/pages/pharmacies/screens/payment-method-select-page.dart +++ b/lib/pages/pharmacies/screens/payment-method-select-page.dart @@ -6,11 +6,23 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'cart-page/cart-order-preview.dart'; + class PaymentMethodSelectPage extends StatefulWidget { + final OrderPreviewViewModel model; + final bool isUpdating; + final Function changeMainState; + + const PaymentMethodSelectPage( + {Key key, this.model, this.isUpdating = false, this.changeMainState}) + : super(key: key); + @override - _PaymentMethodSelectPageState createState() => _PaymentMethodSelectPageState(); + _PaymentMethodSelectPageState createState() => + _PaymentMethodSelectPageState(); } class _PaymentMethodSelectPageState extends State { @@ -79,7 +91,8 @@ class _PaymentMethodSelectPageState extends State { PaymentOption.installments, () => { setState(() { - selectedPaymentOption = PaymentOption.installments; + selectedPaymentOption = + PaymentOption.installments; }) }), if (Platform.isIOS) @@ -103,7 +116,27 @@ class _PaymentMethodSelectPageState extends State { padding: EdgeInsets.symmetric(horizontal: 16, vertical: 20), child: DefaultButton( TranslationBase.of(context).next, - selectedPaymentOption != null ? () => {Navigator.pop(context, selectedPaymentOption)} : null, + selectedPaymentOption != null + ? () { + widget.model.paymentCheckoutData.paymentOption = + selectedPaymentOption; + if (widget.isUpdating) { + widget.changeMainState(); + Navigator.pop(context); + return; + } else { + Navigator.push( + context, + FadePage( + page: OrderPreviewPage( + model: widget.model, + ), + ), + ); + } + // Navigator.pop(context, selectedPaymentOption); + } + : null, color: Color(0xff5AB154), ), ), @@ -117,12 +150,14 @@ class PaymentMethodCard extends StatelessWidget { final PaymentOption paymentOption; final Function selectMethod; - PaymentMethodCard(this.cardWidth, this.selectedPaymentOption, this.paymentOption, this.selectMethod); + PaymentMethodCard(this.cardWidth, this.selectedPaymentOption, + this.paymentOption, this.selectMethod); @override Widget build(BuildContext context) { bool isSelected = false; - if (selectedPaymentOption != null && selectedPaymentOption == paymentOption) { + if (selectedPaymentOption != null && + selectedPaymentOption == paymentOption) { isSelected = true; } @@ -136,7 +171,9 @@ class PaymentMethodCard extends StatelessWidget { color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), - side: isSelected ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0), + side: isSelected + ? BorderSide(color: Colors.green, width: 2.0) + : BorderSide(color: Colors.transparent, width: 0.0), ), child: Padding( padding: const EdgeInsets.all(12.0), @@ -145,7 +182,13 @@ class PaymentMethodCard extends StatelessWidget { Container( width: 24, height: 24, - decoration: containerColorRadiusBorderWidth(isSelected ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5), + decoration: containerColorRadiusBorderWidth( + isSelected + ? CustomColors.accentColor + : Colors.transparent, + 100, + Colors.grey, + 0.5), ), mWidth(12), Container( @@ -157,7 +200,8 @@ class PaymentMethodCard extends StatelessWidget { if (isSelected) Container( decoration: containerRadius(CustomColors.green, 200), - padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), + padding: + EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), child: Text( TranslationBase.of(context).paymentSelected, style: TextStyle( @@ -170,40 +214,6 @@ class PaymentMethodCard extends StatelessWidget { ), ), ), - // Container( - // margin: EdgeInsets.symmetric(horizontal: 2, vertical: 0), - // child: Stack( - // children: [ - // Container( - // padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8), - // margin: EdgeInsets.symmetric(horizontal: 14, vertical: 8), - // decoration: new BoxDecoration( - // color: Colors.grey.shade100, - // shape: BoxShape.rectangle, - // borderRadius: BorderRadius.circular(8), - // border: Border.fromBorderSide(BorderSide( - // color: isSelected ? Color(0xff20BC11) : Colors.grey.shade300, - // width: 0.8, - // )), - // ), - // width: cardWidth, - // child: Image.asset( - // getPaymentOptionImage(paymentOption), - // fit: BoxFit.cover, - // ), - // ), - // if (isSelected) - // Positioned( - // right: 1, - // child: Icon( - // Icons.check_circle, - // color: Color(0xff20BC11), - // size: 30, - // ), - // ), - // ], - // ), - // ), ), ); } diff --git a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart index 72399498..644ab693 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -209,13 +209,7 @@ class _FooterWidgetState extends State { ); } else { await widget.addToShoppingCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); - // Navigator.of(context).pushNamed( - // CART_ORDER_PAGE, - // ); - Navigator.push( - context, - FadePage(page: CartOrderPage()), - ); + } }, fontWeight: FontWeight.w600, diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index ae7b67c3..c4c1b26c 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -1,7 +1,10 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-name-and-price.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/recommended_products.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart'; @@ -9,9 +12,13 @@ import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/sh import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'availability_info.dart'; import 'details_info.dart'; @@ -85,10 +92,11 @@ class __ProductDetailPageState extends State { } Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( allowAny: true, - onModelReady: (model) { - model.getProductReviewsData(widget.product.id); + onModelReady: (model) async { + await model.getProductReviewsData(widget.product.id).then((value) {}); }, builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).productDetails, @@ -103,265 +111,244 @@ class __ProductDetailPageState extends State { await addToWishlistFunction(itemID: itemID, model: model); }, deleteFromWishlistFunction: () async { - await deleteFromWishlistFunction( - itemID: itemID, model: model); + await deleteFromWishlistFunction(itemID: itemID, model: model); }, isInWishList: isInWishList, addToCartFunction: addToCartFunction, ), body: SingleChildScrollView( - child: Column( - children: [ - Container( - width: double.infinity, - color: Colors.white, child: Column( children: [ - if (widget.product.images.isNotEmpty) - Container( - height: MediaQuery.of(context).size.height * .40, - child: Image.network( - widget.product.images[0].src.trim(), - fit: BoxFit.contain, - ), + Container( + width: double.infinity, + color: Colors.white, + child: Column( + children: [ + if (widget.product.images.isNotEmpty) + Container( + height: MediaQuery.of(context).size.height * .40, + child: Image.network( + widget.product.images[0].src.trim(), + fit: BoxFit.contain, + ), + ), + if (widget.product.discountDescription != null) DiscountDescription(product: widget.product) + ], ), - if (widget.product.discountDescription != null) - DiscountDescription(product: widget.product) - ], - ), - ), - SizedBox( - height: 4, - ), - Container( - color: Colors.white, - child: ProductNameAndPrice( - context, - widget.product, - customerId: customerId, - addToWishlistFunction: (item) { - addToWishlistFunction(itemID: item, model: model); - setState(() {}); - }, - deleteFromWishlistFunction: (item) { - deleteFromWishlistFunction( - itemID: item, model: model); - setState(() {}); - }, - notifyMeWhenAvailable: (context, itemId) { - notifyMeWhenAvailable( - itemId: itemId, + ), + SizedBox( + height: 4, + ), + Container( + color: Colors.white, + child: ProductNameAndPrice( + context, + widget.product, customerId: customerId, - model: model); - }, - isInWishList: isInWishList, - isStockAvailable: model.isStockAvailable, - ), - ), - SizedBox( - height: 6, - ), - Container( - color: Colors.white, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ + addToWishlistFunction: (item) { + addToWishlistFunction(itemID: item, model: model); + setState(() {}); + }, + deleteFromWishlistFunction: (item) { + deleteFromWishlistFunction(itemID: item, model: model); + setState(() {}); + }, + notifyMeWhenAvailable: (context, itemId) { + notifyMeWhenAvailable(itemId: itemId, customerId: customerId, model: model); + }, + isInWishList: isInWishList, + isStockAvailable: model.isStockAvailable, + stockAvailability: projectViewModel.isArabic ? model.stockAvailabilityn : model.stockAvailability, + ), + ), + SizedBox( + height: 6, + ), Container( - padding: EdgeInsets.symmetric( - vertical: 15, horizontal: 10), - child: Texts( - TranslationBase.of(context).specification, - fontSize: 15, - fontWeight: FontWeight.bold, + color: Colors.white, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.symmetric(vertical: 15, horizontal: 10), + child: Texts( + TranslationBase.of(context).specification, + fontSize: 15, + fontWeight: FontWeight.bold, + ), + width: double.infinity, + ), + // Divider(color: Colors.grey), + ], ), - width: double.infinity, ), - // Divider(color: Colors.grey), - ], - ), - ), - SizedBox( - height: 6, - ), - Container( - // width: 500, - margin: EdgeInsets.only(bottom: 6), - color: Colors.white, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Column( - children: [ - FlatButton( - onPressed: () { - setState(() { - isDetails = true; - isReviews = false; - isAvailability = false; - }); - }, - child: Text( - TranslationBase.of(context).details, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), + SizedBox( + height: 6, + ), + Container( + // width: 500, + margin: EdgeInsets.only(bottom: 6), + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Column( + children: [ + FlatButton( + onPressed: () { + setState(() { + isDetails = true; + isReviews = false; + isAvailability = false; + }); + }, + child: Text( + TranslationBase.of(context).details, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + CustomDivider( + color: isDetails ? Colors.green : Colors.transparent, + ) + ], ), - color: Colors.white, - ), - CustomDivider( - color: isDetails - ? Colors.green - : Colors.transparent, - ) - ], - ), - SizedBox( - width: 20, - ), - Column( - children: [ - FlatButton( - onPressed: () async { - if (widget.product.approvedTotalReviews > - 0) { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getProductReviewsData( - widget.product.id); - GifLoaderDialogUtils.hideDialog( - context); - } else { - model.clearReview(); - } - setState(() { - isDetails = false; - isReviews = true; - isAvailability = false; - }); - }, - child: Text( - TranslationBase.of(context).reviews, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), + SizedBox( + width: 20, ), - color: Colors.white, - ), - CustomDivider( - color: isReviews - ? Colors.green - : Colors.transparent, - ), - ], - ), - SizedBox( - width: 20, - ), - Column( - children: [ - FlatButton( - onPressed: () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getProductLocationData(); - GifLoaderDialogUtils.hideDialog(context); + Column( + children: [ + FlatButton( + onPressed: () async { + if (widget.product.approvedTotalReviews > 0) { + GifLoaderDialogUtils.showMyDialog(context); + await model.getProductReviewsData(widget.product.id); + GifLoaderDialogUtils.hideDialog(context); + } else { + model.clearReview(); + } + setState(() { + isDetails = false; + isReviews = true; + isAvailability = false; + }); + }, + child: Text( + TranslationBase.of(context).reviews, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + CustomDivider( + color: isReviews ? Colors.green : Colors.transparent, + ), + ], + ), + SizedBox( + width: 20, + ), + Column( + children: [ + FlatButton( + onPressed: () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.getProductLocationData(); + GifLoaderDialogUtils.hideDialog(context); - setState(() { - isDetails = false; - isReviews = false; - isAvailability = true; - }); - }, - child: Text( - TranslationBase.of(context).availability, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), + setState(() { + isDetails = false; + isReviews = false; + isAvailability = true; + }); + }, + child: Text( + TranslationBase.of(context).availability, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + CustomDivider( + color: isAvailability ? Colors.green : Colors.transparent, + ), + ], ), - color: Colors.white, - ), - CustomDivider( - color: isAvailability - ? Colors.green - : Colors.transparent, - ), - ], - ), - ], + ], + ), + SizedBox( + height: 10, + ), + isDetails + ? DetailsInfo( + product: widget.product, + ) + : isReviews + ? ReviewsInfo( + product: widget.product, + previousModel: model, + ) + : isAvailability + ? AvailabilityInfo( + previousModel: model, + ) + : Container(), + ], + ), ), SizedBox( height: 10, ), - isDetails - ? DetailsInfo( - product: widget.product, - ) - : isReviews - ? ReviewsInfo( - product: widget.product, - previousModel: model, - ) - : isAvailability - ? AvailabilityInfo( - previousModel: model, - ) - : Container(), + RecommendedProducts( + product: widget.product, + productDetailViewModel: model, + addToWishlistFunction: (itemID) async { + await addToWishlistFunction(itemID: itemID, model: model); + }, + deleteFromWishlistFunction: (itemID) async { + await deleteFromWishlistFunction(itemID: itemID, model: model); + }, + ) ], ), ), - SizedBox( - height: 10, - ), - RecommendedProducts( - product: widget.product, - productDetailViewModel: model, - addToWishlistFunction: (itemID) async { - await addToWishlistFunction( - itemID: itemID, model: model); - }, - deleteFromWishlistFunction: (itemID) async { - await deleteFromWishlistFunction( - itemID: itemID, model: model); - }, + // : AppCircularProgressIndicator(), + bottomSheet: model.state == ViewState.Idle || model.state == ViewState.ErrorLocal + ? FooterWidget( + model.isStockAvailable, + widget.product.orderMaximumQuantity, + widget.product.orderMinimumQuantity, + model.stockQuantity, + widget.product, + quantity: quantity, + isOverQuantity: isOverQuantity, + addToCartFunction: addToCartFunction, + addToShoppingCartFunction: addToShoppingCartFunction, + model: model, ) - ], - ), - ), - bottomSheet: FooterWidget( - model.isStockAvailable, - widget.product.orderMaximumQuantity, - widget.product.orderMinimumQuantity, - model.stockQuantity, - widget.product, - quantity: quantity, - isOverQuantity: isOverQuantity, - addToCartFunction: addToCartFunction, - addToShoppingCartFunction: addToShoppingCartFunction, - model: model, - ), + : SizedBox(), )); } - addToShoppingCartFunction( - {quantity, itemID, ProductDetailViewModel model}) async { + addToShoppingCartFunction({quantity, itemID, ProductDetailViewModel model}) async { GifLoaderDialogUtils.showMyDialog(context); - await model.addToCartData(quantity, itemID); + await model.addToCartData(quantity, itemID, context); GifLoaderDialogUtils.hideDialog(context); + if(model.state != ViewState.ErrorLocal) + Utils.navigateToCartPage(); } addToWishlistFunction({itemID, ProductDetailViewModel model}) async { isInWishList = true; - await model.addToWishlistData(itemID); + await model.addToWishlistData(itemID, context); setState(() {}); } deleteFromWishlistFunction({itemID, ProductDetailViewModel model}) async { isInWishList = false; - await model.deleteWishlistData(itemID); + await model.deleteWishlistData(itemID, context); setState(() {}); } @@ -371,12 +358,11 @@ class __ProductDetailPageState extends State { ProductDetailViewModel model, }) async { GifLoaderDialogUtils.showMyDialog(context); - await model.addToCartData(quantity, itemID); + await model.addToCartData(quantity, itemID, context); GifLoaderDialogUtils.hideDialog(context); } } -notifyMeWhenAvailable( - {itemId, customerId, ProductDetailViewModel model}) async { - await model.notifyMe(customerId, itemId); +notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model, context}) async { + await model.notifyMe(customerId, itemId, context); } diff --git a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart index 9401f3e0..0f25b236 100644 --- a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart +++ b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart @@ -20,11 +20,12 @@ class ProductNameAndPrice extends StatefulWidget { final Function addToWishlistFunction; final Function deleteFromWishlistFunction; final bool isStockAvailable; + final String stockAvailability; AuthenticatedUserObject authenticatedUserObject = locator(); ProductNameAndPrice(this.context, this.item, - {this.customerId, this.isInWishList, this.notifyMeWhenAvailable, this.addToWishlistFunction, this.deleteFromWishlistFunction, @required this.isStockAvailable}); + {this.customerId, this.isInWishList, this.notifyMeWhenAvailable, this.addToWishlistFunction, this.deleteFromWishlistFunction, this.isStockAvailable = true, this.stockAvailability}); @override _ProductNameAndPriceState createState() => _ProductNameAndPriceState(); @@ -48,14 +49,14 @@ class _ProductNameAndPriceState extends State { children: [ Texts(widget.item.price.toString() + " " + TranslationBase.of(context).sar, fontWeight: FontWeight.bold, fontSize: 20), Texts( - projectViewModel.isArabic ? widget.item.stockAvailabilityn : widget.item.stockAvailability, + widget.stockAvailability, fontWeight: FontWeight.bold, fontSize: 15, color: widget.isStockAvailable ? Colors.green : Colors.red, ), // SizedBox(width: 20), if (widget.authenticatedUserObject.isLogin) - widget.isStockAvailable && widget.customerId != null + !widget.isStockAvailable && widget.customerId != null ? InkWell( onTap: () => widget.notifyMeWhenAvailable(context, widget.item.id), child: Row(children: [ @@ -128,11 +129,11 @@ class _ProductNameAndPriceState extends State { SizedBox( width: 10, ), - Texts( - "${widget.item.approvedRatingSum}", - fontWeight: FontWeight.bold, - fontSize: 12, - ), +// Texts( +// "${widget.item.approvedRatingSum}", +// fontWeight: FontWeight.bold, +// fontSize: 12, +// ), SizedBox( width: 30, ), diff --git a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart index 1626e24f..f58438cf 100644 --- a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart +++ b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart @@ -2,9 +2,11 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart' import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page_pharmcy.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/material.dart'; @@ -74,10 +76,13 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { icon: Icons.shopping_cart, color: Colors.grey[800], onPress: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => CartOrderPage()), - ); + + Navigator.pushAndRemoveUntil( + locator().navigatorKey.currentContext, MaterialPageRoute(builder: (context) => LandingPagePharmacy(currentTab: 3)), (Route r) => false); + // Navigator.push( + // context, + // MaterialPageRoute(builder: (context) => CartOrderPage()), + // ); }), if (Provider.of(context, listen: false) @@ -157,7 +162,9 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { Navigator.of(context).pop(); } } else { - AppToast.showErrorToast(message: "you should add quantity"); + AppToast.showErrorToast(message: TranslationBase.of(context).addQuantity + // "you should add quantity" + ); } }), ListTile( @@ -184,7 +191,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { ), onTap: () { Provider.of(context, listen: false) - .addItem(specificationData); + .addItem(specificationData,context); Navigator.of(context).pop(); }, ), diff --git a/lib/pages/pharmacies/screens/recommended-product-page.dart b/lib/pages/pharmacies/screens/recommended-product-page.dart index 4ea089fa..b04201e5 100644 --- a/lib/pages/pharmacies/screens/recommended-product-page.dart +++ b/lib/pages/pharmacies/screens/recommended-product-page.dart @@ -534,13 +534,13 @@ class _RecommendedProductPageState extends State addToWishlistFunction(itemID) async { ProductDetailViewModel x = new ProductDetailViewModel(); isInWishlist = true; - await x.addToWishlistData(itemID); + await x.addToWishlistData(itemID, context); } deleteFromWishlistFunction(itemID) async { ProductDetailViewModel x = new ProductDetailViewModel(); isInWishlist = false; - await x.addToWishlistData(itemID); + await x.addToWishlistData(itemID, context); } } diff --git a/lib/pages/pharmacies/search_brands_page.dart b/lib/pages/pharmacies/search_brands_page.dart index db9dbcb6..7ffe8d26 100644 --- a/lib/pages/pharmacies/search_brands_page.dart +++ b/lib/pages/pharmacies/search_brands_page.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/brand_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -9,6 +10,7 @@ import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:provider/provider.dart'; class SearchBrandsPage extends StatefulWidget { @override @@ -22,6 +24,7 @@ class _SearchBrandsPageState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); return BaseView( onModelReady: (model) => model.searchProducts(), builder: (BuildContext context, model, Widget child) => @@ -60,7 +63,7 @@ class _SearchBrandsPageState extends State { RegExp regExp = RegExp(r'([A-Za-z0-9 a space])'); if (value.isEmpty) { TranslationBase.of(context).pleaseEnterProductName; - }else if (regExp.hasMatch(value)){ + }else if (!regExp.hasMatch(value)){ AppToast.showErrorToast(message: TranslationBase.of(context).noArabicLetters); } return null; @@ -112,7 +115,7 @@ class _SearchBrandsPageState extends State { model.searchList.length == 0 ? Container( child: Text( - 'no data' + model.searchList.length.toString()), + TranslationBase.of(context).noData + model.searchList.length.toString()), ) : Expanded( child: Container( @@ -128,8 +131,9 @@ class _SearchBrandsPageState extends State { Padding( padding: const EdgeInsets.all(8.0), child: Container( - child: Text( - model.searchList[index].name, + child: Text( projectProvider.isArabic + ? model.searchList[index].namen + :model.searchList[index].name, style: TextStyle(fontSize: 20), ), ), diff --git a/lib/pages/pharmacies/widgets/ProductTileItem.dart b/lib/pages/pharmacies/widgets/ProductTileItem.dart index 278fc6aa..cb8560c4 100644 --- a/lib/pages/pharmacies/widgets/ProductTileItem.dart +++ b/lib/pages/pharmacies/widgets/ProductTileItem.dart @@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:rating_bar/rating_bar.dart'; class ProductTileItem extends StatelessWidget { final AppSharedPreferences sharedPref = AppSharedPreferences(); @@ -178,15 +179,31 @@ class ProductTileItem extends StatelessWidget { ), Row( children: [ - Expanded( - child: StarRating( - totalAverage: item.approvedTotalReviews > 0 - ? (item.approvedRatingSum.toDouble() / - item.approvedTotalReviews.toDouble()) - .toDouble() - : 0, - forceStars: true), - ), + // Expanded( + RatingBar.readOnly( + initialRating: item.approvedRatingSum.toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + Texts( + "(${item.approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ) +// StarRating( +// totalAverage: item.approvedTotalReviews > 0 +// ? (item.approvedRatingSum.toDouble() / +// item.approvedTotalReviews.toDouble()) +// .toDouble() +// : 0, +// forceStars: true), + // ), ], ), ], diff --git a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart index 61177d1f..1e993694 100644 --- a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart +++ b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart @@ -36,7 +36,7 @@ class PrescriptionsWidget extends StatelessWidget { ViewAllHomeWidget(TranslationBase.of(context).myPrescription, HomePrescriptionsPage()), Container( margin: EdgeInsets.only(right: 10.0, left: 10.0), - height: MediaQuery.of(context).size.height * 0.19, + height: MediaQuery.of(context).size.height * 0.30, child: ListView.builder( scrollDirection: Axis.horizontal, shrinkWrap: true, diff --git a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart index b763e960..85bc7cb8 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart @@ -1,7 +1,9 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/AddAddress.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -13,13 +15,24 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +///TODO Elham* split this to tow files class PharmacyAddressesPage extends StatefulWidget { + final OrderPreviewViewModel orderPreviewViewModel; + final Function changeMainState; + + final bool isUpdate; + + const PharmacyAddressesPage( + {Key key, this.orderPreviewViewModel, this.isUpdate = false, this.changeMainState}) + : super(key: key); + @override _PharmacyAddressesState createState() => _PharmacyAddressesState(); } class _PharmacyAddressesState extends State { - void navigateToAddressPage(BuildContext ctx, PharmacyAddressesViewModel model, AddressInfo address) { + void navigateToAddressPage( + BuildContext ctx, PharmacyAddressesViewModel model, AddressInfo address) { Navigator.push( ctx, FadePage( @@ -35,7 +48,7 @@ class _PharmacyAddressesState extends State { return BaseView( onModelReady: (model) => model.getAddressesList(), builder: (_, model, wi) => AppScaffold( - appBarTitle: TranslationBase.of(context).changeAddress, + appBarTitle: widget.isUpdate?TranslationBase.of(context).changeAddress:"Add Address", isShowAppBar: true, isPharmacy: true, baseViewModel: model, @@ -78,8 +91,9 @@ class _PharmacyAddressesState extends State { }, ), ), - SizedBox(height: height * 0.10,) - + SizedBox( + height: height * 0.10, + ) ], ), ), @@ -108,8 +122,14 @@ class _PharmacyAddressesState extends State { fontSize: 14, vPadding: 8, handler: () { - model.saveSelectedAddressLocally(model.addresses[model.selectedAddressIndex]); - Navigator.pop(context, model.addresses[model.selectedAddressIndex]); + //TODO Elham* + widget.orderPreviewViewModel.paymentCheckoutData + .address = + Addresses.fromJson( + model.addresses[model.selectedAddressIndex].toJson()); + model.saveSelectedAddressLocally( + model.addresses[model.selectedAddressIndex]); + _navigateToPaymentOption(model); }, ), ), @@ -119,6 +139,33 @@ class _PharmacyAddressesState extends State { ), ); } + + _navigateToPaymentOption(model) { + if(widget.isUpdate) { + print("sfsf"); + + widget.orderPreviewViewModel.paymentCheckoutData.address = Addresses.fromJson(model.addresses[model.selectedAddressIndex].toJson()); + widget.changeMainState(); + Navigator.pop(context); + + return; + } + Navigator.push( + context, + FadePage( + page: PaymentMethodSelectPage( + model: widget.orderPreviewViewModel, + ))).then((result) => { + setState(() { + if (result != null) { + var paymentOption = result; + widget.orderPreviewViewModel.paymentCheckoutData.paymentOption = + paymentOption; + } + // widget.changeMainState(); + }) + }); + } } class AddressItemWidget extends StatelessWidget { @@ -128,7 +175,8 @@ class AddressItemWidget extends StatelessWidget { final bool isSelected; final Function(AddressInfo) onTabEditAddress; - AddressItemWidget(this.model, this.address, this.selectAddress, this.isSelected, this.onTabEditAddress); + AddressItemWidget(this.model, this.address, this.selectAddress, + this.isSelected, this.onTabEditAddress); @override Widget build(BuildContext context) { @@ -154,13 +202,18 @@ class AddressItemWidget extends StatelessWidget { decoration: new BoxDecoration( color: !isSelected ? Colors.white : Colors.green, shape: BoxShape.circle, - border: Border.all(color: Colors.grey, style: BorderStyle.solid, width: 1.0), + border: Border.all( + color: Colors.grey, + style: BorderStyle.solid, + width: 1.0), ), child: Padding( padding: const EdgeInsets.all(0.0), child: Icon( Icons.check, - color: isSelected ? Colors.white : Colors.transparent, + color: isSelected + ? Colors.white + : Colors.transparent, size: 25, ), ), @@ -173,7 +226,8 @@ class AddressItemWidget extends StatelessWidget { Expanded( child: Container( child: Container( - margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + margin: + EdgeInsets.symmetric(vertical: 12, horizontal: 12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -236,7 +290,8 @@ class AddressItemWidget extends StatelessWidget { ), ), Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), + padding: + const EdgeInsets.symmetric(horizontal: 8), child: SizedBox( child: Container( width: 1, @@ -254,13 +309,21 @@ class AddressItemWidget extends StatelessWidget { ConfirmDialog dialog = new ConfirmDialog( context: context, title: "Are you sure want to delete", - confirmMessage: "${address.address1} ${address.address2}", - okText: TranslationBase.of(context).delete, - cancelText: TranslationBase.of(context).cancel_nocaps, + confirmMessage: + "${address.address1} ${address.address2}", + okText: + TranslationBase.of(context).delete, + cancelText: TranslationBase.of(context) + .cancel_nocaps, okFunction: () => { - model.deleteAddresses(address).then((_) { - ConfirmDialog.closeAlertDialog(context); - AppToast.showErrorToast(message: "Address has been deleted"); + model + .deleteAddresses(address) + .then((_) { + ConfirmDialog.closeAlertDialog( + context); + AppToast.showErrorToast( + message: + "Address has been deleted"); }) }, cancelFunction: () => {}); diff --git a/lib/pages/pharmacy_categorise.dart b/lib/pages/pharmacy_categorise.dart index 8a965b6e..9ed1070f 100644 --- a/lib/pages/pharmacy_categorise.dart +++ b/lib/pages/pharmacy_categorise.dart @@ -80,7 +80,8 @@ class _PharmacyCategorisePageState extends State { page: model.categorise[index].id != '12' ? ParentCategorisePage( id: model.categorise[index].id, - titleName: model.categorise[index].name, + titleName: projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name, + // titleName: model.categorise[index].name, ) : FinalProductsPage( id: model.categorise[index].id, diff --git a/lib/pages/search_products_page.dart b/lib/pages/search_products_page.dart index b7f08378..8ec9f014 100644 --- a/lib/pages/search_products_page.dart +++ b/lib/pages/search_products_page.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; // import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -13,6 +14,7 @@ import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:provider/provider.dart'; import 'base/base_view.dart'; @@ -28,6 +30,7 @@ class _SearchProductsPageState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); return BaseView( onModelReady: (model) => model.clearSearchList(), builder: (BuildContext context, PharmacyCategoriseViewModel model, @@ -67,7 +70,7 @@ class _SearchProductsPageState extends State { if (value.isEmpty) { TranslationBase.of(context) .pleaseEnterProductName; - } else if (regExp.hasMatch(value)) { + } else if (!regExp.hasMatch(value)) { AppToast.showErrorToast( message: TranslationBase.of(context) .noArabicLetters); @@ -220,19 +223,29 @@ class _SearchProductsPageState extends State { Radius.circular( 6)), ), - child: Texts( - model.searchList[index] - .rxMessage != - null - ? model - .searchList[index] - .rxMessage - : "", + child: model.searchList[index].rxMessage != null + ? Texts( + projectProvider.isArabic + ? model.searchList[index].rxMessagen + : model.searchList[index].rxMessage, color: Colors.white, regular: true, fontSize: 10, fontWeight: FontWeight.w400, - ), + ): Texts(""), +// Texts( +// model.searchList[index] +// .rxMessage != +// null +// ? model +// .searchList[index] +// .rxMessage +// : "", +// color: Colors.white, +// regular: true, +// fontSize: 10, +// fontWeight: FontWeight.w400, +// ), ), ], ), @@ -245,9 +258,11 @@ class _SearchProductsPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( - model - .searchList[index].name, + Texts(projectProvider.isArabic + ? model.searchList[index].namen + :model.searchList[index].name, + + // model.searchList[index].name, regular: true, fontSize: 12, fontWeight: FontWeight.w400, diff --git a/lib/pages/sub_categorise_page.dart b/lib/pages/sub_categorise_page.dart index 64437611..92b20476 100644 --- a/lib/pages/sub_categorise_page.dart +++ b/lib/pages/sub_categorise_page.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; @@ -9,15 +10,16 @@ import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/entity_checkbox_list.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; import 'base/base_view.dart'; @@ -28,14 +30,12 @@ class SubCategorisePage extends StatefulWidget { String title; String parentId; - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); SubCategorisePage({this.id, this.parentId, this.title}); @override - _SubCategorisePageState createState() => - _SubCategorisePageState(id: id, title: title, parentId: parentId); + _SubCategorisePageState createState() => _SubCategorisePageState(id: id, title: title, parentId: parentId); } class _SubCategorisePageState extends State { @@ -62,18 +62,16 @@ class _SubCategorisePageState extends State { Widget build(BuildContext context) { TextEditingController minField = TextEditingController(); TextEditingController maxField = TextEditingController(); + ProjectViewModel projectViewModel = Provider.of(context); + ProjectViewModel projectProvider = Provider.of(context); return BaseView( - allowAny: true, onModelReady: (model) => model.getSubCategorise(i: id), - builder: (BuildContext context, PharmacyCategoriseViewModel model, - Widget child) => - AppScaffold( + builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold( appBarTitle: title, isBottomBar: false, isShowAppBar: true, - isPharmacy: true, - isShowDecPage: false, backgroundColor: Colors.white, + isShowDecPage: false, baseViewModel: model, body: SingleChildScrollView( child: Container( @@ -100,8 +98,7 @@ class _SubCategorisePageState extends State { ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' : parentId == '9' ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' - : parentId == - '10' + : parentId == '10' ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' : '', fit: BoxFit.fill, @@ -113,14 +110,12 @@ class _SubCategorisePageState extends State { children: [ InkWell( child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Padding( padding: EdgeInsets.all(10.0), child: Container( - child: Texts(TranslationBase.of(context) - .viewCategorise), + child: Texts(TranslationBase.of(context).viewCategorise), ), ), Icon(Icons.arrow_forward) @@ -132,30 +127,23 @@ class _SubCategorisePageState extends State { context: context, builder: (BuildContext context) { return Container( - height: - MediaQuery.of(context).size.height * - 0.89, + height: MediaQuery.of(context).size.height * 0.89, color: Colors.white, child: Center( child: ListView.builder( scrollDirection: Axis.vertical, - itemCount: - model.subCategorise.length, - itemBuilder: (BuildContext context, - int index) { + itemCount: model.subCategorise.length, + itemBuilder: (BuildContext context, int index) { return Container( child: Padding( padding: EdgeInsets.all(8.0), child: InkWell( child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(model - .subCategorise[ - index] - .name), + Texts(projectViewModel.isArabic ? model.subCategorise[index].namen : model.subCategorise[index].name, +// model.subCategorise[index].name + ), Divider( thickness: 0.6, color: Colors.black12, @@ -166,12 +154,8 @@ class _SubCategorisePageState extends State { Navigator.push( context, FadePage( - page: - FinalProductsPage( - id: model - .subCategorise[ - index] - .id, + page: FinalProductsPage( + id: model.subCategorise[index].id, ), ), ); @@ -204,23 +188,19 @@ class _SubCategorisePageState extends State { itemCount: model.subCategorise.length, itemBuilder: (BuildContext context, int index) { return Padding( - padding: - EdgeInsets.symmetric(horizontal: 8.0), + padding: EdgeInsets.symmetric(horizontal: 8.0), child: InkWell( child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Padding( - padding: EdgeInsets.symmetric( - horizontal: 13.0), + padding: EdgeInsets.symmetric(horizontal: 13.0), child: Container( height: 60.0, width: 65.0, decoration: BoxDecoration( shape: BoxShape.circle, - color: Colors.orange.shade200 - .withOpacity(0.45), + color: Colors.orange.shade200.withOpacity(0.45), ), child: Center( child: Icon( @@ -231,17 +211,12 @@ class _SubCategorisePageState extends State { ), ), Container( - width: MediaQuery.of(context) - .size - .width * - 0.17, - height: MediaQuery.of(context) - .size - .height * - 0.10, + width: MediaQuery.of(context).size.width * 0.17, + height: MediaQuery.of(context).size.height * 0.10, child: Center( child: Texts( - model.subCategorise[index].name, + projectViewModel.isArabic ? model.subCategorise[index].namen : model.subCategorise[index].name, + // model.subCategorise[index].name, fontSize: 14, fontWeight: FontWeight.w600, maxLines: 2, @@ -299,21 +274,16 @@ class _SubCategorisePageState extends State { initialChildSize: 0.95, maxChildSize: 0.95, minChildSize: 0.9, - builder: (BuildContext context, - ScrollController scrollController) { + builder: (BuildContext context, ScrollController scrollController) { return SingleChildScrollView( controller: scrollController, child: Container( color: Colors.white, - height: MediaQuery.of(context) - .size - .height * - 1.95, + height: MediaQuery.of(context).size.height * 1.95, child: Column( children: [ Padding( - padding: - EdgeInsets.all(8.0), + padding: EdgeInsets.all(8.0), child: Row( children: [ Icon( @@ -323,30 +293,23 @@ class _SubCategorisePageState extends State { width: 10.0, ), Texts( - TranslationBase.of( - context) - .refine, + TranslationBase.of(context).refine, // 'Refine', - fontWeight: - FontWeight.w600, + fontWeight: FontWeight.w600, ), SizedBox( width: 250.0, ), InkWell( child: Texts( - TranslationBase.of( - context) - .closeIt, + TranslationBase.of(context).closeIt, // 'Close', color: Colors.red, - fontWeight: - FontWeight.w600, + fontWeight: FontWeight.w600, fontSize: 15.0, ), onTap: () { - Navigator.pop( - context); + Navigator.pop(context); }, ), ], @@ -359,39 +322,26 @@ class _SubCategorisePageState extends State { Column( children: [ ExpansionTile( - title: Texts( - TranslationBase.of( - context) - .categorise), + title: Texts(TranslationBase.of(context).categorise), children: [ ProcedureListWidget( model: model, - masterList: model - .subCategorise, - removeHistory: - (item) { + masterList: model.subCategorise, + removeHistory: (item) { setState(() { - entityList - .remove( - item); + entityList.remove(item); }); }, - addHistory: - (history) { + addHistory: (history) { setState(() { - entityList.add( - history); + entityList.add(history); }); }, - addSelectedHistories: - () { + addSelectedHistories: () { //TODO build your fun herr // widget.addSelectedHistories(); }, - isEntityListSelected: - (master) => - isEntityListSelected( - master), + isEntityListSelected: (master) => isEntityListSelected(master), ) ], ), @@ -400,40 +350,26 @@ class _SubCategorisePageState extends State { color: Colors.black12, ), ExpansionTile( - title: Texts( - TranslationBase.of( - context) - .brands), + title: Texts(TranslationBase.of(context).brands), children: [ ProcedureListWidget( model: model, - masterList: model - .brandsList, - removeHistory: - (item) { + masterList: model.brandsList, + removeHistory: (item) { setState(() { - entityListBrands - .remove( - item); + entityListBrands.remove(item); }); }, - addHistory: - (history) { + addHistory: (history) { setState(() { - entityListBrands - .add( - history); + entityListBrands.add(history); }); }, - addSelectedHistories: - () { + addSelectedHistories: () { //TODO build your fun herr // widget.addSelectedHistories(); }, - isEntityListSelected: - (master) => - isEntityListSelectedBrands( - master), + isEntityListSelected: (master) => isEntityListSelectedBrands(master), ) ], ), @@ -442,69 +378,43 @@ class _SubCategorisePageState extends State { color: Colors.black12, ), ExpansionTile( - title: Texts( - TranslationBase.of( - context) - .price), + title: Texts(TranslationBase.of(context).price), children: [ Container( - color: Color( - 0xffEEEEEE), + color: Color(0xffEEEEEE), child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, + mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Column( - mainAxisAlignment: - MainAxisAlignment - .start, + mainAxisAlignment: MainAxisAlignment.start, children: [ - Texts( - 'Min'), + Texts(TranslationBase.of(context).min), Container( - color: Colors - .white, - width: - 200, - height: - 40, - child: - TextFormField( - decoration: - InputDecoration( - border: - OutlineInputBorder(), + color: Colors.white, + width: 200, + height: 40, + child: TextFormField( + decoration: InputDecoration( + border: OutlineInputBorder(), ), - controller: - minField, + controller: minField, ), ), ], ), Column( - mainAxisAlignment: - MainAxisAlignment - .start, + mainAxisAlignment: MainAxisAlignment.start, children: [ - Texts( - 'Max'), + Texts(TranslationBase.of(context).max), Container( - color: Colors - .white, - width: - 200, - height: - 40, - child: - TextFormField( - decoration: - InputDecoration( - border: - OutlineInputBorder(), + color: Colors.white, + width: 200, + height: 40, + child: TextFormField( + decoration: InputDecoration( + border: OutlineInputBorder(), ), - controller: - maxField, + controller: maxField, ), ), ], @@ -519,31 +429,20 @@ class _SubCategorisePageState extends State { color: Colors.black12, ), SizedBox( - height: MediaQuery.of( - context) - .size - .height * - 0.4, + height: MediaQuery.of(context).size.height * 0.4, ), Padding( - padding: - EdgeInsets.all(8.0), + padding: EdgeInsets.all(8.0), child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceEvenly, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Expanded( child: Container( width: 100, child: Button( - label: TranslationBase.of( - context) - .reset, + label: TranslationBase.of(context).reset, // 'Reset', - backgroundColor: - Colors - .red, + backgroundColor: Colors.red, ), ), ), @@ -553,66 +452,33 @@ class _SubCategorisePageState extends State { Container( width: 200, child: Button( - onTap: - () async { - String - categoriesId = - ""; - for (CategoriseParentModel category - in entityList) { - if (categoriesId == - "") { - categoriesId = - category - .id; + onTap: () async { + String categoriesId = ""; + for (CategoriseParentModel category in entityList) { + if (categoriesId == "") { + categoriesId = category.id; } else { - categoriesId = - "$categoriesId,${category.id}"; + categoriesId = "$categoriesId,${category.id}"; } } - String - brandIds = - ""; - for (CategoriseParentModel brand - in entityListBrands) { - if (brandIds == - "") { - brandIds = - brand - .id; + String brandIds = ""; + for (CategoriseParentModel brand in entityListBrands) { + if (brandIds == "") { + brandIds = brand.id; } else { - brandIds = - "$brandIds,${brand.id}"; + brandIds = "$brandIds,${brand.id}"; } } - GifLoaderDialogUtils - .showMyDialog( - context); + GifLoaderDialogUtils.showMyDialog(context); await model.getFilteredSubProducts( - min: minField - .text - .toString(), - max: maxField - .text - .toString(), - categoryId: - categoriesId, - brandId: - brandIds); - GifLoaderDialogUtils - .hideDialog( - context); - Navigator.pop( - context); + min: minField.text.toString(), max: maxField.text.toString(), categoryId: categoriesId, brandId: brandIds); + GifLoaderDialogUtils.hideDialog(context); + Navigator.pop(context); }, - label: TranslationBase.of( - context) - .apply, + label: TranslationBase.of(context).apply, // 'Apply', - backgroundColor: - Colors - .green, + backgroundColor: Colors.green, ), ), ], @@ -679,30 +545,22 @@ class _SubCategorisePageState extends State { model.subProducts.isNotEmpty ? styleOne == true ? Container( - height: model.subProducts.length * - MediaQuery.of(context).size.height * - 0.15, + height: model.subProducts.length * MediaQuery.of(context).size.height * 0.15, child: GridView.builder( physics: NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 0.5, mainAxisSpacing: 2.0, childAspectRatio: 0.9, ), itemCount: model.subProducts.length, - itemBuilder: - (BuildContext context, int index) { + itemBuilder: (BuildContext context, int index) { return NetworkBaseView( baseViewModel: model, child: InkWell( child: Card( - color: model.subProducts[index] - .discountName != - null - ? Color(0xffFFFF00) - : Colors.white, + color: model.subProducts[index].discountName != null ? Color(0xffFFFF00) : Colors.white, elevation: 0, shape: Border( right: BorderSide( @@ -728,118 +586,73 @@ class _SubCategorisePageState extends State { ), child: Container( decoration: BoxDecoration( - borderRadius: - BorderRadius.only( - topLeft: - Radius.circular(110.0), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(110.0), ), color: Colors.white, ), - padding: EdgeInsets.symmetric( - horizontal: 0), - width: MediaQuery.of(context) - .size - .width / - 3, + padding: EdgeInsets.symmetric(horizontal: 0), + width: MediaQuery.of(context).size.width / 3, child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Stack( children: [ Container( - margin: EdgeInsets - .fromLTRB( - 0, 16, 0, 0), - alignment: - Alignment.center, + margin: EdgeInsets.fromLTRB(0, 16, 0, 0), + alignment: Alignment.center, child: Image.network( - model - .subProducts[ - index] - .images - .isNotEmpty - ? model - .subProducts[ - index] - .images[0] - .thumb + model.subProducts[index].images.isNotEmpty + ? model.subProducts[index].images[0].thumb : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', fit: BoxFit.cover, height: 80, ), ), Container( - width: model - .subProducts[ - index] - .rxMessage != - null - ? MediaQuery.of( - context) - .size - .width / - 5 - : 0, - padding: - EdgeInsets.all(4), - decoration: - BoxDecoration( - color: Color( - 0xffb23838), - borderRadius: - BorderRadius.only( - topLeft: Radius - .circular( - 6)), + width: model.subProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 5 : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), ), - child: Texts( - model - .subProducts[ - index] - .rxMessage != - null - ? model - .subProducts[ - index] - .rxMessage - : "", + child:model.subProducts[index].rxMessage != null ? + Texts(projectProvider.isArabic + ? model.subProducts[index].rxMessagen + : model.subProducts[index].rxMessage, color: Colors.white, regular: true, fontSize: 10, - fontWeight: - FontWeight.w400, - ), + fontWeight: FontWeight.w400, + ) + : Texts(""), +// Texts( +// model.subProducts[index].rxMessage != null ? model.subProducts[index].rxMessage : "", +// color: Colors.white, +// regular: true, +// fontSize: 10, +// fontWeight: FontWeight.w400, +// ), ), ], ), Container( - margin: - EdgeInsets.symmetric( + margin: EdgeInsets.symmetric( horizontal: 6, vertical: 0, ), child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - model - .subProducts[ - index] - .name, + projectViewModel.isArabic ? model.subProducts[index].namen : model.subProducts[index].name, +// model.subProducts[index].name, regular: true, fontSize: 12, - fontWeight: - FontWeight.w400, + fontWeight: FontWeight.w400, ), Padding( - padding: - const EdgeInsets - .only( - top: 4, - bottom: 4), + padding: const EdgeInsets.only(top: 4, bottom: 4), child: Texts( "SAR ${model.subProducts[index].price}", bold: true, @@ -853,37 +666,21 @@ class _SubCategorisePageState extends State { // ? (model.subProducts[index].approvedRatingSum.toDouble() / model.subProducts[index].approvedRatingSum.toDouble()).toDouble() // : 0, // forceStars: true), - RatingBar - .readOnly( - initialRating: model - .subProducts[ - index] - .approvedRatingSum - .toDouble(), + RatingBar.readOnly( + initialRating: model.subProducts[index].approvedRatingSum.toDouble(), size: 15.0, - filledColor: - Colors.yellow[ - 700], - emptyColor: - Colors.grey[ - 500], - isHalfAllowed: - true, - halfFilledIcon: - Icons - .star_half, - filledIcon: - Icons.star, - emptyIcon: - Icons.star, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, ), Texts( "(${model.subProducts[index].approvedTotalReviews})", regular: true, fontSize: 10, - fontWeight: - FontWeight - .w400, + fontWeight: FontWeight.w400, ) ], ), @@ -898,9 +695,7 @@ class _SubCategorisePageState extends State { Navigator.push( context, FadePage( - page: ProductDetailPage( - model.subProducts[ - index]), + page: ProductDetailPage(model.subProducts[index]), )), }, )); @@ -908,14 +703,11 @@ class _SubCategorisePageState extends State { ), ) : Container( - height: model.subProducts.length * - MediaQuery.of(context).size.height * - 0.122, + height: model.subProducts.length * MediaQuery.of(context).size.height * 0.122, child: ListView.builder( physics: NeverScrollableScrollPhysics(), itemCount: model.subProducts.length, - itemBuilder: - (BuildContext context, int index) { + itemBuilder: (BuildContext context, int index) { return InkWell( child: Card( child: Row( @@ -925,11 +717,9 @@ class _SubCategorisePageState extends State { Column( children: [ Container( - decoration: - BoxDecoration(), + decoration: BoxDecoration(), child: Padding( - padding: - EdgeInsets.only( + padding: EdgeInsets.only( left: 9.0, top: 8.0, right: 10.0, @@ -937,75 +727,44 @@ class _SubCategorisePageState extends State { ), ), Container( - margin: EdgeInsets - .fromLTRB( - 0, 0, 0, 0), - alignment: - Alignment.center, - child: model - .subProducts[ - index] - .images - .isNotEmpty + margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + alignment: Alignment.center, + child: model.subProducts[index].images.isNotEmpty ? Image.network( - model - .subProducts[ - index] - .images[0] - .thumb, - fit: BoxFit - .contain, - height: 70, - ) - : Text(TranslationBase - .of(context) - .noImage), + model.subProducts[index].images[0].thumb, + fit: BoxFit.contain, + height: 70, + ) + : Text(TranslationBase.of(context).noImage), ), ], ), Column( children: [ Container( - width: model - .subProducts[ - index] - .rxMessage != - null - ? MediaQuery.of( - context) - .size - .width / - 5.3 - : 0, - padding: - EdgeInsets.all(4), - decoration: - BoxDecoration( - color: Color( - 0xffb23838), - borderRadius: - BorderRadius.only( - topLeft: Radius - .circular( - 6)), + width: model.subProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 5.3 : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), ), - child: Texts( - model - .subProducts[ - index] - .rxMessage != - null - ? model - .subProducts[ - index] - .rxMessage - : "", + child: model.subProducts[index].rxMessage != null ? + Texts(projectProvider.isArabic + ? model.subProducts[index].rxMessagen + : model.subProducts[index].rxMessage, color: Colors.white, regular: true, fontSize: 10, - fontWeight: - FontWeight.w400, - ), + fontWeight: FontWeight.w400, + ) + : Texts(""), +// Texts( +// model.subProducts[index].rxMessage != null ? model.subProducts[index].rxMessage : "", +// color: Colors.white, +// regular: true, +// fontSize: 10, +// fontWeight: FontWeight.w400, +// ), ), ], ), @@ -1018,31 +777,20 @@ class _SubCategorisePageState extends State { vertical: 0, ), child: Column( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - crossAxisAlignment: - CrossAxisAlignment - .start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 4.0, ), Container( - width: MediaQuery.of( - context) - .size - .width * - 0.65, + width: MediaQuery.of(context).size.width * 0.65, child: Texts( - model - .subProducts[ - index] - .name, + projectViewModel.isArabic ? model.subProducts[index].namen : model.subProducts[index].name, + // model.subProducts[index].name, regular: true, fontSize: 13.2, - fontWeight: - FontWeight.w500, + fontWeight: FontWeight.w500, maxLines: 5, ), ), @@ -1050,11 +798,7 @@ class _SubCategorisePageState extends State { height: 8.0, ), Padding( - padding: - const EdgeInsets - .only( - top: 4, - bottom: 4), + padding: const EdgeInsets.only(top: 4, bottom: 4), child: Texts( "SAR ${model.subProducts[index].price}", bold: true, @@ -1069,77 +813,41 @@ class _SubCategorisePageState extends State { // : 0, // forceStars: true), RatingBar.readOnly( - initialRating: model - .subProducts[ - index] - .approvedRatingSum - .toDouble(), + initialRating: model.subProducts[index].approvedRatingSum.toDouble(), size: 15.0, - filledColor: Colors - .yellow[700], - emptyColor: Colors - .grey[500], + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], isHalfAllowed: true, - halfFilledIcon: - Icons.star_half, - filledIcon: - Icons.star, - emptyIcon: - Icons.star, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, ), Texts( "(${model.subProducts[index].approvedTotalReviews})", regular: true, fontSize: 10, - fontWeight: - FontWeight.w400, + fontWeight: FontWeight.w400, ) ], ), ], ), ), - widget.authenticatedUserObject - .isLogin + widget.authenticatedUserObject.isLogin ? Container( child: IconButton( icon: Icon( - Icons - .shopping_cart, + Icons.shopping_cart, size: 18, - color: - CustomColors - .green, + color: CustomColors.green, ), - onPressed: - () async { - if (model - .subProducts[ - index] - .rxMessage == - null) { - GifLoaderDialogUtils - .showMyDialog( - context); - await addToCartFunction( - 1, - model - .subProducts[ - index] - .id); - GifLoaderDialogUtils - .hideDialog( - context); - Navigator.push( - context, - FadePage( - page: - CartOrderPage())); - } else { - AppToast.showErrorToast( - message: TranslationBase.of( - context) - .needPrescription); + onPressed: () async { + if (model.subProducts[index].rxMessage == null) { + GifLoaderDialogUtils.showMyDialog(context); + await addToCartFunction(1, model.subProducts[index].id); + GifLoaderDialogUtils.hideDialog(context); + Utils.navigateToCartPage(); } else { + AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); } }), ) @@ -1151,8 +859,7 @@ class _SubCategorisePageState extends State { Navigator.push( context, FadePage( - page: ProductDetailPage( - model.subProducts[index]), + page: ProductDetailPage(model.subProducts[index]), )), }, ); @@ -1177,7 +884,7 @@ class _SubCategorisePageState extends State { Padding( padding: const EdgeInsets.all(8.0), child: Text( - 'There is no data', + TranslationBase.of(context).noData, style: TextStyle(fontSize: 30), ), ) @@ -1194,8 +901,7 @@ class _SubCategorisePageState extends State { } bool isEntityListSelected(CategoriseParentModel masterKey) { - Iterable history = - entityList.where((element) => masterKey.id == element.id); + Iterable history = entityList.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } @@ -1203,8 +909,7 @@ class _SubCategorisePageState extends State { } bool isEntityListSelectedBrands(CategoriseParentModel masterKey) { - Iterable history = - entityListBrands.where((element) => masterKey.id == element.id); + Iterable history = entityListBrands.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } @@ -1213,6 +918,6 @@ class _SubCategorisePageState extends State { addToCartFunction(quantity, itemID) async { ProductDetailViewModel x = new ProductDetailViewModel(); - await x.addToCartData(quantity, itemID); + await x.addToCartData(quantity, itemID, context); } } diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index ef7ad14d..cc151c7b 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -140,7 +140,7 @@ class FamilyFilesProvider with ChangeNotifier { } } - Future sendActivationCode(cellNumber, zipCode, patientIdentificationID) async { + Future sendActivationCode(cellNumber, zipCode, patientIdentificationID, responseID) async { try { dynamic localRes; var request = SendActivationRequest(); @@ -151,6 +151,8 @@ class FamilyFilesProvider with ChangeNotifier { request.loginType = request.searchType = 1; request.oTPSendType = 1; request.isRegister = false; + request.responseID = responseID; + request.status = 2; await new BaseAppClient().post(SEND_FAMILY_FILE_ACTIVATION, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { @@ -166,7 +168,7 @@ class FamilyFilesProvider with ChangeNotifier { } //TODO - Future checkActivationCode(loginTokenID, activationCode, indentification, mobileNo) async { + Future checkActivationCode(loginTokenID, activationCode, indentification, mobileNo, requestID, responseID) async { try { dynamic localRes; Map request = {}; @@ -175,6 +177,10 @@ class FamilyFilesProvider with ChangeNotifier { request['PatientIdentificationID'] = indentification; request['LogInTokenID'] = loginTokenID; request['activationCode'] = activationCode; + request['PatientShareRequestID'] = requestID; + request['ResponseID'] = responseID; + request['Status'] = 3; + // this.authService.authenticateRequest(request); await new BaseAppClient().post(CHECK_ACTIVATION_CODE, onSuccess: (dynamic response, int statusCode) { localRes = response; diff --git a/lib/services/pharmacy_services/product_detail_service.dart b/lib/services/pharmacy_services/product_detail_service.dart index 23379914..47fefded 100644 --- a/lib/services/pharmacy_services/product_detail_service.dart +++ b/lib/services/pharmacy_services/product_detail_service.dart @@ -2,15 +2,12 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; -import 'package:diplomaticquarterapp/models/pharmacy/addToCartModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/models/pharmacy/specification.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; class ProductDetailService extends BaseService { bool isLogin = false; @@ -20,8 +17,10 @@ class ProductDetailService extends BaseService { num get stockQuantity => _stockQuantity; String _stockAvailability; + String _stockAvailabilityn; String get stockAvailability => _stockAvailability; + String get stockAvailabilityn => _stockAvailabilityn; bool _isStockAvailable; @@ -49,7 +48,7 @@ class ProductDetailService extends BaseService { Future getProductReviews(productID) async { hasError = false; - await baseAppClient.getPharmacy(GET_PRODUCT_DETAIL + productID + "?fields=reviews,stock_quantity,stock_availability,IsStockAvailable", onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy(GET_PRODUCT_DETAIL + productID + "?fields=reviews,stock_quantity,stock_availability,stock_availabilityn,IsStockAvailable", onSuccess: (dynamic response, int statusCode) { _productDetailList.clear(); response['products'].forEach((item) { _productDetailList.add(ProductDetail.fromJson(item)); @@ -57,7 +56,10 @@ class ProductDetailService extends BaseService { }); _stockQuantity = response['products'][0]['stock_quantity']; _stockAvailability = response['products'][0]['stock_availability']; - _isStockAvailable = response['products'][0]['IsStockAvailable']; + _stockAvailabilityn = response['products'][0]['stock_availabilityn']; + + // _isStockAvailable = response['products'][0]['IsStockAvailable']; + _isStockAvailable = _stockAvailability == "In stock" ? true : false; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -93,7 +95,7 @@ class ProductDetailService extends BaseService { }, body: request); } - Future addToCart(quantity, itemID) async { + Future addToCart(quantity, itemID, context) async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); hasError = false; Map request; @@ -108,7 +110,9 @@ class ProductDetailService extends BaseService { response['shopping_carts'].forEach((item) { _addToCartModel.add(Wishlist.fromJson(item)); }); - AppToast.showSuccessToast(message: 'You have added a product to the cart'); + AppToast.showSuccessToast(message: TranslationBase.of(context).addToCartMsg + // 'You have added a product to the cart' + ); localRes = response; }, onFailure: (String error, int statusCode) { hasError = true; @@ -119,10 +123,12 @@ class ProductDetailService extends BaseService { return Future.value(localRes); } - Future notifyMe(customerId, itemID) async { + Future notifyMe(customerId, itemID, context) async { hasError = false; await baseAppClient.getPharmacy(SUBSCRIBE_PRODUCT + "SinceId=$customerId&ProductId=$itemID", onSuccess: (dynamic response, int statusCode) { - AppToast.showSuccessToast(message: 'You will be notified when product available'); + AppToast.showSuccessToast(message: TranslationBase.of(context).notifyMeMsg + //'You will be notified when product available' + ); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -130,7 +136,7 @@ class ProductDetailService extends BaseService { }); } - Future addToWishlist(itemID) async { + Future addToWishlist(itemID, context) async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); hasError = false; Map request; @@ -143,7 +149,9 @@ class ProductDetailService extends BaseService { response['shopping_carts'].forEach((item) { _wishListProducts.add(Wishlist.fromJson(item)); }); - AppToast.showSuccessToast(message: 'You have added a product to the Wishlist'); + AppToast.showSuccessToast(message: TranslationBase.of(context).addToWishlistMsg + // 'You have added a product to the Wishlist' + ); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -165,7 +173,7 @@ class ProductDetailService extends BaseService { }); } - Future deleteItemFromWishlist(itemID) async { + Future deleteItemFromWishlist(itemID, context) async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); hasError = false; await baseAppClient.getPharmacy(DELETE_WISHLIST + customerId + "+&product_id=" + itemID + "&cart_type=Wishlist", onSuccess: (dynamic response, int statusCode) { @@ -173,7 +181,9 @@ class ProductDetailService extends BaseService { response['shopping_carts'].forEach((item) { _wishListProducts.add(Wishlist.fromJson(item)); }); - AppToast.showSuccessToast(message: 'You have removed a product from the Wishlist'); + AppToast.showSuccessToast(message: TranslationBase.of(context).removeFromWishlistMsg + // 'You have removed a product from the Wishlist' + ); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index a406d420..94fbf76f 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -509,7 +509,7 @@ class TranslationBase { String get switchUser => localizedValues['switch-login'][locale.languageCode]; - String get removeMember => localizedValues['remove-member'][locale.languageCode]; + String get removeMember => localizedValues['remove-membe'][locale.languageCode]; String get allowView => localizedValues['allow-view'][locale.languageCode]; @@ -1206,6 +1206,26 @@ class TranslationBase { String get refine => localizedValues['refine'][locale.languageCode]; + String get max => localizedValues['max'][locale.languageCode]; + + String get min => localizedValues['min'][locale.languageCode]; + + String get addToCompareMsg => localizedValues['addToCompareMsg'][locale.languageCode]; + + String get itInListMsg => localizedValues['itInListMsg'][locale.languageCode]; + + String get compareListFull => localizedValues['compareListFull'][locale.languageCode]; + + String get addQuantity => localizedValues['addQuantity'][locale.languageCode]; + + String get addToCartMsg => localizedValues['addToCartMsg'][locale.languageCode]; + + String get addToWishlistMsg => localizedValues['addToWishlistMsg'][locale.languageCode]; + + String get notifyMeMsg => localizedValues['notifyMeMsg'][locale.languageCode]; + + String get removeFromWishlistMsg => localizedValues['removeFromWishlistMsg'][locale.languageCode]; + String get apply => localizedValues['apply'][locale.languageCode]; String get reset => localizedValues['reset'][locale.languageCode]; @@ -1770,8 +1790,6 @@ class TranslationBase { String get requestSent => localizedValues['request-sent'][locale.languageCode]; - String get submitReview => localizedValues['submitReview'][locale.languageCode]; - String get attachInsuraceImage => localizedValues['attach-insurace-image'][locale.languageCode]; String get infoInsurCards => localizedValues['info-insur-cards'][locale.languageCode]; @@ -2692,6 +2710,73 @@ class TranslationBase { String get dietUSDA => localizedValues["dietUSDA"][locale.languageCode]; String get dietZone => localizedValues["dietZone"][locale.languageCode]; + + String get useFullInfo => localizedValues["usefulInfo"][locale.languageCode]; + + String get babyAge => localizedValues["babyAge"][locale.languageCode]; + + String get babyAgeAvail => localizedValues["babyAgeAvail"][locale.languageCode]; + + String get deliveryDue => localizedValues["deliveryDue"][locale.languageCode]; + + String get almostInactive => localizedValues["almostInactive"][locale.languageCode]; + + String get lightActive1 => localizedValues["lightActive1"][locale.languageCode]; + + String get veryActive => localizedValues["veryActive"][locale.languageCode]; + + String get superActive => localizedValues["superActive"][locale.languageCode]; + + String get dailyIntake => localizedValues["dailyIntake"][locale.languageCode]; + + String get calculateAmount => localizedValues["calculateAmount"][locale.languageCode]; + + String get bodyWillBurn => localizedValues["bodyWillBurn"][locale.languageCode]; + + String get caloriesEachDay => localizedValues["caloriesEachDay"][locale.languageCode]; + + String get maintainWeight => localizedValues["maintainWeight"][locale.languageCode]; + + String get mediumFinger => localizedValues["mediumFinger"][locale.languageCode]; + + String get smallFinger => localizedValues["smallFinger"][locale.languageCode]; + + String get largeFinger => localizedValues["largeFinger"][locale.languageCode]; + + String get idealBodyWeight => localizedValues["idealBodyWeight"][locale.languageCode]; + + String get bodyFrameSize => localizedValues["bodyFrameSize"][locale.languageCode]; + + String get idealWeightRange => localizedValues["idealWeightRange"][locale.languageCode]; + + String get currentWeightPerfect => localizedValues["currentWeightPerfect"][locale.languageCode]; + + String get littleBitWeightMore => localizedValues["littleBitWeightMore"][locale.languageCode]; + + String get consultWithDoctor => localizedValues["consultWithDoctor"][locale.languageCode]; + + String get excessiveObesity => localizedValues["excessiveObesity"][locale.languageCode]; + + String get mayWish => localizedValues["mayWish"][locale.languageCode]; + + String get underObese => localizedValues["underObese"][locale.languageCode]; + + String get crossedLimits => localizedValues["crossedLimits"][locale.languageCode]; + + String get lowLimits => localizedValues["lowLimits"][locale.languageCode]; + + String get estimates => localizedValues["estimates"][locale.languageCode]; + + String get submitReview => localizedValues["submitReview"][locale.languageCode]; + + String get Protein => localizedValues["Protein"][locale.languageCode]; + String get Cals => localizedValues["Cals"][locale.languageCode]; + String get gramsPerDay => localizedValues["gramsPerDay"][locale.languageCode]; + String get gr => localizedValues["gr"][locale.languageCode]; + String get gramsPerMeal => localizedValues["gramsPerMeal"][locale.languageCode]; + + + } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index d23b91b2..f20f4243 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -16,6 +16,7 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/MyAppointments.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_card_screen.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page_pharmcy.dart'; import 'package:diplomaticquarterapp/pages/medical/active_medications/ActiveMedicationsPage.dart'; import 'package:diplomaticquarterapp/pages/medical/allergies_page.dart'; import 'package:diplomaticquarterapp/pages/medical/ask_doctor/ask_doctor_home_page.dart'; @@ -44,13 +45,14 @@ import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; import '../Constants.dart'; +import '../locator.dart'; import 'app_shared_preferences.dart'; import 'app_toast.dart'; import 'gif_loader_dialog_utils.dart'; +import 'navigation_service.dart'; AppSharedPreferences sharedPref = new AppSharedPreferences(); - class Utils { // static ProgressDialog pr; @@ -66,8 +68,10 @@ class Utils { /// Check The Internet Connection static Future checkConnection() async { - ConnectivityResult connectivityResult = await (Connectivity().checkConnectivity()); - if ((connectivityResult == ConnectivityResult.mobile) || (connectivityResult == ConnectivityResult.wifi)) { + ConnectivityResult connectivityResult = + await (Connectivity().checkConnectivity()); + if ((connectivityResult == ConnectivityResult.mobile) || + (connectivityResult == ConnectivityResult.wifi)) { return true; } else { return false; @@ -131,11 +135,19 @@ class Utils { } static String getAppointmentTransID(int projectID, int clinicID, int appoNo) { - return projectID.toString() + '-' + clinicID.toString() + '-' + appoNo.toString(); + return projectID.toString() + + '-' + + clinicID.toString() + + '-' + + appoNo.toString(); } static String getAdvancePaymentTransID(int projectID, int fileNumber) { - return projectID.toString() + '-' + fileNumber.toString() + '-' + DateTime.now().millisecondsSinceEpoch.toString(); + return projectID.toString() + + '-' + + fileNumber.toString() + + '-' + + DateTime.now().millisecondsSinceEpoch.toString(); } bool validateIDBox(String value, type) { @@ -195,14 +207,22 @@ class Utils { } static validEmail(email) { - return RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+").hasMatch(email); + return RegExp( + r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+") + .hasMatch(email); } - static List myMedicalList({ProjectViewModel projectViewModel, BuildContext context, bool isLogin, count}) { + static List myMedicalList( + {ProjectViewModel projectViewModel, + BuildContext context, + bool isLogin, + count}) { List medical = List(); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(5) ? Navigator.push(context, FadePage(page: MyAppointments())) : null, + onTap: () => projectViewModel.havePrivilege(5) + ? Navigator.push(context, FadePage(page: MyAppointments())) + : null, child: isLogin ? Stack(children: [ Container( @@ -229,7 +249,11 @@ class Utils { borderRadius: BorderRadius.circular(8), badgeContent: Container( padding: EdgeInsets.all(2.0), - child: Text(count.toString(), style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.0)), + child: Text(count.toString(), + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12.0)), ), ), ) @@ -247,7 +271,11 @@ class Utils { borderRadius: BorderRadius.circular(8), badgeContent: Container( padding: EdgeInsets.all(2.0), - child: Text(count.toString(), style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.0)), + child: Text(count.toString(), + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12.0)), ), ), ) @@ -274,7 +302,9 @@ class Utils { } medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(7) ? Navigator.push(context, FadePage(page: RadiologyHomePage())) : null, + onTap: () => projectViewModel.havePrivilege(7) + ? Navigator.push(context, FadePage(page: RadiologyHomePage())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).radiology, imagePath: 'radiology.svg', @@ -284,7 +314,9 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(12) ? Navigator.push(context, FadePage(page: HomePrescriptionsPage())) : null, + onTap: () => projectViewModel.havePrivilege(12) + ? Navigator.push(context, FadePage(page: HomePrescriptionsPage())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).medicines, imagePath: 'medicine_prescription.svg', @@ -310,7 +342,8 @@ class Utils { medical.add(InkWell( onTap: () { - if (projectViewModel.havePrivilege(48)) Navigator.push(context, FadePage(page: ActiveMedicationsPage())); + if (projectViewModel.havePrivilege(48)) + Navigator.push(context, FadePage(page: ActiveMedicationsPage())); }, child: MedicalProfileItem( title: TranslationBase.of(context).myMedical, @@ -329,12 +362,17 @@ class Utils { ), ) : null, - child: - MedicalProfileItem(title: TranslationBase.of(context).myDoctor, imagePath: 'my_doc.svg', subTitle: TranslationBase.of(context).myDoctorSubtitle, isEnable: projectViewModel.havePrivilege(6)), + child: MedicalProfileItem( + title: TranslationBase.of(context).myDoctor, + imagePath: 'my_doc.svg', + subTitle: TranslationBase.of(context).myDoctorSubtitle, + isEnable: projectViewModel.havePrivilege(6)), )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(14) ? Navigator.push(context, FadePage(page: MyInvoices())) : null, + onTap: () => projectViewModel.havePrivilege(14) + ? Navigator.push(context, FadePage(page: MyInvoices())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).invoicesList, imagePath: 'invoice_list.svg', @@ -344,7 +382,9 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(14) ? Navigator.push(context, FadePage(page: EyeMeasurementsPage())) : null, + onTap: () => projectViewModel.havePrivilege(14) + ? Navigator.push(context, FadePage(page: EyeMeasurementsPage())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).eye, imagePath: 'eye_measurement.svg', @@ -354,7 +394,9 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(22) ? Navigator.push(context, FadePage(page: InsuranceCard())) : null, + onTap: () => projectViewModel.havePrivilege(22) + ? Navigator.push(context, FadePage(page: InsuranceCard())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).insurance, imagePath: 'insurance_card.svg', @@ -375,7 +417,9 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(18) ? Navigator.push(context, FadePage(page: InsuranceApproval())) : null, + onTap: () => projectViewModel.havePrivilege(18) + ? Navigator.push(context, FadePage(page: InsuranceApproval())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).insuranceApproval, imagePath: 'insurance_approval.svg', @@ -385,7 +429,9 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(23) ? Navigator.push(context, FadePage(page: AllergiesPage())) : null, + onTap: () => projectViewModel.havePrivilege(23) + ? Navigator.push(context, FadePage(page: AllergiesPage())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).allergies, imagePath: 'allergies_diagnosed.svg', @@ -395,7 +441,9 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(26) ? Navigator.push(context, FadePage(page: MyVaccines())) : null, + onTap: () => projectViewModel.havePrivilege(26) + ? Navigator.push(context, FadePage(page: MyVaccines())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).myVaccines, imagePath: 'vaccine_list.svg', @@ -405,7 +453,9 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(20) ? Navigator.push(context, FadePage(page: HomeReportPage())) : null, + onTap: () => projectViewModel.havePrivilege(20) + ? Navigator.push(context, FadePage(page: HomeReportPage())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).medical, imagePath: 'medical_report.svg', @@ -415,7 +465,9 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(19) ? Navigator.push(context, FadePage(page: MonthlyReportsPage())) : null, + onTap: () => projectViewModel.havePrivilege(19) + ? Navigator.push(context, FadePage(page: MonthlyReportsPage())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).monthly, imagePath: 'monthly_report.svg', @@ -425,7 +477,9 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(16) ? Navigator.push(context, FadePage(page: PatientSickLeavePage())) : null, + onTap: () => projectViewModel.havePrivilege(16) + ? Navigator.push(context, FadePage(page: PatientSickLeavePage())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).sick, imagePath: 'sick_leave.svg', @@ -435,7 +489,9 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(47) ? Navigator.push(context, FadePage(page: MyBalancePage())) : null, + onTap: () => projectViewModel.havePrivilege(47) + ? Navigator.push(context, FadePage(page: MyBalancePage())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).myBalance, imagePath: 'balance_credit.svg', @@ -452,7 +508,9 @@ class Utils { // )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(24) ? Navigator.push(context, FadePage(page: MyTrackers())) : null, + onTap: () => projectViewModel.havePrivilege(24) + ? Navigator.push(context, FadePage(page: MyTrackers())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).myTrackers, imagePath: 'tracker.svg', @@ -462,7 +520,9 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(30) ? Navigator.push(context, FadePage(page: SmartWatchInstructions())) : null, + onTap: () => projectViewModel.havePrivilege(30) + ? Navigator.push(context, FadePage(page: SmartWatchInstructions())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).smartWatchesSubtitle, imagePath: 'smart_watch.svg', @@ -472,9 +532,14 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(28) ? Navigator.push(context, FadePage(page: AskDoctorHomPage())) : null, + onTap: () => projectViewModel.havePrivilege(28) + ? Navigator.push(context, FadePage(page: AskDoctorHomPage())) + : null, child: MedicalProfileItem( - title: TranslationBase.of(context).askYourSubtitle, imagePath: 'ask_doctor.svg', subTitle: TranslationBase.of(context).askYour, isEnable: projectViewModel.havePrivilege(28)), + title: TranslationBase.of(context).askYourSubtitle, + imagePath: 'ask_doctor.svg', + subTitle: TranslationBase.of(context).askYour, + isEnable: projectViewModel.havePrivilege(28)), )); if (projectViewModel.havePrivilege(32) || true) { @@ -484,13 +549,18 @@ class Utils { if (projectViewModel.isLogin && userData_ != null) { String patientID = userData_.patientID.toString(); GifLoaderDialogUtils.showMyDialog(context); - projectViewModel.platformBridge().connectHMGInternetWifi(patientID).then((value) => {GifLoaderDialogUtils.hideDialog(context)}).catchError((err) { + projectViewModel + .platformBridge() + .connectHMGInternetWifi(patientID) + .then((value) => {GifLoaderDialogUtils.hideDialog(context)}) + .catchError((err) { print(err.toString()); }); } else { AlertDialogBox( context: context, - confirmMessage: "Please login with your account first to use this feature", + confirmMessage: + "Please login with your account first to use this feature", okText: "OK", okFunction: () { AlertDialogBox.closeAlertDialog(context); @@ -507,7 +577,9 @@ class Utils { } medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(40) ? launch('whatsapp://send?phone=18885521858&text=') : null, + onTap: () => projectViewModel.havePrivilege(40) + ? launch('whatsapp://send?phone=18885521858&text=') + : null, child: MedicalProfileItem( title: TranslationBase.of(context).chatbot, imagePath: 'chatbot.svg', @@ -519,13 +591,17 @@ class Utils { return medical; } - - - static List myMedicalListHomePage({ProjectViewModel projectViewModel, BuildContext context, bool isLogin, count}) { + static List myMedicalListHomePage( + {ProjectViewModel projectViewModel, + BuildContext context, + bool isLogin, + count}) { List medical = List(); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(5) ? Navigator.push(context, FadePage(page: MyAppointments())) : null, + onTap: () => projectViewModel.havePrivilege(5) + ? Navigator.push(context, FadePage(page: MyAppointments())) + : null, child: isLogin ? Stack(children: [ MedicalProfileItem( @@ -548,7 +624,11 @@ class Utils { borderRadius: BorderRadius.circular(8), badgeContent: Container( padding: EdgeInsets.all(2.0), - child: Text(count.toString(), style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.0)), + child: Text(count.toString(), + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12.0)), ), ), ) @@ -566,7 +646,11 @@ class Utils { borderRadius: BorderRadius.circular(8), badgeContent: Container( padding: EdgeInsets.all(2.0), - child: Text(count.toString(), style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.0)), + child: Text(count.toString(), + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12.0)), ), ), ) @@ -593,7 +677,9 @@ class Utils { } medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(7) ? Navigator.push(context, FadePage(page: RadiologyHomePage())) : null, + onTap: () => projectViewModel.havePrivilege(7) + ? Navigator.push(context, FadePage(page: RadiologyHomePage())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).radiology, imagePath: 'radiology.svg', @@ -603,7 +689,9 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(12) ? Navigator.push(context, FadePage(page: HomePrescriptionsPage())) : null, + onTap: () => projectViewModel.havePrivilege(12) + ? Navigator.push(context, FadePage(page: HomePrescriptionsPage())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).medicines, imagePath: 'medicine_prescription.svg', @@ -621,19 +709,24 @@ class Utils { ), ) : null, - child: - MedicalProfileItem(title: TranslationBase.of(context).myDoctor, imagePath: 'my_doc.svg', subTitle: TranslationBase.of(context).myDoctorSubtitle, isEnable: projectViewModel.havePrivilege(6)), + child: MedicalProfileItem( + title: TranslationBase.of(context).myDoctor, + imagePath: 'my_doc.svg', + subTitle: TranslationBase.of(context).myDoctorSubtitle, + isEnable: projectViewModel.havePrivilege(6)), )); return medical; } - static Widget loadNetworkImage({@required String url, BoxFit fitting = BoxFit.cover}) { + static Widget loadNetworkImage( + {@required String url, BoxFit fitting = BoxFit.cover}) { return CachedNetworkImage( placeholderFadeInDuration: Duration(milliseconds: 250), fit: fitting, imageUrl: url, - placeholder: (context, url) => Container(child: Center(child: CircularProgressIndicator())), + placeholder: (context, url) => + Container(child: Center(child: CircularProgressIndicator())), errorWidget: (context, url, error) { return Icon( Icons.error, @@ -650,6 +743,14 @@ class Utils { return route.runtimeType == equalsTo; } + static navigateToCartPage() { + Navigator.pushAndRemoveUntil( + locator().navigatorKey.currentContext, + MaterialPageRoute( + builder: (context) => LandingPagePharmacy(currentTab: 3)), + (Route r) => false); + } + static Widget tableColumnTitle(String text, {bool showDivider = true}) { return Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -658,7 +759,12 @@ class Utils { SizedBox(height: 6), Text( text, - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12), + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.48, + height: 18 / 12), ), SizedBox(height: 5), if (showDivider) @@ -671,16 +777,27 @@ class Utils { ); } - static Widget tableColumnValue(String text, {bool isLast = false, bool isCapitable = true, ProjectViewModel mProjectViewModel}) { - ProjectViewModel projectViewModel = mProjectViewModel ?? Provider.of(AppGlobal.context); + static Widget tableColumnValue(String text, + {bool isLast = false, + bool isCapitable = true, + ProjectViewModel mProjectViewModel}) { + ProjectViewModel projectViewModel = + mProjectViewModel ?? Provider.of(AppGlobal.context); return Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ SizedBox(height: 12), Text( - isCapitable && !projectViewModel.isArabic ? text.toLowerCase().capitalizeFirstofEach : text, - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + isCapitable && !projectViewModel.isArabic + ? text.toLowerCase().capitalizeFirstofEach + : text, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff575757), + letterSpacing: -0.4, + height: 16 / 10), ), SizedBox(height: 12), if (!isLast) @@ -693,7 +810,8 @@ class Utils { ); } - static Widget tableColumnValueWithUnderLine(String text, {bool isLast = false, bool isCapitable = true}) { + static Widget tableColumnValueWithUnderLine(String text, + {bool isLast = false, bool isCapitable = true}) { return Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, @@ -704,7 +822,13 @@ class Utils { isCapitable ? text.toLowerCase().capitalizeFirstofEach : text, maxLines: 1, minFontSize: 6, - style: TextStyle(decoration: TextDecoration.underline, fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xffD02127), letterSpacing: -0.48, height: 18 / 12), + style: TextStyle( + decoration: TextDecoration.underline, + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xffD02127), + letterSpacing: -0.48, + height: 18 / 12), ), SizedBox(height: 10), if (!isLast) @@ -718,7 +842,13 @@ class Utils { } } -Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, double spreadRadius = 2, double blurRadius = 7, Offset offset = const Offset(2, 2), @required Widget child}) { +Widget applyShadow( + {Color color = Colors.grey, + double shadowOpacity = 0.5, + double spreadRadius = 2, + double blurRadius = 7, + Offset offset = const Offset(2, 2), + @required Widget child}) { return Container( decoration: BoxDecoration( boxShadow: [ @@ -735,7 +865,8 @@ Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, doubl } Future userData() async { - var userData = AuthenticatedUser.fromJson(await AppSharedPreferences().getObject(MAIN_USER)); + var userData = AuthenticatedUser.fromJson( + await AppSharedPreferences().getObject(MAIN_USER)); return userData; } @@ -749,9 +880,12 @@ extension IndexedIterable on Iterable { openAppStore({String androidPackageName, String iOSAppID}) async { if (Platform.isAndroid) { - assert(!(androidPackageName == null), "Should have valid value in androidPackageName parameter"); - if ((await FlutterHmsGmsAvailability.isGmsAvailable)) launch("market://details?id=com.ejada.hmg"); - if ((await FlutterHmsGmsAvailability.isHmsAvailable)) launch("appmarket://details?id=com.ejada.hmg"); + assert(!(androidPackageName == null), + "Should have valid value in androidPackageName parameter"); + if ((await FlutterHmsGmsAvailability.isGmsAvailable)) + launch("market://details?id=com.ejada.hmg"); + if ((await FlutterHmsGmsAvailability.isHmsAvailable)) + launch("appmarket://details?id=com.ejada.hmg"); } else if (Platform.isIOS) { assert((iOSAppID == null), "Should have valid value in iOSAppID parameter"); launch("https://itunes.apple.com/kr/app/apple-store/$iOSAppID)"); @@ -777,7 +911,11 @@ String labelFrom({@required String className}) { extension StringExtension on String { String capitalize() { - return this.splitMapJoin(RegExp(r'\w+'), onMatch: (m) => '${m.group(0)}'.substring(0, 1).toUpperCase() + '${m.group(0)}'.substring(1).toLowerCase(), onNonMatch: (n) => ' '); + return this.splitMapJoin(RegExp(r'\w+'), + onMatch: (m) => + '${m.group(0)}'.substring(0, 1).toUpperCase() + + '${m.group(0)}'.substring(1).toLowerCase(), + onNonMatch: (n) => ' '); } } diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 25c1bbc4..c5b45b77 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -21,6 +21,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/pharmacy/bottom_nav_pharmacy_bar.dart'; @@ -544,8 +545,7 @@ class AppBarWidgetState extends State { child: Icon(Icons.shopping_cart)), color: Colors.white, onPressed: () { - // Navigator.of(context).popUntil(ModalRoute.withName('/')); - Navigator.of(context).popAndPushNamed(CART_ORDER_PAGE); + Utils.navigateToCartPage(); }) : Container(), (widget.isOfferPackages && widget.showOfferPackagesCart) diff --git a/lib/widgets/pharmacy/product_tile.dart b/lib/widgets/pharmacy/product_tile.dart index c63410ba..b7293ce1 100644 --- a/lib/widgets/pharmacy/product_tile.dart +++ b/lib/widgets/pharmacy/product_tile.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-ord import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -165,10 +166,7 @@ class productTile extends StatelessWidget { GifLoaderDialogUtils.showMyDialog(context); await addToCartFunction(1, productID, context); GifLoaderDialogUtils.hideDialog(context); - Navigator.push( - context, - FadePage(page: CartOrderPage()), - ); + Utils.navigateToCartPage(); }, ), ], @@ -295,6 +293,6 @@ class productTile extends StatelessWidget { addToCartFunction(quantity, itemID, BuildContext context) async { ProductDetailViewModel x = new ProductDetailViewModel(); - await x.addToCartData(quantity, itemID); + await x.addToCartData(quantity, itemID, context); } }