diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 0ba19289..f2d57d5f 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -112,8 +112,8 @@ class BaseAppClient { if (body['OTP_SendType'] != null) { onFailure(getError(parsed), statusCode); } else if (!isAllowAny) { - await helpers.logout(); - helpers.showErrorToast('Your session expired Please login agian'); + await Helpers.logout(); + Helpers.showErrorToast('Your session expired Please login agian'); } if (isAllowAny) { onFailure(getError(parsed), statusCode); @@ -308,7 +308,7 @@ class BaseAppClient { } } if (error == null || error == "null" || error == "null\n") { - return helpers.generateContactAdminMsg(); + return Helpers.generateContactAdminMsg(); } return error; } diff --git a/lib/core/service/auth_service.dart b/lib/core/service/auth_service.dart index e116ccdd..f009fded 100644 --- a/lib/core/service/auth_service.dart +++ b/lib/core/service/auth_service.dart @@ -2,11 +2,13 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/imei_details.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; +import 'package:doctor_app_flutter/models/doctor/user_model.dart'; class AuthService extends BaseService { List _imeiDetails = []; List get dashboardItemsList => _imeiDetails; - + Map _loginInfo = {}; + Map get loginInfo => _loginInfo; Future selectDeviceImei(imei) async { try { // dynamic localRes; @@ -26,4 +28,36 @@ class AuthService extends BaseService { super.error = error; } } + + Future login(UserModel userInfo) async { + hasError = false; + _loginInfo = {}; + try { + await baseAppClient.post(LOGIN_URL, + onSuccess: (dynamic response, int statusCode) { + _loginInfo = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: userInfo.toJson()); + } catch (error) { + hasError = true; + super.error = error; + } + + // await baseAppClient.post(SELECT_DEVICE_IMEI, + // onSuccess: (dynamic response, int statusCode) { + // _imeiDetails = []; + // response['List_DoctorDeviceDetails'].forEach((v) { + // _imeiDetails.add(GetIMEIDetailsModel.fromJson(v)); + // }); + // }, onFailure: (String error, int statusCode) { + // hasError = true; + // super.error = error; + // }, body: {}); + // } catch (error) { + // hasError = true; + // super.error = error; + // } + } } diff --git a/lib/core/service/labs_service.dart b/lib/core/service/labs_service.dart index 1a641d1f..ecfc96a1 100644 --- a/lib/core/service/labs_service.dart +++ b/lib/core/service/labs_service.dart @@ -48,8 +48,7 @@ class LabsService extends BaseService { _requestPatientLabSpecialResult.orderNo = orderNo; await baseAppClient.postPatient(GET_Patient_LAB_SPECIAL_RESULT, - patient: patient, - onSuccess: (dynamic response, int statusCode) { + patient: patient, onSuccess: (dynamic response, int statusCode) { patientLabSpecialResult.clear(); response['ListPLSR'].forEach((hospital) { patientLabSpecialResult.add(PatientLabSpecialResult.fromJson(hospital)); @@ -60,7 +59,8 @@ class LabsService extends BaseService { }, body: _requestPatientLabSpecialResult.toJson()); } - Future getPatientLabResult({PatientLabOrders patientLabOrder,PatiantInformtion patient}) async { + Future getPatientLabResult( + {PatientLabOrders patientLabOrder, PatiantInformtion patient}) async { hasError = false; Map body = Map(); body['InvoiceNo'] = patientLabOrder.invoiceNo; @@ -69,8 +69,7 @@ class LabsService extends BaseService { body['SetupID'] = patientLabOrder.setupID; body['ProjectID'] = patientLabOrder.projectID; body['ClinicID'] = patientLabOrder.clinicID; - await baseAppClient.postPatient(GET_Patient_LAB_RESULT, - patient: patient, + await baseAppClient.postPatient(GET_Patient_LAB_RESULT, patient: patient, onSuccess: (dynamic response, int statusCode) { patientLabSpecialResult.clear(); labResultList.clear(); @@ -84,19 +83,22 @@ class LabsService extends BaseService { } Future getPatientLabOrdersResults( - {PatientLabOrders patientLabOrder, String procedure,PatiantInformtion patient}) async { + {PatientLabOrders patientLabOrder, + String procedure, + PatiantInformtion patient}) async { hasError = false; Map body = Map(); - body['InvoiceNo'] = patientLabOrder.invoiceNo; - body['OrderNo'] = patientLabOrder.orderNo; + if (patientLabOrder != null) { + body['InvoiceNo'] = patientLabOrder.invoiceNo; + body['OrderNo'] = patientLabOrder.orderNo; + body['SetupID'] = patientLabOrder.setupID; + body['ProjectID'] = patientLabOrder.projectID; + body['ClinicID'] = patientLabOrder.clinicID; + } body['isDentalAllowedBackend'] = false; - body['SetupID'] = patientLabOrder.setupID; - body['ProjectID'] = patientLabOrder.projectID; - body['ClinicID'] = patientLabOrder.clinicID; body['Procedure'] = procedure; await baseAppClient.postPatient(GET_Patient_LAB_ORDERS_RESULT, - patient: patient, - onSuccess: (dynamic response, int statusCode) { + patient: patient, onSuccess: (dynamic response, int statusCode) { labOrdersResultsList.clear(); response['ListPLR'].forEach((lab) { labOrdersResultsList.add(LabOrderResult.fromJson(lab)); diff --git a/lib/core/service/prescription_service.dart b/lib/core/service/prescription_service.dart index 67b3491c..643c719d 100644 --- a/lib/core/service/prescription_service.dart +++ b/lib/core/service/prescription_service.dart @@ -112,7 +112,7 @@ class PrescriptionService extends LookupService { }, body: _drugRequestModel.toJson()); } - Future getMedicationList({String drug}) async { + Future getMedicationList({String drug =''}) async { hasError = false; _drugRequestModel.search = ["$drug"]; await baseAppClient.post(SEARCH_DRUG, diff --git a/lib/core/viewModel/auth_view_model.dart b/lib/core/viewModel/auth_view_model.dart index 87b89123..7c94dca9 100644 --- a/lib/core/viewModel/auth_view_model.dart +++ b/lib/core/viewModel/auth_view_model.dart @@ -16,7 +16,6 @@ import 'package:flutter/cupertino.dart'; import 'package:doctor_app_flutter/config/config.dart'; import '../../models/doctor/user_model.dart'; -DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED } class AuthViewModel extends BaseViewModel { @@ -195,26 +194,19 @@ class AuthViewModel extends BaseViewModel { } } - /* - *@author: Elham Rababah - *@Date:17/5/2020 - *@param: docInfo - *@return:Future - *@desc: getDocProfiles - */ - Future getDocProfiles(docInfo, {bool allowChangeProfile = true}) async { + Future getDocProfiles(docInfo, + {bool allowChangeProfile = true}) async { try { dynamic localRes; await baseAppClient.post(GET_DOC_PROFILES, onSuccess: (dynamic response, int statusCode) { localRes = response; - if(allowChangeProfile) { + if (allowChangeProfile) { doctorProfile = DoctorProfileModel.fromJson(response['DoctorProfileList'][0]); selectedClinicName = - response['DoctorProfileList'][0]['ClinicDescription']; + response['DoctorProfileList'][0]['ClinicDescription']; } - }, onFailure: (String error, int statusCode) { throw error; }, body: docInfo); diff --git a/lib/core/viewModel/imei_view_model.dart b/lib/core/viewModel/imei_view_model.dart index 29253b1d..98419ced 100644 --- a/lib/core/viewModel/imei_view_model.dart +++ b/lib/core/viewModel/imei_view_model.dart @@ -4,11 +4,13 @@ import 'package:doctor_app_flutter/core/model/imei_details.dart'; import 'package:doctor_app_flutter/core/service/auth_service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/locator.dart'; +import 'package:doctor_app_flutter/models/doctor/user_model.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; class IMEIViewModel extends BaseViewModel { AuthService _authService = locator(); List get imeiDetails => _authService.dashboardItemsList; - + get loginInfo => _authService.loginInfo; Future selectDeviceImei(imei) async { setState(ViewState.Busy); await _authService.selectDeviceImei(imei); @@ -18,4 +20,15 @@ class IMEIViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + Future login(UserModel userInfo) async { + setState(ViewState.Busy); + await _authService.login(userInfo); + if (_authService.hasError) { + error = _authService.error; + Helpers.showErrorToast(error); + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } } diff --git a/lib/landing_page.dart b/lib/landing_page.dart index 940f1242..4f4bad85 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -46,7 +46,8 @@ class _LandingPageState extends State { leading: Builder( builder: (BuildContext context) { return IconButton( - icon: Icon(DoctorApp.drawer_icon), + icon: Image.asset('assets/images/menu.png', + height: 50, width: 50), iconSize: 15, color: Colors.black, onPressed: () => Scaffold.of(context).openDrawer(), diff --git a/lib/locator.dart b/lib/locator.dart index 1e688d96..d64a8ed3 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -5,7 +5,6 @@ import 'package:doctor_app_flutter/core/service/patient_service.dart'; import 'package:doctor_app_flutter/core/service/prescription_service.dart'; import 'package:doctor_app_flutter/core/service/procedure_service.dart'; import 'package:doctor_app_flutter/core/service/sickleave_service.dart'; -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/imei_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/medical_file_view_model.dart'; diff --git a/lib/models/doctor/list_doctor_working_hours_table_model.dart b/lib/models/doctor/list_doctor_working_hours_table_model.dart index 32c3f04a..17a05f11 100644 --- a/lib/models/doctor/list_doctor_working_hours_table_model.dart +++ b/lib/models/doctor/list_doctor_working_hours_table_model.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; class ListDoctorWorkingHoursTable { @@ -15,7 +16,7 @@ class ListDoctorWorkingHoursTable { }); ListDoctorWorkingHoursTable.fromJson(Map json) { - date = Helpers.convertStringToDate(json['Date']); + date = DateUtils.convertStringToDate(json['Date']); dayName = json['DayName']; workingHours = json['WorkingHours']; projectName = json['ProjectName']; diff --git a/lib/models/doctor/list_gt_my_patients_question_model.dart b/lib/models/doctor/list_gt_my_patients_question_model.dart index b6c5cc2a..e381901f 100644 --- a/lib/models/doctor/list_gt_my_patients_question_model.dart +++ b/lib/models/doctor/list_gt_my_patients_question_model.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -70,7 +71,7 @@ class ListGtMyPatientsQuestions { patientID = json['PatientID']; doctorID = json['DoctorID']; requestType = json['RequestType']; - requestDate = Helpers.convertStringToDate(json['RequestDate']) ; + requestDate = DateUtils.convertStringToDate(json['RequestDate']) ; requestTime = json['RequestTime']; remarks = json['Remarks']; status = json['Status']; diff --git a/lib/models/patient/lab_orders/lab_orders_res_model.dart b/lib/models/patient/lab_orders/lab_orders_res_model.dart index 48d3dc27..893b49ae 100644 --- a/lib/models/patient/lab_orders/lab_orders_res_model.dart +++ b/lib/models/patient/lab_orders/lab_orders_res_model.dart @@ -1,11 +1,6 @@ -/* - *@author: Elham Rababah - *@Date:6/5/2020 - *@param: - *@return:LabOrdersResModel - *@desc: LabOrdersResModel class - */ -import 'package:doctor_app_flutter/util/helpers.dart'; + + +import 'package:doctor_app_flutter/util/date-utils.dart'; class LabOrdersResModel { String setupID; @@ -67,7 +62,7 @@ class LabOrdersResModel { status = json['Status']; createdBy = json['CreatedBy']; createdByN = json['CreatedByN']; - createdOn = Helpers.convertStringToDate(json['CreatedOn']); + createdOn = DateUtils.convertStringToDate(json['CreatedOn']); editedBy = json['EditedBy']; editedByN = json['EditedByN']; editedOn = json['EditedOn']; diff --git a/lib/models/patient/my_referral/my_referral_patient_model.dart b/lib/models/patient/my_referral/my_referral_patient_model.dart index e18dd546..a9645618 100644 --- a/lib/models/patient/my_referral/my_referral_patient_model.dart +++ b/lib/models/patient/my_referral/my_referral_patient_model.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; class MyReferralPatientModel { @@ -142,7 +143,7 @@ class MyReferralPatientModel { referralResponseOn = json['ReferralResponseOn']; priority = json['Priority']; frequency = json['Frequency']; - mAXResponseTime = Helpers.convertStringToDate(json['MAXResponseTime']); + mAXResponseTime = DateUtils.convertStringToDate(json['MAXResponseTime']); age = json['Age']; frequencyDescription = json['FrequencyDescription']; genderDescription = json['GenderDescription']; diff --git a/lib/models/patient/prescription/prescription_report_for_in_patient.dart b/lib/models/patient/prescription/prescription_report_for_in_patient.dart index 9b88279e..30d7cacc 100644 --- a/lib/models/patient/prescription/prescription_report_for_in_patient.dart +++ b/lib/models/patient/prescription/prescription_report_for_in_patient.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; class PrescriptionReportForInPatient { @@ -125,7 +126,7 @@ class PrescriptionReportForInPatient { orderNo = json['OrderNo']; patientID = json['PatientID']; pharmacyRemarks = json['PharmacyRemarks']; - prescriptionDatetime = Helpers.convertStringToDate(json['PrescriptionDatetime']); + prescriptionDatetime = DateUtils.convertStringToDate(json['PrescriptionDatetime']); prescriptionNo = json['PrescriptionNo']; processedBy = json['ProcessedBy']; projectID = json['ProjectID']; @@ -138,11 +139,11 @@ class PrescriptionReportForInPatient { routeId = json['RouteId']; routeN = json['RouteN']; setupID = json['SetupID']; - startDatetime = Helpers.convertStringToDate(json['StartDatetime']) ; + startDatetime = DateUtils.convertStringToDate(json['StartDatetime']) ; status = json['Status']; statusDescription = json['StatusDescription']; statusDescriptionN = json['StatusDescriptionN']; - stopDatetime = Helpers.convertStringToDate(json['StopDatetime']); + stopDatetime = DateUtils.convertStringToDate(json['StopDatetime']); unitofMeasurement = json['UnitofMeasurement']; unitofMeasurementDescription = json['UnitofMeasurementDescription']; unitofMeasurementDescriptionN = json['UnitofMeasurementDescriptionN']; diff --git a/lib/models/patient/vital_sign/vital_sign_res_model.dart b/lib/models/patient/vital_sign/vital_sign_res_model.dart index de96bb45..b0c663b6 100644 --- a/lib/models/patient/vital_sign/vital_sign_res_model.dart +++ b/lib/models/patient/vital_sign/vital_sign_res_model.dart @@ -5,6 +5,7 @@ *@return:VitalSignResModel *@desc: VitalSignResModel class */ +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; class VitalSignResModel { @@ -170,7 +171,7 @@ class VitalSignResModel { triageCategory = json['TriageCategory']; gCScore = json['GCScore']; lineItemNo = json['LineItemNo']; - vitalSignDate = json['VitalSignDate'] !=null? Helpers.convertStringToDate(json['VitalSignDate']): new DateTime.now(); + vitalSignDate = json['VitalSignDate'] !=null? DateUtils.convertStringToDate(json['VitalSignDate']): new DateTime.now(); actualTimeTaken = json['ActualTimeTaken']; sugarLevel = json['SugarLevel']; fBS = json['FBS']; diff --git a/lib/screens/QR_reader_screen.dart b/lib/screens/QR_reader_screen.dart index 2ddb4049..de077495 100644 --- a/lib/screens/QR_reader_screen.dart +++ b/lib/screens/QR_reader_screen.dart @@ -210,7 +210,7 @@ class _QrReaderScreenState extends State { setState(() { isLoading = false; }); - helpers.showErrorToast(error.message); + Helpers.showErrorToast(error.message); //DrAppToastMsg.showErrorToast(error); }); } diff --git a/lib/screens/auth/login_screen.dart b/lib/screens/auth/login_screen.dart index 465ef71e..41941831 100644 --- a/lib/screens/auth/login_screen.dart +++ b/lib/screens/auth/login_screen.dart @@ -122,7 +122,7 @@ class _LoginsreenState extends State { height: 40, ), LoginForm( - changeLoadingStata: changeLoadingStata, + model: model, ), ], ) diff --git a/lib/screens/doctor/doctor_repaly_chat.dart b/lib/screens/doctor/doctor_repaly_chat.dart index 17cbd586..4387f28f 100644 --- a/lib/screens/doctor/doctor_repaly_chat.dart +++ b/lib/screens/doctor/doctor_repaly_chat.dart @@ -8,6 +8,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/doctor/doctor_reply_screen.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; @@ -89,34 +90,6 @@ class DoctorReplayChat extends StatelessWidget { color: Color(0xFF2B353E))) ], ), - // Row( - // mainAxisAlignment: - // MainAxisAlignment.spaceBetween, - // children: [ - // InkWell( - // onTap: () { - // // TODO: move to doctor profile - // }, - // child: RichText( - // text: TextSpan( - // style: TextStyle( - // fontSize: 1.6 * - // SizeConfig.textMultiplier, - // color: Colors.black), - // children: [ - // new TextSpan( - // text: - // 'Tap here to view patient profile' - // .toString(), - // style: TextStyle( - // fontFamily: 'Poppins', - // fontSize: 12)), - // ], - // ), - // ), - // ), - // ], - // ), ], ), ), @@ -234,91 +207,6 @@ class DoctorReplayChat extends StatelessWidget { ), ), SizedBox(height: 30,), - // Row( - // mainAxisAlignment: MainAxisAlignment.end, - // children: [ - // Container( - // // color: Color(0xFF2B353E), - // width: MediaQuery.of(context).size.width * 0.8, - // padding: EdgeInsets.all(5), - // decoration: BoxDecoration( - // color: Colors.white,// Color(0xFF2B353E), - // borderRadius: BorderRadius.all( - // Radius.circular(10.0), - // ), - // border: Border.all( - // color: HexColor('#707070') , - // width: 0.30), - // ), - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Container( - // margin: EdgeInsets.only(top: 5), - // width: 60, - // height: 60, - // child: Image.asset( - // 1 == 1 - // ? 'assets/images/male_avatar.png' - // : 'assets/images/female_avatar.png', - // fit: BoxFit.cover, - // ), - // ), - // Column( - // children: [ - // AppText( - // "07 Jan 2021", - // fontSize: 2.5 * SizeConfig.textMultiplier, - // fontFamily: 'Poppins', - // color: Color(0xFF2B353E), - // // fontSize: 18 - // ), - // AppText( - // "07:00 PM", - // fontSize: 2.5 * SizeConfig.textMultiplier, - // fontFamily: 'Poppins', - // color: Color(0xFF2B353E), - // // fontSize: 18 - // ), - // ], - // ), - // ], - // ), - // SizedBox( - // height: 10, - // ), - // Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Column( - // children: [ - // Padding( - // padding: const EdgeInsets.all(8.0), - // child: Container( - // width: MediaQuery.of(context).size.width * 0.7, - // child: AppText( - // "This procedure should be taken only when the patient is below 99o", - // fontSize: 15, - // fontFamily: 'Poppins', - // color: Color(0xFF2B353E), - // // fontSize: 18 - // ), - // ), - // ), - // ], - // ), - // ], - // ), - // ], - // ), - // ), - // ], - // ), ], ), ), @@ -341,11 +229,6 @@ class DoctorReplayChat extends StatelessWidget { child: TextFields( borderRadius: 0, - // hasLabelText: msgController.text != '' - // ? true - // : false, - // showLabelText: false, - // padding: EdgeInsets.all(0.3), hintText: TranslationBase .of(context) .typeHereToReply, @@ -357,7 +240,7 @@ class DoctorReplayChat extends StatelessWidget { GifLoaderDialogUtils.showMyDialog(context); await model.replay(msgController.text, reply); if(model.state == ViewState.ErrorLocal) { - helpers.showErrorToast("An error happened while you are replaying"); + Helpers.showErrorToast("An error happened while you are replaying"); } else { DrAppToastMsg.showSuccesToast("Thank you for your replay "); await previousModel.getDoctorReply(); diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 2504b59f..b18e6f76 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -679,7 +679,7 @@ class _HomeScreenState extends State { // model.getDashboard(); }).catchError((err) { changeIsLoading(false); - helpers.showErrorToast(err); + Helpers.showErrorToast(err); }); } diff --git a/lib/screens/live_care/video_call.dart b/lib/screens/live_care/video_call.dart index f6d011a7..660a6827 100644 --- a/lib/screens/live_care/video_call.dart +++ b/lib/screens/live_care/video_call.dart @@ -96,7 +96,7 @@ class _VideoCallPageState extends State { connectOpenTok(result); }).catchError((error) => - {helpers.showErrorToast(error), Navigator.of(context).pop()}); + {Helpers.showErrorToast(error), Navigator.of(context).pop()}); } @override @@ -307,7 +307,7 @@ class _VideoCallPageState extends State { .then((result) { connectOpenTok(result); }).catchError((error) => - {helpers.showErrorToast(error), Navigator.of(context).pop()}); + {Helpers.showErrorToast(error), Navigator.of(context).pop()}); } endCall() { @@ -317,7 +317,7 @@ class _VideoCallPageState extends State { .then((result) { print(result); }).catchError((error) => - {helpers.showErrorToast(error), Navigator.of(context).pop()}); + {Helpers.showErrorToast(error), Navigator.of(context).pop()}); } endCallWithCharge() { @@ -328,7 +328,7 @@ class _VideoCallPageState extends State { print('end callwith charge'); print(result); }).catchError((error) => - {helpers.showErrorToast(error), Navigator.of(context).pop()}); + {Helpers.showErrorToast(error), Navigator.of(context).pop()}); } closeRoute() { diff --git a/lib/screens/medical-file/medical_file_details.dart b/lib/screens/medical-file/medical_file_details.dart index 1c3d832c..e3e9bd33 100644 --- a/lib/screens/medical-file/medical_file_details.dart +++ b/lib/screens/medical-file/medical_file_details.dart @@ -622,7 +622,7 @@ class _MedicalFileDetailsState extends State { 'Order Date: ', ), AppText( - Helpers.getDateFormatted( + DateUtils.getDateFormatted( DateTime .parse( model diff --git a/lib/screens/medicine/medicine_search_screen.dart b/lib/screens/medicine/medicine_search_screen.dart index 9dea3448..7325cd37 100644 --- a/lib/screens/medicine/medicine_search_screen.dart +++ b/lib/screens/medicine/medicine_search_screen.dart @@ -14,7 +14,7 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/medicine/medicine_item_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; @@ -242,12 +242,12 @@ class _MedicineSearchState extends State { searchMedicine(context, MedicineViewModel model) async { FocusScope.of(context).unfocus(); if (myController.text.isNullOrEmpty()) { - helpers.showErrorToast(TranslationBase.of(context).typeMedicineName); + Helpers.showErrorToast(TranslationBase.of(context).typeMedicineName); //"Type Medicine Name") return; } if (myController.text.length < 3) { - helpers.showErrorToast(TranslationBase.of(context).moreThan3Letter); + Helpers.showErrorToast(TranslationBase.of(context).moreThan3Letter); return; } diff --git a/lib/screens/medicine/pharmacies_list_screen.dart b/lib/screens/medicine/pharmacies_list_screen.dart index 6af1d5b7..49c39c53 100644 --- a/lib/screens/medicine/pharmacies_list_screen.dart +++ b/lib/screens/medicine/pharmacies_list_screen.dart @@ -23,7 +23,6 @@ class PharmaciesListScreen extends StatefulWidget { final String url; - // In the constructor, require a item id. PharmaciesListScreen({Key key, @required this.itemID, this.url}) : super(key: key); @@ -32,18 +31,9 @@ class PharmaciesListScreen extends StatefulWidget { } class _PharmaciesListState extends State { - var _data; Helpers helpers = new Helpers(); ProjectViewModel projectsProvider; - bool _isInit = true; - //bool _isOutOfStuck = false; - - @override - void didChangeDependencies() { - super.didChangeDependencies(); - _isInit = false; - } @override Widget build(BuildContext context) { @@ -145,90 +135,90 @@ class _PharmaciesListState extends State { ? Alignment.topRight : Alignment.topLeft, ), - Expanded( - child: Container( - width: SizeConfig.screenWidth * 0.99, - child: ListView.builder( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - itemCount: model.pharmaciesList == null ? 0 : model - .pharmaciesList.length, - itemBuilder: (BuildContext context, int index) { - return RoundedContainer( - child: Row( - children: [ - Expanded( - flex: 1, - child: ClipRRect( - borderRadius: - BorderRadius.all(Radius.circular(7)), - child: Image.network( - model - .pharmaciesList[index]["ProjectImageURL"], - height: - SizeConfig.imageSizeMultiplier * 15, - width: - SizeConfig.imageSizeMultiplier * 15, - fit: BoxFit.cover, - ), - ), - ), - Expanded( - flex: 4, - child: AppText( + Container( + width: SizeConfig.screenWidth * 0.99, + margin: EdgeInsets.only(left: 10,right: 10), + child: ListView.builder( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemCount: model.pharmaciesList == null ? 0 : model + .pharmaciesList.length, + itemBuilder: (BuildContext context, int index) { + return RoundedContainer( + margin: EdgeInsets.only(top: 5), + child: Row( + children: [ + Expanded( + flex: 1, + child: ClipRRect( + borderRadius: + BorderRadius.all(Radius.circular(7)), + child: Image.network( model - .pharmaciesList[index]["LocationDescription"], - margin: 10, + .pharmaciesList[index]["ProjectImageURL"], + height: + SizeConfig.imageSizeMultiplier * 15, + width: + SizeConfig.imageSizeMultiplier * 15, + fit: BoxFit.cover, ), ), - Expanded( - flex: 2, - child: Wrap( - direction: Axis.horizontal, - alignment: WrapAlignment.end, - crossAxisAlignment: WrapCrossAlignment.end, - children: [ - Padding( - padding: EdgeInsets.all(5), - child: InkWell( - child: Icon( - Icons.call, - color: Colors.red, - ), - onTap: () => - launch("tel://" + - model - .pharmaciesList[index]["PhoneNumber"]), + ), + Expanded( + flex: 4, + child: AppText( + model + .pharmaciesList[index]["LocationDescription"], + margin: 10, + ), + ), + Expanded( + flex: 2, + child: Wrap( + direction: Axis.horizontal, + alignment: WrapAlignment.end, + crossAxisAlignment: WrapCrossAlignment.end, + children: [ + Padding( + padding: EdgeInsets.all(5), + child: InkWell( + child: Icon( + Icons.call, + color: Colors.red, ), + onTap: () => + launch("tel://" + + model + .pharmaciesList[index]["PhoneNumber"]), ), - Padding( - padding: EdgeInsets.all(5), - child: InkWell( - child: Icon( - Icons.pin_drop, - color: Colors.red, - ), - onTap: () { - MapsLauncher.launchCoordinates( - double.parse( - model - .pharmaciesList[index]["Latitude"]), - double.parse( - model - .pharmaciesList[index]["Longitude"]), - model.pharmaciesList[index] - ["LocationDescription"]); - }, + ), + Padding( + padding: EdgeInsets.all(5), + child: InkWell( + child: Icon( + Icons.pin_drop, + color: Colors.red, ), + onTap: () { + MapsLauncher.launchCoordinates( + double.parse( + model + .pharmaciesList[index]["Latitude"]), + double.parse( + model + .pharmaciesList[index]["Longitude"]), + model.pharmaciesList[index] + ["LocationDescription"]); + }, ), - ], - ), + ), + ], ), - ], - ), - ); - }), - ), + ), + ], + ), + ); + }), ) ]), ),),); diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 51750e38..fe87e59a 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -17,7 +17,7 @@ import '../../lookups/patient_lookup.dart'; import '../../widgets/patients/dynamic_elements.dart'; import '../../widgets/shared/app_buttons_widget.dart'; import '../../widgets/shared/app_scaffold_widget.dart'; -import '../../widgets/shared/app_text_form_field.dart'; +import '../../widgets/shared/user-guid/text_fields/app_text_form_field.dart'; import '../../widgets/shared/app_texts_widget.dart'; import '../../widgets/shared/rounded_container_widget.dart'; @@ -86,7 +86,7 @@ class _PatientSearchScreenState extends State { ((_patientSearchFormValues.From == "0" || _patientSearchFormValues.To == "0") && _selectedType == "6")) { - // helpers.showErrorToast("Please Choose The Dates"); + // Helpers.showErrorToast("Please Choose The Dates"); } else { setState(() { isFormSubmitted = false; @@ -111,7 +111,7 @@ class _PatientSearchScreenState extends State { handelCatchErrorCase(err) { //isLoading = false; //isError = true; - error = helpers.generateContactAdminMsg(err); + error = Helpers.generateContactAdminMsg(err); //notifyListeners(); throw err; } diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 0209991b..adfb1c8c 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -13,13 +13,11 @@ import 'package:doctor_app_flutter/models/patient/topten_users_res_model.dart'; import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/PatientCard.dart'; import 'package:doctor_app_flutter/widgets/patients/clinic_list_dropdwon.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_button.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; @@ -689,12 +687,12 @@ class _PatientsScreenState extends State { }); GifLoaderDialogUtils.hideDialog(context); }).catchError((error) { - helpers.showErrorToast(error.toString()); + Helpers.showErrorToast(error.toString()); GifLoaderDialogUtils.hideDialog(context); }); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); - helpers.showErrorToast(err); + Helpers.showErrorToast(err); }); } diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart index fa94d3fa..c92eb066 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -9,7 +9,7 @@ import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; -import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -282,7 +282,7 @@ class _UCAFInputScreenState extends State { AppTextFieldCustom( hintText: TranslationBase.of(context).instruction, - dropDownText: helpers.parseHtmlString(model + dropDownText: Helpers.parseHtmlString(model .patientChiefComplaintList[0] .chiefComplaint), controller: _additionalComplaintsController, diff --git a/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart index 876066ce..054c1d8f 100644 --- a/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart @@ -11,7 +11,7 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; -import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -122,7 +122,7 @@ class _AdmissionRequestThirdScreenState AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).clinic, - isDropDown: true, + isTextFieldHasSuffix: true, validationError: clinicError, dropDownText: _selectedClinic != null ? projectViewModel.isArabic? _selectedClinic['clinicNameArabic'] : _selectedClinic['clinicNameEnglish'] @@ -172,7 +172,7 @@ class _AdmissionRequestThirdScreenState AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).doctor, - isDropDown: true, + isTextFieldHasSuffix: true, dropDownText: _selectedDoctor != null ? _selectedDoctor['DoctorName'] : null, @@ -280,7 +280,7 @@ class _AdmissionRequestThirdScreenState AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).dietType, - isDropDown: true, + isTextFieldHasSuffix: true, dropDownText: _selectedDietType != null ? _selectedDietType['nameEn'] : null, diff --git a/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart index bf896145..145017d0 100644 --- a/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart @@ -13,7 +13,7 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; -import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -115,7 +115,7 @@ class _AdmissionRequestThirdScreenState ? _selectedDiagnosis['nameEn'] : null, enabled: false, - isDropDown: true, + isTextFieldHasSuffix: true, validationError: diagnosisError, onClick: model.diagnosisTypesList != null && model.diagnosisTypesList.length > 0 @@ -161,7 +161,7 @@ class _AdmissionRequestThirdScreenState ? _selectedIcd['description'] : null, enabled: false, - isDropDown: true, + isTextFieldHasSuffix: true, validationError: icdError, onClick: model.icdCodes != null && model.icdCodes.length > 0 @@ -209,7 +209,7 @@ class _AdmissionRequestThirdScreenState ? _selectedDiagnosisType['description'] : null, enabled: false, - isDropDown: true, + isTextFieldHasSuffix: true, validationError: diagnosisTypeError, onClick: model.listOfDiagnosisSelectionTypes != null && diff --git a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart index a4aebc9f..6f63c194 100644 --- a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart @@ -14,7 +14,7 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; -import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -203,7 +203,7 @@ class _AdmissionRequestSecondScreenState ? "${DateUtils.convertStringToDateFormat(_expectedAdmissionDate.toString(), "yyyy-MM-dd")}" : null, enabled: false, - isDropDown: true, + isTextFieldHasSuffix: true, validationError: expectedDatesError, suffixIcon: Icon( Icons.calendar_today, @@ -231,7 +231,7 @@ class _AdmissionRequestSecondScreenState ? _selectedFloor['description'] : null, enabled: false, - isDropDown: true, + isTextFieldHasSuffix: true, validationError: floorError, onClick: model.floorList != null && model.floorList.length > 0 @@ -281,7 +281,7 @@ class _AdmissionRequestSecondScreenState ? _selectedWard['description'] : null, enabled: false, - isDropDown: true, + isTextFieldHasSuffix: true, onClick: model.wardList != null && model.wardList.length > 0 ? () { @@ -331,7 +331,7 @@ class _AdmissionRequestSecondScreenState ? _selectedRoomCategory['description'] : null, enabled: false, - isDropDown: true, + isTextFieldHasSuffix: true, validationError: roomError, onClick: model.roomCategoryList != null && model.roomCategoryList.length > 0 @@ -423,7 +423,7 @@ class _AdmissionRequestSecondScreenState ? _selectedAdmissionType['nameEn'] : null, enabled: false, - isDropDown: true, + isTextFieldHasSuffix: true, validationError: admissionTypeError, onClick: model.admissionTypeList != null && model.admissionTypeList.length > 0 diff --git a/lib/screens/patients/profile/lab_result/FlowChartPage.dart b/lib/screens/patients/profile/lab_result/FlowChartPage.dart index 4bf0b0c3..6f1e0888 100644 --- a/lib/screens/patients/profile/lab_result/FlowChartPage.dart +++ b/lib/screens/patients/profile/lab_result/FlowChartPage.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'lab_result_chart_and_detials.dart'; @@ -17,46 +18,49 @@ class FlowChartPage extends StatelessWidget { final PatientLabOrders patientLabOrder; final String filterName; final PatiantInformtion patient; + FlowChartPage({this.patientLabOrder, this.filterName, this.patient}); @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getPatientLabOrdersResults( - patientLabOrder: patientLabOrder, procedure: filterName,patient: patient), + patientLabOrder: patientLabOrder, + procedure: filterName, + patient: patient), builder: (context, model, w) => AppScaffold( isShowAppBar: true, appBarTitle: filterName, baseViewModel: model, - body: SingleChildScrollView( - child: model.labOrdersResultsList.isNotEmpty - ? Container( + body: model.labOrdersResultsList.isNotEmpty + ? SingleChildScrollView( + child: Container( child: LabResultChartAndDetails( name: filterName, labResult: model.labOrdersResultsList, ), - ) - : Center( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - height: 100, ), - Image.asset('assets/images/no-data.png'), - Padding( - padding: const EdgeInsets.all(8.0), - child: AppText( - TranslationBase.of(context).noDataAvailable, - fontWeight: FontWeight.normal, - color: HexColor("#B8382B"), - fontSize: SizeConfig.textMultiplier * 2.5, - ), - ) - ], + ) + : Container( + child: Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + Image.asset('assets/images/no-data.png'), + Padding( + padding: const EdgeInsets.all(8.0), + child: AppText( + TranslationBase.of(context).noDataAvailable, + fontWeight: FontWeight.normal, + color: HexColor("#B8382B"), + fontSize: SizeConfig.textMultiplier * 2.5, + ), + ) + ], + ), + ), ), - ), - ), ), ); } diff --git a/lib/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart b/lib/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart index 5ca818bf..0dbd0eb1 100644 --- a/lib/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart +++ b/lib/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_report_for_in_patient.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -97,11 +98,11 @@ class _InpatientPrescriptionDetailsScreenState key: 'UOM'), buildTableRow( des: - '${Helpers.getDate(prescription.startDatetime)}', + '${DateUtils.getDate(prescription.startDatetime)}', key: 'Start Date'), buildTableRow( des: - '${Helpers.getDate(prescription.stopDatetime)}', + '${DateUtils.getDate(prescription.stopDatetime)}', key: 'Stop Date'), buildTableRow( des: '${prescription.noOfDoses}', @@ -116,7 +117,7 @@ class _InpatientPrescriptionDetailsScreenState key: 'Pharmacy Remarks'), buildTableRow( des: - '${Helpers.getDate(prescription.prescriptionDatetime)}', + '${DateUtils.getDate(prescription.prescriptionDatetime)}', key: 'Prescription Date'), buildTableRow( des: '${prescription.refillID}', diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index c27a5c46..3297a405 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -12,7 +12,7 @@ import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; -import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -242,7 +242,7 @@ class _PatientMakeReferralScreenState extends State { hintText: TranslationBase.of(context).branch, dropDownText: _referTo != null ? _referTo['name'] : null, enabled: false, - isDropDown: true, + isTextFieldHasSuffix: true, validationError: branchError, onClick: referToList != null ? () { @@ -295,7 +295,7 @@ class _PatientMakeReferralScreenState extends State { ? _selectedBranch['facilityName'] : null, enabled: false, - isDropDown: true, + isTextFieldHasSuffix: true, validationError: hospitalError, onClick: model.branchesList != null && model.branchesList.length > 0 && @@ -343,7 +343,7 @@ class _PatientMakeReferralScreenState extends State { ? _selectedClinic['ClinicDescription'] : null, enabled: false, - isDropDown: true, + isTextFieldHasSuffix: true, validationError: clinicError, onClick: _selectedBranch != null && model.clinicsList != null && @@ -393,7 +393,7 @@ class _PatientMakeReferralScreenState extends State { dropDownText: _selectedDoctor != null ? _selectedDoctor['Name'] : null, enabled: false, - isDropDown: true, + isTextFieldHasSuffix: true, validationError: doctorError, onClick: _selectedClinic != null && model.doctorsList != null && @@ -441,7 +441,7 @@ class _PatientMakeReferralScreenState extends State { ? "${DateUtils.convertDateToFormat(appointmentDate, "yyyy-MM-dd")}" : null, enabled: false, - isDropDown: true, + isTextFieldHasSuffix: true, suffixIcon: Icon( Icons.calendar_today, color: Colors.black, diff --git a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart index a2083bd9..0e642a10 100644 --- a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart +++ b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart @@ -3,7 +3,7 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +// import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/PatchAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; @@ -13,13 +13,16 @@ import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; -import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; -import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/app-textfield-custom.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/auto_complete_text_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/text_field_error.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/text_fields_utils.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; @@ -75,22 +78,29 @@ class _AddAssessmentDetailsState extends State { icdNameController.text = widget.mySelectedAssessment.selectedICD.code; } InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {IconData icon}) { - return InputDecoration( + String hintText, String selectedText, bool isDropDown , + + {IconData icon, String validationError}) { + return new InputDecoration( fillColor: Colors.white, contentPadding: EdgeInsets.symmetric(vertical: 15, horizontal: 10), focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0Xffffffff), width: 1.0), + borderSide: BorderSide(color: (validationError != null + ? Colors.red.shade700 + :Color(0xFFEFEFEF)) , width: 2.5), borderRadius: BorderRadius.circular(8), ), enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0Xffffffff), width: 1.0), + borderSide: BorderSide(color: (validationError != null + ? Colors.red.shade700 + : Color(0xFFEFEFEF)), width: 2.5), borderRadius: BorderRadius.circular(8), ), disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0Xffffffff), width: 1.0), + borderSide: BorderSide(color: (validationError != null + ? Colors.red.shade700 + : Color(0xFFEFEFEF)), width: 2.5), borderRadius: BorderRadius.circular(8), ), hintText: selectedText != null ? selectedText : hintText, @@ -139,10 +149,10 @@ class _AddAssessmentDetailsState extends State { Container( margin: EdgeInsets.only(left: 0, right: 0, top: 15), child: AppTextFieldCustom( - height: 55.0, + // height: 55.0, hintText: TranslationBase.of(context).appointmentNumber, - isDropDown: false, + isTextFieldHasSuffix: false, enabled: false, controller: appointmentIdController, ), @@ -164,47 +174,45 @@ class _AddAssessmentDetailsState extends State { child: widget .mySelectedAssessment.selectedICD == null - ? AutoCompleteTextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context) - .nameOrICD, - widget.mySelectedAssessment - .selectedICD != - null - ? widget.mySelectedAssessment - .selectedICD.nameEn - : null, - true, - icon: Icons.keyboard_arrow_down), - itemSubmitted: (item) => setState(() { - widget.mySelectedAssessment - .selectedICD = item; - icdNameController.text = '${item.code.trim()}/${item.description}'; - }), - key: key, - suggestions: model.listOfICD10, - itemBuilder: (context, suggestion) => - new Padding( - child: Texts(suggestion - .description + - " / " + - suggestion.code.toString()), - padding: EdgeInsets.all(8.0)), - itemSorter: (a, b) => 1, - itemFilter: (suggestion, input) => - suggestion.description - .toLowerCase() - .startsWith( - input.toLowerCase()) || - suggestion.description - .toLowerCase() - .startsWith( - input.toLowerCase()) || - suggestion.code - .toLowerCase() - .startsWith( - input.toLowerCase()), - ) + ? CustomAutoCompleteTextField( + isShowError: isFormSubmitted && + widget.mySelectedAssessment.selectedICD == null, + child:AutoCompleteTextField( + + decoration: TextFieldsUtils.textFieldSelectorDecoration( + TranslationBase.of(context) + .nameOrICD, null, true, suffixIcon: Icons.search), + + itemSubmitted: (item) => setState(() { + widget.mySelectedAssessment + .selectedICD = item; + icdNameController.text = '${item.code.trim()}/${item.description}'; + }), + key: key, + suggestions: model.listOfICD10, + itemBuilder: (context, suggestion) => + new Padding( + child: Texts(suggestion + .description + + " / " + + suggestion.code.toString()), + padding: EdgeInsets.all(8.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, input) => + suggestion.description + .toLowerCase() + .startsWith( + input.toLowerCase()) || + suggestion.description + .toLowerCase() + .startsWith( + input.toLowerCase()) || + suggestion.code + .toLowerCase() + .startsWith( + input.toLowerCase()), + ), + ) : AppTextFieldCustom( onClick: model.listOfICD10 != null ? () { @@ -220,19 +228,16 @@ class _AddAssessmentDetailsState extends State { maxLines: 2, minLines: 1, controller: icdNameController, - enabled: true, + isTextFieldHasSuffix: true, + suffixIcon: Icon(Icons.search,color: Colors.grey.shade600,), ) ), ), - if (isFormSubmitted && - widget.mySelectedAssessment.selectedICD == null) - CustomValidationError(), SizedBox( height: 7, ), AppTextFieldCustom( - height: 55.0, onClick: model.listOfDiagnosisCondition != null ? () { MasterKeyDailog dialog = MasterKeyDailog( @@ -271,19 +276,20 @@ class _AddAssessmentDetailsState extends State { maxLines: 2, minLines: 1, controller: conditionController, - isDropDown: true, + isTextFieldHasSuffix: true, enabled: false, + hasBorder: true, + validationError: isFormSubmitted && + widget.mySelectedAssessment + .selectedDiagnosisCondition == null?TranslationBase + .of(context) + .emptyMessage:null, ), - if (isFormSubmitted && - widget.mySelectedAssessment - .selectedDiagnosisCondition == - null) - CustomValidationError(), + SizedBox( height: 10, ), AppTextFieldCustom( - height: 55.0, onClick: model.listOfDiagnosisType != null ? () { MasterKeyDailog dialog = MasterKeyDailog( @@ -315,40 +321,30 @@ class _AddAssessmentDetailsState extends State { maxLines: 2, minLines: 1, enabled: false, - isDropDown: true, + isTextFieldHasSuffix: true, controller: typeController, + hasBorder: true, + validationError: isFormSubmitted && + widget.mySelectedAssessment + .selectedDiagnosisType == null?TranslationBase + .of(context) + .emptyMessage:null, ), - if (isFormSubmitted && - widget.mySelectedAssessment - .selectedDiagnosisType == - null) - CustomValidationError(), SizedBox( height: 10, ), Container( margin: EdgeInsets.only(left: 0, right: 0, top: 15), - child: TextFields( + child: AppTextFieldCustom( hintText: TranslationBase.of(context).remarks, - fontSize: 13.5, - fontWeight: FontWeight.w600, maxLines: 18, minLines: 5, - hasLabelText: - remarkController.text != '' ? true : false, - showLabelText: true, controller: remarkController, onChanged: (value) { widget.mySelectedAssessment.remark = remarkController.text; }, - validator: (value) { - if (value == null) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }), + ), ), SizedBox( height: 10, @@ -458,7 +454,7 @@ class _AddAssessmentDetailsState extends State { } if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); + Helpers.showErrorToast(model.error); } else { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); diff --git a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart index 7a42fe79..309df861 100644 --- a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart +++ b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; @@ -496,7 +497,7 @@ class _UpdateAssessmentPageState extends State { loading: model.state == ViewState.BusyLocal, onPressed: () async { if (widget.mySelectedAssessmentList.isEmpty) { - helpers.showErrorToast( + Helpers.showErrorToast( TranslationBase .of(context) .assessmentErrorMsg); diff --git a/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart b/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart index 82cef2e9..ea933cee 100644 --- a/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart +++ b/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart @@ -4,7 +4,7 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; import 'package:flutter/material.dart'; diff --git a/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart b/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart index 941b60ca..a3d5ed9b 100644 --- a/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart +++ b/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart @@ -1,7 +1,7 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:flutter/material.dart'; @@ -43,7 +43,7 @@ class _ExaminationsListSearchWidgetState AppTextFieldCustom( height: MediaQuery.of(context).size.height * 0.080, hintText: TranslationBase.of(context).searchExamination, - isDropDown: true, + isTextFieldHasSuffix: true, hasBorder: false, controller: filteredSearchController, onChanged: (value) { diff --git a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart index abb62808..0e9ada40 100644 --- a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart @@ -2,8 +2,6 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; @@ -11,6 +9,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model. import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -131,9 +130,14 @@ class _UpdateObjectivePageState extends State { }).toList(), ) ], + ), isExpanded: isSysExaminationExpand, ), + SizedBox(height: MediaQuery + .of(context) + .size + .height * 0.12,) ], ), ), @@ -250,14 +254,14 @@ class _UpdateObjectivePageState extends State { } if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); + Helpers.showErrorToast(model.error); } else { widget.changeLoadingState(true); widget.changePageViewIndex(2); } } else { - helpers.showErrorToast(TranslationBase.of(context).examinationErrorMsg); + Helpers.showErrorToast(TranslationBase.of(context).examinationErrorMsg); } } diff --git a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart index 6f57ceb8..b99aea6e 100644 --- a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart +++ b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart @@ -13,7 +13,7 @@ import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; -import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -85,7 +85,7 @@ class _UpdatePlanPageState extends State { await model.getPatientProgressNote(getGetProgressNoteReqModel); if (model.patientProgressNoteList.isNotEmpty) { - progressNoteController.text = helpers + progressNoteController.text = Helpers .parseHtmlString(model.patientProgressNoteList[0].planNote); widget.patientProgressNote.planNote = progressNoteController.text; widget.patientProgressNote.createdByName = model.patientProgressNoteList[0].createdByName; @@ -303,7 +303,7 @@ class _UpdatePlanPageState extends State { Navigator.of(context).pop(); } } else { - helpers.showErrorToast(TranslationBase.of(context) + Helpers.showErrorToast(TranslationBase.of(context) .progressNoteErrorMsg); } }, @@ -342,12 +342,12 @@ class _UpdatePlanPageState extends State { } if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); + Helpers.showErrorToast(model.error); } else { widget.changePageViewIndex(4,isChangeState:false); } } else { - helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); + Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); } } diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart index c1cbcd28..02985823 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -207,7 +208,7 @@ class _AddAllergiesState extends State { addAllergyLocally(MySelectedAllergy mySelectedAllergy) { if (mySelectedAllergy.selectedAllergy == null) { - helpers.showErrorToast(TranslationBase + Helpers.showErrorToast(TranslationBase .of(context) .requiredMsg); } else { diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart index ff88718e..6aeadfbc 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -187,7 +188,7 @@ class _UpdateAllergiesWidgetState extends State { changeParentState(); Navigator.of(context).pop(); } else { - helpers.showErrorToast(TranslationBase + Helpers.showErrorToast(TranslationBase .of(context) .requiredMsg); } diff --git a/lib/screens/patients/profile/soap_update/subjective/cheif_complaints/update_Chief_complaints.dart b/lib/screens/patients/profile/soap_update/subjective/cheif_complaints/update_Chief_complaints.dart index cdc6cad5..e0e64288 100644 --- a/lib/screens/patients/profile/soap_update/subjective/cheif_complaints/update_Chief_complaints.dart +++ b/lib/screens/patients/profile/soap_update/subjective/cheif_complaints/update_Chief_complaints.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/new_text_Field.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/app-textfield-custom.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/new_text_Field.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -35,33 +36,28 @@ class UpdateChiefComplaints extends StatelessWidget { height: 20, ), //TODO handel error cases - NewTextFields( + AppTextFieldCustom( hintText: TranslationBase.of(context).addChiefComplaints, controller: complaintsController, maxLines: 25, - minLines: 3, - ), + minLines: 7, + hasBorder: true, + validationError:complaintsController.text.isEmpty && complaintsControllerError !=''?complaintsControllerError:null , - Container( - child: CustomValidationError( - error: complaintsControllerError, - )), + ), SizedBox( height: 20, ), - NewTextFields( + AppTextFieldCustom( hintText: TranslationBase .of(context) .historyOfPresentIllness, controller: illnessController, maxLines: 25, - minLines: 3, - ), - Container( - child: CustomValidationError(error: illnessControllerError,)), - SizedBox( - height: 20, + minLines: 7, + hasBorder: true, + validationError:illnessController.text.isEmpty && illnessControllerError !=''?illnessControllerError:null , ), SizedBox( height: 10, @@ -72,16 +68,17 @@ class UpdateChiefComplaints extends StatelessWidget { SizedBox( height: 10, ), - NewTextFields( + AppTextFieldCustom( hintText: TranslationBase .of(context) .currentMedications, controller: medicationController, - maxLines: 25, - minLines: 3, + maxLines: 25, + minLines: 7, + hasBorder: true, + validationError:medicationController.text.isEmpty && medicationControllerError !=''?medicationControllerError:null , + ), - Container(child: CustomValidationError( - error: medicationControllerError,)), SizedBox( height: 10, ), diff --git a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart index 3b96cd65..867e8d11 100644 --- a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart +++ b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart @@ -8,11 +8,13 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; -import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/app-textfield-custom.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/auto_complete_text_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/text_field_error.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/text_fields_utils.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; @@ -45,47 +47,13 @@ class _AddMedicationState extends State { GetMedicationResponseModel _selectedMedication; GlobalKey key = - new GlobalKey>(); + new GlobalKey>(); bool isFormSubmitted = false; - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {IconData icon}) { - return InputDecoration( - filled: true, - fillColor: Colors.white, - - contentPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey, width: 0.00), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey, width: 0.00), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey, width: 0.00), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null, - hintStyle: TextStyle( - fontSize: 10, - color: Theme - .of(context) - .hintColor, - fontWeight: FontWeight.w700 - ), - ); - } - @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - final screenSize = MediaQuery - .of(context) - .size; + final screenSize = MediaQuery.of(context).size; return FractionallySizedBox( child: BaseView( onModelReady: (model) async { @@ -136,7 +104,7 @@ class _AddMedicationState extends State { height: 16, ), Container( - height: screenSize.height * 0.070, + // height: screenSize.height * 0.070, child: InkWell( onTap: model.allMedicationList != null ? () { @@ -146,48 +114,55 @@ class _AddMedicationState extends State { } : null, child: _selectedMedication == null - ? AutoCompleteTextField< - GetMedicationResponseModel>( - decoration: - textFieldSelectorDecoration( + ? - TranslationBase.of(context) - .searchMedicineNameHere, - _selectedMedication != null - ? _selectedMedication - .genericName - : null, - true, - icon: EvaIcons.search), - itemSubmitted: (item) => setState( - () => - _selectedMedication = item), - key: key, - suggestions: - model.allMedicationList, - itemBuilder: (context, - suggestion) => - new Padding( - child: Texts(suggestion - .description + - '/' + - suggestion.genericName), - padding: - EdgeInsets.all(8.0)), - itemSorter: (a, b) => 1, - itemFilter: (suggestion, input) => - suggestion.genericName - .toLowerCase() - .startsWith( - input.toLowerCase()) || - suggestion.description - .toLowerCase() - .startsWith( - input.toLowerCase()) || - suggestion.keywords - .toLowerCase() - .startsWith( - input.toLowerCase()), + + CustomAutoCompleteTextField( + isShowError: isFormSubmitted && + _selectedMedication ==null, + child: AutoCompleteTextField< + GetMedicationResponseModel>( + + decoration: + TextFieldsUtils.textFieldSelectorDecoration( + TranslationBase.of(context) + .searchMedicineNameHere, null, true, suffixIcon: Icons.search), + + itemSubmitted: (item) => + setState( + () => + _selectedMedication = + item), + key: key, + suggestions: + model.allMedicationList, + itemBuilder: (context, + suggestion) => + new Padding( + child: Texts(suggestion + .description + + '/' + + suggestion + .genericName), + padding: + EdgeInsets.all(8.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, + input) => + suggestion.genericName + .toLowerCase() + .startsWith( + input.toLowerCase()) || + suggestion.description + .toLowerCase() + .startsWith( + input + .toLowerCase()) || + suggestion.keywords + .toLowerCase() + .startsWith( + input.toLowerCase()), + ), ) : AppTextFieldCustom( hintText: _selectedMedication != null @@ -198,13 +173,12 @@ class _AddMedicationState extends State { .searchMedicineNameHere, minLines: 2, maxLines: 2, + isTextFieldHasSuffix: true, + suffixIcon: Icon(Icons.search,color: Colors.grey.shade600,), enabled: false, ), ), ), - if (isFormSubmitted && - _selectedMedication == null) - CustomValidationError(), SizedBox( height: 5, ), @@ -231,6 +205,7 @@ class _AddMedicationState extends State { .nameEn; }); }, + ); showDialog( barrierDismissible: false, @@ -245,21 +220,19 @@ class _AddMedicationState extends State { TranslationBase.of(context).doseTime, maxLines: 2, minLines: 2, - isDropDown: true, + isTextFieldHasSuffix: true, controller: doseController, + validationError:isFormSubmitted && + _selectedMedicationDose == null?TranslationBase + .of(context) + .emptyMessage:null, ), SizedBox( height: 5, ), - if (isFormSubmitted && - _selectedMedicationDose == null) - CustomValidationError(), - SizedBox( - height: 5, - ), AppTextFieldCustom( enabled: false, - isDropDown: true, + isTextFieldHasSuffix: true, onClick: model.medicationStrengthList != null ? () { MasterKeyDailog dialog = @@ -296,19 +269,20 @@ class _AddMedicationState extends State { maxLines: 2, minLines: 2, controller: strengthController, + validationError:isFormSubmitted && + _selectedMedicationStrength == null?TranslationBase + .of(context) + .emptyMessage:null, ), SizedBox( height: 5, ), - if (isFormSubmitted && - _selectedMedicationStrength == null) - CustomValidationError(), SizedBox( height: 5, ), AppTextFieldCustom( enabled: false, - isDropDown: true, + isTextFieldHasSuffix: true, onClick: model.medicationRouteList != null ? () { MasterKeyDailog dialog = @@ -344,13 +318,14 @@ class _AddMedicationState extends State { maxLines: 2, minLines: 2, controller: routeController, + validationError:isFormSubmitted && + _selectedMedicationRoute == null?TranslationBase + .of(context) + .emptyMessage:null, ), SizedBox( height: 5, ), - if (isFormSubmitted && - _selectedMedicationRoute == null) - CustomValidationError(), SizedBox( height: 5, ), @@ -391,15 +366,16 @@ class _AddMedicationState extends State { enabled: false, maxLines: 2, minLines: 2, - isDropDown: true, + isTextFieldHasSuffix: true, controller: frequencyController, + validationError:isFormSubmitted && + _selectedMedicationFrequency == null?TranslationBase + .of(context) + .emptyMessage:null, ), SizedBox( height: 5, ), - if (isFormSubmitted && - _selectedMedicationFrequency == null) - CustomValidationError(), SizedBox( height: 30, ), diff --git a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart index d78c8c45..c6fc5253 100644 --- a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -1,4 +1,3 @@ -import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; @@ -15,6 +14,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -208,7 +208,7 @@ class _UpdateSubjectivePageState extends State { await model.getPatientChiefComplaint(getChiefComplaintReqModel); if (model.patientChiefComplaintList.isNotEmpty) { isChiefExpand = true; - complaintsController.text = helpers.parseHtmlString( + complaintsController.text = Helpers.parseHtmlString( model.patientChiefComplaintList[0].chiefComplaint); illnessController.text = model.patientChiefComplaintList[0].hopi; medicationController.text =!(model.patientChiefComplaintList[0].currentMedication).isNotEmpty ? model.patientChiefComplaintList[0].currentMedication + '\n \n':model.patientChiefComplaintList[0].currentMedication; @@ -376,19 +376,19 @@ class _UpdateSubjectivePageState extends State { complaintsController.text.length > 25) { await postChiefComplaint(model: model); if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); + Helpers.showErrorToast(model.error); } if (myHistoryList.length != 0) { await postHistories(model: model, myHistoryList: myHistoryList); if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); + Helpers.showErrorToast(model.error); } } if (myAllergiesList.length != 0) { await postAllergy(myAllergiesList: myAllergiesList, model: model); if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); + Helpers.showErrorToast(model.error); } } widget.changeLoadingState(true); @@ -419,7 +419,7 @@ class _UpdateSubjectivePageState extends State { .emptyMessage; } }); - helpers.showErrorToast(TranslationBase + Helpers.showErrorToast(TranslationBase .of(context) .chiefComplaintErrorMsg); } @@ -470,7 +470,7 @@ class _UpdateSubjectivePageState extends State { await model.getPatientAllergy(generalGetReqForSOAP, isLocalBusy : true); if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); + Helpers.showErrorToast(model.error); } } @@ -501,7 +501,7 @@ class _UpdateSubjectivePageState extends State { if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); + Helpers.showErrorToast(model.error); } } diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 67c483a8..397e1a60 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -20,7 +20,7 @@ import 'package:doctor_app_flutter/widgets/medicine/medicine_item_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; @@ -83,7 +83,7 @@ postProcedure( await model.postPrescription(postProcedureReqModel, patient.patientMRN); if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); + Helpers.showErrorToast(model.error); } else if (model.state == ViewState.Idle) { model.getPrescriptions(patient); DrAppToastMsg.showSuccesToast('Medication has been added'); @@ -715,7 +715,7 @@ class _PrescriptionFormWidgetState extends State { }); if (route == null) { - helpers.showErrorToast( + Helpers.showErrorToast( 'plase fill'); } }, @@ -1556,12 +1556,12 @@ class _PrescriptionFormWidgetState extends State { searchMedicine(context, MedicineViewModel model) async { FocusScope.of(context).unfocus(); // if (myController.text.isEmpty()) { - // helpers.showErrorToast(TranslationBase.of(context).typeMedicineName); + // Helpers.showErrorToast(TranslationBase.of(context).typeMedicineName); // //"Type Medicine Name") // return; // } if (myController.text.length < 3) { - helpers.showErrorToast(TranslationBase.of(context).moreThan3Letter); + Helpers.showErrorToast(TranslationBase.of(context).moreThan3Letter); return; } diff --git a/lib/screens/prescription/prescription_items_page.dart b/lib/screens/prescription/prescription_items_page.dart index a92f5365..b798418e 100644 --- a/lib/screens/prescription/prescription_items_page.dart +++ b/lib/screens/prescription/prescription_items_page.dart @@ -30,6 +30,7 @@ class PrescriptionItemsPage extends StatelessWidget { model.getPrescriptionReport(prescriptions: prescriptions,patient: patient), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, + backgroundColor: Colors.grey[100], baseViewModel: model, appBar: PatientProfileHeaderWhitAppointmentAppBar( patient: patient, diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index 18655e65..3d846515 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.dart'; import 'package:doctor_app_flutter/screens/prescription/update_prescription_form.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; @@ -227,7 +228,7 @@ class _NewPrescriptionScreenState extends State { 13.5, ), AppText( - Helpers.getMonth(model.prescriptionList[0].entityList[index].createdOn != + DateUtils.getMonth(model.prescriptionList[0].entityList[index].createdOn != null ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) .month) @@ -250,7 +251,7 @@ class _NewPrescriptionScreenState extends State { .green, ), AppText( - Helpers.getTimeFormated(DateTime.parse(model + DateUtils.getTimeFormated(DateTime.parse(model .prescriptionList[ 0] .entityList[ @@ -290,7 +291,7 @@ class _NewPrescriptionScreenState extends State { Expanded( child: AppText( - Helpers.getDateFormatted(DateTime.parse(model + DateUtils.getDateFormatted(DateTime.parse(model .prescriptionList[0] .entityList[index] .startDate)), diff --git a/lib/screens/prescription/prescription_screen_history.dart b/lib/screens/prescription/prescription_screen_history.dart index 940cfc2a..d7b3e4fc 100644 --- a/lib/screens/prescription/prescription_screen_history.dart +++ b/lib/screens/prescription/prescription_screen_history.dart @@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.dart'; import 'package:doctor_app_flutter/screens/prescription/update_prescription_form.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; @@ -128,7 +129,7 @@ class _NewPrescriptionHistoryScreenState 13.5, ), AppText( - Helpers.getMonth(model.prescriptionList[0].entityList[index].createdOn != + DateUtils.getMonth(model.prescriptionList[0].entityList[index].createdOn != null ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) .month) @@ -151,7 +152,7 @@ class _NewPrescriptionHistoryScreenState .green, ), AppText( - Helpers.getTimeFormated(DateTime.parse(model + DateUtils.getTimeFormated(DateTime.parse(model .prescriptionList[ 0] .entityList[ @@ -190,7 +191,7 @@ class _NewPrescriptionHistoryScreenState Expanded( child: AppText( - Helpers.getDateFormatted(DateTime.parse(model + DateUtils.getDateFormatted(DateTime.parse(model .prescriptionList[0] .entityList[index] .startDate)), diff --git a/lib/screens/prescription/prescription_warnings.dart b/lib/screens/prescription/prescription_warnings.dart index 44bcab0c..f5773af8 100644 --- a/lib/screens/prescription/prescription_warnings.dart +++ b/lib/screens/prescription/prescription_warnings.dart @@ -1,7 +1,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; diff --git a/lib/screens/prescription/update_prescription_form.dart b/lib/screens/prescription/update_prescription_form.dart index 7c1bc88e..27c56ed0 100644 --- a/lib/screens/prescription/update_prescription_form.dart +++ b/lib/screens/prescription/update_prescription_form.dart @@ -666,7 +666,7 @@ class _UpdatePrescriptionFormState extends State { child: TextField( decoration: Helpers .textFieldSelectorDecoration( - Helpers.getDateFormatted( + DateUtils.getDateFormatted( DateTime.parse( widget.startDate)), selectedDate != null @@ -1005,7 +1005,7 @@ class _UpdatePrescriptionFormState extends State { updatePrescriptionReqModel, patient.patientMRN); if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); + Helpers.showErrorToast(model.error); } else if (model.state == ViewState.Idle) { DrAppToastMsg.showSuccesToast('Medication has been updated'); } diff --git a/lib/screens/procedures/ProcedureCard.dart b/lib/screens/procedures/ProcedureCard.dart index 2f3718a3..761db652 100644 --- a/lib/screens/procedures/ProcedureCard.dart +++ b/lib/screens/procedures/ProcedureCard.dart @@ -1,9 +1,12 @@ import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/lab_result/FlowChartPage.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -13,13 +16,16 @@ class ProcedureCard extends StatelessWidget { final EntityList entityList; final String categoryName; final int categoryID; + final PatiantInformtion patient; const ProcedureCard( {Key key, this.onTap, this.entityList, this.categoryID, - this.categoryName}) + this.categoryName, + this.patient, + }) : super(key: key); @override @@ -154,6 +160,27 @@ class ProcedureCard extends StatelessWidget { ), ], ), + Container( + alignment: Alignment.centerRight, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: FlowChartPage( + filterName: entityList.procedureName, + patient: patient, + ), + ), + ); + }, + child: Texts( + TranslationBase.of(context).showMoreBtn, + textDecoration: TextDecoration.underline, + color: Colors.blue, + ), + ), + ), // Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, // children: [ diff --git a/lib/screens/procedures/add-procedure-form.dart b/lib/screens/procedures/add-procedure-form.dart index 8fe7deea..92a74e77 100644 --- a/lib/screens/procedures/add-procedure-form.dart +++ b/lib/screens/procedures/add-procedure-form.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; @@ -75,22 +76,22 @@ postProcedure( await model.postProcedure(postProcedureReqModel, patient.patientMRN); if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); + Helpers.showErrorToast(model.error); model.getProcedure(mrn: patient.patientMRN); } else if (model.state == ViewState.Idle) { DrAppToastMsg.showSuccesToast('procedure has been added'); } } else { if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); + Helpers.showErrorToast(model.error); model.getProcedure(mrn: patient.patientMRN); } else if (model.state == ViewState.Idle) { - helpers.showErrorToast( + Helpers.showErrorToast( model.valadteProcedureList[0].entityList[0].warringMessages); } } } else { - helpers.showErrorToast(model.error); + Helpers.showErrorToast(model.error); } } diff --git a/lib/screens/procedures/add_lab_orders.dart b/lib/screens/procedures/add_lab_orders.dart index 29f01858..92f62746 100644 --- a/lib/screens/procedures/add_lab_orders.dart +++ b/lib/screens/procedures/add_lab_orders.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; @@ -75,22 +76,22 @@ postProcedure( await model.postProcedure(postProcedureReqModel, patient.patientMRN); if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); + Helpers.showErrorToast(model.error); model.getLabs(patient); } else if (model.state == ViewState.Idle) { DrAppToastMsg.showSuccesToast('procedure has been added'); } } else { if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); + Helpers.showErrorToast(model.error); model.getLabs(patient); } else if (model.state == ViewState.Idle) { - helpers.showErrorToast( + Helpers.showErrorToast( model.valadteProcedureList[0].entityList[0].warringMessages); } } } else { - helpers.showErrorToast(model.error); + Helpers.showErrorToast(model.error); } } diff --git a/lib/screens/procedures/add_radiology_order.dart b/lib/screens/procedures/add_radiology_order.dart index 9e614d44..1dd30467 100644 --- a/lib/screens/procedures/add_radiology_order.dart +++ b/lib/screens/procedures/add_radiology_order.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; @@ -75,22 +76,22 @@ postProcedure( await model.postProcedure(postProcedureReqModel, patient.patientMRN); if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); + Helpers.showErrorToast(model.error); model.getPatientRadOrders(patient); } else if (model.state == ViewState.Idle) { DrAppToastMsg.showSuccesToast('procedure has been added'); } } else { if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); + Helpers.showErrorToast(model.error); model.getPatientRadOrders(patient); } else if (model.state == ViewState.Idle) { - helpers.showErrorToast( + Helpers.showErrorToast( model.valadteProcedureList[0].entityList[0].warringMessages); } } } else { - helpers.showErrorToast(model.error); + Helpers.showErrorToast(model.error); } } diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 1e6d55a8..d9e8d8ab 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -170,9 +170,10 @@ class ProcedureScreen extends StatelessWidget { limetNo: model.procedureList[0].entityList[index] .lineItemNo); // } else - // helpers.showErrorToast( + // Helpers.showErrorToast( // 'You Cant Update This Procedure'); }, + patient: patient, ), ), if (model.procedureList.length != 0 && diff --git a/lib/screens/procedures/update-procedure.dart b/lib/screens/procedures/update-procedure.dart index d9c6a20a..e1da3739 100644 --- a/lib/screens/procedures/update-procedure.dart +++ b/lib/screens/procedures/update-procedure.dart @@ -10,6 +10,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/procedures/entity_list_checkbox_search_widget.dart'; import 'package:doctor_app_flutter/screens/procedures/entity_list_procedure_widget.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; @@ -410,7 +411,7 @@ class _UpdateProcedureWidgetState extends State { mrn: patient.patientMRN); if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); + Helpers.showErrorToast(model.error); model.getProcedure(mrn: patient.patientMRN); } else if (model.state == ViewState.Idle) { DrAppToastMsg.showSuccesToast('procedure has been updated'); diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index e2959c75..3ab34bea 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -11,12 +11,11 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; -import 'package:doctor_app_flutter/util/text_validator.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:flutter/cupertino.dart'; diff --git a/lib/screens/sick-leave/sick_leave.dart b/lib/screens/sick-leave/sick_leave.dart index 0e1a8491..e05f6046 100644 --- a/lib/screens/sick-leave/sick_leave.dart +++ b/lib/screens/sick-leave/sick_leave.dart @@ -10,13 +10,12 @@ import 'package:doctor_app_flutter/screens/sick-leave/add-sickleave.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; -import 'package:doctor_app_flutter/util/text_validator.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:flutter/cupertino.dart'; diff --git a/lib/util/date-utils.dart b/lib/util/date-utils.dart index d55675c3..c4f187c5 100644 --- a/lib/util/date-utils.dart +++ b/lib/util/date-utils.dart @@ -320,4 +320,36 @@ class DateUtils { return false; } + + static String getDate(DateTime dateTime) { + print(dateTime); + if (dateTime != null) + return getMonth(dateTime.month) + + " " + + dateTime.day.toString() + + "," + + dateTime.year.toString(); + else + return ""; + } + + static String getDateFormatted(DateTime dateTime) { + print(dateTime); + if (dateTime != null) + return dateTime.day.toString() + + "/" + + dateTime.month.toString() + + "/" + + dateTime.year.toString(); + else + return ""; + } + + static String getTimeFormated(DateTime dateTime) { + print(dateTime); + if (dateTime != null) + return dateTime.hour.toString() + ":" + dateTime.minute.toString(); + else + return ""; + } } diff --git a/lib/util/dr_app_toast_msg.dart b/lib/util/dr_app_toast_msg.dart index bf91a11f..a8d2fc53 100644 --- a/lib/util/dr_app_toast_msg.dart +++ b/lib/util/dr_app_toast_msg.dart @@ -33,7 +33,7 @@ class DrAppToastMsg { textColor: Colors.white); } - void showShortToast(msg) { + static void showShortToast(msg) { FlutterFlexibleToast.showToast( message: msg, toastLength: Toast.LENGTH_SHORT, @@ -50,7 +50,7 @@ class DrAppToastMsg { timeInSeconds: 1); } - void showCenterShortToast(msg) { + static void showCenterShortToast(msg) { FlutterFlexibleToast.showToast( message: msg, toastLength: Toast.LENGTH_SHORT, @@ -59,7 +59,7 @@ class DrAppToastMsg { timeInSeconds: 1); } - void showCenterShortLoadingToast(msg) { + static void showCenterShortLoadingToast(msg) { FlutterFlexibleToast.showToast( message: msg, toastLength: Toast.LENGTH_LONG, @@ -72,7 +72,7 @@ class DrAppToastMsg { timeInSeconds: 2); } - void cancelToast(msg) { + static void cancelToast(msg) { FlutterFlexibleToast.cancel(); } } diff --git a/lib/util/extenstions.dart b/lib/util/extenstions.dart index 1c79f01c..26e49670 100644 --- a/lib/util/extenstions.dart +++ b/lib/util/extenstions.dart @@ -1,7 +1,3 @@ -// OWNER : Ibrahim albitar -// DATE : 19-04-2020 -// DESCRIPTION : Extension for all classes objects. - extension Extension on Object { bool isNullOrEmpty() => this == null || this == ''; diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index 6a57bcfa..97af8ef0 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -18,27 +18,11 @@ import 'dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); - -/* - *@author: Elham Rababah - *@Date:12/4/2020 - *@param: - *@return: - *@desc: This class will contian some Function will help developer - */ class Helpers { - int cupertinoPickerIndex = 0; + static int cupertinoPickerIndex = 0; get currentLanguage => null; - -/* - *@author: Elham Rababah - *@Date:12/4/2020 - *@param: context, items, decKey, onSelectFun - *@return: Container Widget - *@desc: showCupertinoPicker its a general function to show cupertino picker - */ - showCupertinoPicker(context, items, decKey, onSelectFun) { + static showCupertinoPicker(context, items, decKey, onSelectFun) { showModalBottomSheet( isDismissible: false, context: context, @@ -86,23 +70,14 @@ class Helpers { }); } - TextStyle textStyle(context) => + static TextStyle textStyle(context) => TextStyle(color: Theme.of(context).primaryColor); -/* - *@author: Elham Rababah - *@Date:12/4/2020 - *@param: context, List items, decKey, onSelectFun - *@return: Container widget - *@desc: buildPickerIterm this function will build the items of the cupertino - */ - buildPickerItems(context, List items, decKey, onSelectFun) { + static buildPickerItems(context, List items, decKey, onSelectFun) { return CupertinoPicker( magnification: 1.5, scrollController: FixedExtentScrollController(initialItem: cupertinoPickerIndex), - - // backgroundColor: Colors.black87, children: items.map((item) { return Text( '${item["$decKey"]}', @@ -111,23 +86,14 @@ class Helpers { }).toList(), itemExtent: 25, - //height of each item looping: false, onSelectedItemChanged: (int index) { - // selectitem =index; cupertinoPickerIndex = index; }, ); } -/* - *@author: Elham Rababah - *@Date:12/4/2020 - *@param: msg - *@return: - *@desc: showErrorToast -*/ - showErrorToast([msg = null]) { + static showErrorToast([msg = null]) { String localMsg = generateContactAdminMsg(); if (msg != null) { @@ -136,14 +102,6 @@ class Helpers { DrAppToastMsg.showErrorToast(localMsg); } - -/* - *@author: Mohammad Aljammal - *@Date:27/4/2020 - *@param: - *@return: Boolean - *@desc: Check The Internet Connection - */ static Future checkConnection() async { ConnectivityResult connectivityResult = await (Connectivity().checkConnectivity()); @@ -155,172 +113,6 @@ class Helpers { } } - /* - *@author: Mohammad Aljammal - *@Date:26/5/2020 - *@param: date in String formatted - *@return: DateTime - *@desc: convert String to DateTime - */ - static DateTime convertStringToDate(String date) { - const start = "/Date("; - const end = "+0300)"; - final startIndex = date.indexOf(start); - final endIndex = date.indexOf(end, startIndex + start.length); - return DateTime.fromMillisecondsSinceEpoch( - int.parse( - date.substring(startIndex + start.length, endIndex), - ), - ); - } - - /* - *@author: Amjad Amireh - *@Date:5/5/2020 - *@param: checkDate - *@return: DateTime - *@desc: convert String to DateTime - */ - static String checkDate(String dateString) { - DateTime checkedTime = DateTime.parse(dateString); - DateTime currentTime = DateTime.now(); - - if ((currentTime.year == checkedTime.year) && - (currentTime.month == checkedTime.month) && - (currentTime.day == checkedTime.day)) { - return "Today"; - } else if ((currentTime.year == checkedTime.year) && - (currentTime.month == checkedTime.month)) { - if ((currentTime.day - checkedTime.day) == 1) { - return "YESTERDAY"; - } else if ((currentTime.day - checkedTime.day) == -1) { - return "Tomorrow"; - } - - if ((currentTime.day - checkedTime.day) <= -2) { - return "Next Week"; - } else { - return "Old Date"; - } - } - return "Old Date"; - } - - /* - *@author: Mohammad Aljammal - *@Date:26/5/2020 - *@param: month in int formatted - *@return: DateTime - *@desc: convert month in int to month name - */ - static getMonth(int month) { - switch (month) { - case 1: - return "Jan"; - case 2: - return "Feb"; - case 3: - return "Mar"; - case 4: - return "Apr"; - case 5: - return "May"; - case 6: - return "Jun"; - case 7: - return "Jul"; - case 8: - return "Aug"; - case 9: - return "Sep"; - case 10: - return "Oct"; - case 11: - return "Nov"; - case 12: - return "Dec"; - } - } - - /* - *@author: Mohammad Aljammal - *@Date:26/5/2020 - *@param: week day in int formatted - *@return: DateTime - *@desc: convert week day in int to week day name - */ - static getWeekDay(int weekDay) { - switch (weekDay) { - case 1: - return "Monday"; - case 2: - return "Tuesday"; - case 3: - return "Wednesday"; - case 4: - return "Thursday"; - case 5: - return "Friday"; - case 6: - return "Saturday "; - case 7: - return "Sunday"; - } - } - - /* - *@author: Mohammad Aljammal - *@Date:26/5/2020 - *@param: DateTime - *@return: data formatted like Apr 26,2020 - *@desc: convert DateTime to data formatted - */ - static String getDate(DateTime dateTime) { - print(dateTime); - if (dateTime != null) - return getMonth(dateTime.month) + - " " + - dateTime.day.toString() + - "," + - dateTime.year.toString(); - else - return ""; - } - - /* - *@author: Mohammad Aljammal - *@Date:26/5/2020 - *@param: DateTime - *@return: data formatted like 26/4/2020 - *@desc: convert DateTime to data formatted - */ - static String getDateFormatted(DateTime dateTime) { - print(dateTime); - if (dateTime != null) - return dateTime.day.toString() + - "/" + - dateTime.month.toString() + - "/" + - dateTime.year.toString(); - else - return ""; - } - - static String getTimeFormated(DateTime dateTime) { - print(dateTime); - if (dateTime != null) - return dateTime.hour.toString() + ":" + dateTime.minute.toString(); - else - return ""; - } - - /* - *@author: Mohammad Aljammal - *@Date:26/5/2020 - *@param: String workingHours - *@return: List - *@desc: convert workingHours string to List - */ static List getWorkingHours(String workingHours) { List myWorkingHours = []; List listOfHours = workingHours.split('a'); @@ -337,14 +129,7 @@ class Helpers { return myWorkingHours; } -/* - *@author: Elham Rababah - *@Date:12/5/2020 - *@param: - *@return: String - *@desc: generate Contact Admin Msg - */ - generateContactAdminMsg([err = null]) { + static generateContactAdminMsg([err = null]) { String localMsg = 'Something wrong happened, please contact the admin'; if (err != null) { localMsg = localMsg + '\n \n' + err.toString(); @@ -356,7 +141,7 @@ class Helpers { await sharedPref.clear(); } - logout() async { + static logout() async { DEVICE_TOKEN = ""; String lang = await sharedPref.getString(APP_Language); await clearSharedPref(); @@ -378,7 +163,7 @@ class Helpers { (r) => false); } - String parseHtmlString(String htmlString) { + static String parseHtmlString(String htmlString) { final document = parse(htmlString); final String parsedString = parse(document.body.text).documentElement.text; diff --git a/lib/util/text_validator.dart b/lib/util/text_validator.dart deleted file mode 100644 index 1fe21c9e..00000000 --- a/lib/util/text_validator.dart +++ /dev/null @@ -1,37 +0,0 @@ - import '../util/extenstions.dart'; - - class TextValidator{ - -// OWNER : Ibrahim albitar -// DATE : 19-04-2020 -// DESCRIPTION : Text Validator. - - String validateName(String value) { - if (value.isNullOrEmpty()||value.length < 3) - return 'Name must be more than 2 charater'; - else - return null; - } - - String validateMobile(String value) { - if (value.isNullOrEmpty()||value.length != 10) - return 'Mobile Number must be of 10 digit'; - else - return null; - } - - String validateIdNumber(String value) { - if (value.isNullOrEmpty()) - return 'Please input valid number'; - else - return null; - } - - String validateDate(String value) { - if (value.isNullOrEmpty()) - return 'Please input valid date'; - else - return null; - } - - } \ No newline at end of file diff --git a/lib/widgets/auth/login_form.dart b/lib/widgets/auth/login_form.dart index 9fc50008..122d8c49 100644 --- a/lib/widgets/auth/login_form.dart +++ b/lib/widgets/auth/login_form.dart @@ -1,23 +1,19 @@ -import 'package:doctor_app_flutter/lookups/hospital_lookup.dart'; +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/viewModel/imei_view_model.dart'; import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart'; import 'package:doctor_app_flutter/widgets/shared/app_button.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/app_text_form_field.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; -import 'package:imei_plugin/imei_plugin.dart'; import 'package:provider/provider.dart'; - import '../../config/shared_pref_kay.dart'; import '../../config/size_config.dart'; import '../../models/doctor/user_model.dart'; -import '../../core/viewModel/auth_view_model.dart'; import '../../core/viewModel/hospital_view_model.dart'; -import '../../routes.dart'; import '../../util/dr_app_shared_pref.dart'; import '../../util/dr_app_toast_msg.dart'; import '../../util/helpers.dart'; @@ -28,35 +24,22 @@ DrAppToastMsg toastMsg = DrAppToastMsg(); Helpers helpers = Helpers(); class LoginForm extends StatefulWidget with DrAppToastMsg { - LoginForm({this.changeLoadingStata}); + LoginForm({this.model}); - final Function changeLoadingStata; + final IMEIViewModel model; @override _LoginFormState createState() => _LoginFormState(); } -//TODO recreate the all page and apply the MVVM here + class _LoginFormState extends State { final loginFormKey = GlobalKey(); var projectIdController = TextEditingController(); - String _platformImei = 'Unknown'; - String uniqueId = "Unknown"; var projectsList = []; - bool _isInit = true; FocusNode focusPass = FocusNode(); FocusNode focusProject = FocusNode(); HospitalViewModel projectsProv; - var userInfo = UserModel( - userID: '', - password: '', - projectID: 15, - languageID: 2, - iPAdress: "11.11.11.11", - versionID: 1.2, - channel: 9, - sessionID: "i1UJwCTSqt"); - - AuthViewModel authProv; + var userInfo = UserModel(); @override void initState() { super.initState(); @@ -64,9 +47,7 @@ class _LoginFormState extends State { @override Widget build(BuildContext context) { - authProv = Provider.of(context); projectsProv = Provider.of(context); - return Form( key: loginFormKey, child: Column( @@ -108,10 +89,7 @@ class _LoginFormState extends State { borderColor: Colors.white, // keyboardType: TextInputType.number, textInputAction: TextInputAction.next, - // decoration: buildInputDecoration( - // context, - // TranslationBase.of(context).enterId, - // 'assets/images/user_id_icon.png'), + validator: (value) { if (value != null && value.isEmpty) { return TranslationBase.of(context) @@ -128,8 +106,6 @@ class _LoginFormState extends State { onFieldSubmitted: (_) { focusPass.nextFocus(); }, - // onEditingComplete: () {}, - // autofocus: false, ) ])), buildSizedBox(), @@ -156,10 +132,6 @@ class _LoginFormState extends State { obscureText: true, borderColor: Colors.white, textInputAction: TextInputAction.next, - // decoration: buildInputDecoration( - // context, - // TranslationBase.of(context).enterPassword, - // 'assets/images/password_icon.png'), validator: (value) { if (value != null && value.isEmpty) { return TranslationBase.of(context) @@ -172,7 +144,7 @@ class _LoginFormState extends State { }, onFieldSubmitted: (_) { focusPass.nextFocus(); - helpers.showCupertinoPicker(context, projectsList, + Helpers.showCupertinoPicker(context, projectsList, 'facilityName', onSelectProject); }, onTap: () { @@ -205,18 +177,12 @@ class _LoginFormState extends State { borderColor: Colors.white, suffixIcon: Icons.arrow_drop_down, onTap: () { - helpers.showCupertinoPicker( + Helpers.showCupertinoPicker( context, projectsList, 'facilityName', onSelectProject); }, - // showCursor: false, - // //readOnly: true, - // decoration: buildInputDecoration( - // context, - // TranslationBase.of(context).selectYourProject, - // 'assets/images/password_icon.png'), validator: (value) { if (value != null && value.isEmpty) { return TranslationBase.of(context) @@ -244,18 +210,13 @@ class _LoginFormState extends State { fontSize: 14, )), AppTextFormField( - readOnly: true, borderColor: Colors.white, + readOnly: true, + borderColor: Colors.white, prefix: IconButton( icon: Icon(Icons.arrow_drop_down), iconSize: 30, padding: EdgeInsets.only(bottom: 30), ), - - // decoration: buildInputDecoration( - // context, - // TranslationBase.of(context) - // .pleaseEnterYourProject, - // 'assets/images/password_icon.png') ) ])), ]), @@ -268,67 +229,15 @@ class _LoginFormState extends State { title: TranslationBase.of(context).login, color: HexColor('#D02127'), onTap: () { - login(context, authProv, widget.changeLoadingStata); + login(context, this.widget.model); }, )), ], ) - // Row( - // mainAxisAlignment: MainAxisAlignment.end, - // children: [ - // RaisedButton( - // onPressed: () { - // login(context, authProv, widget.changeLoadingStata); - // }, - // textColor: Colors.white, - // elevation: 0.0, - // padding: const EdgeInsets.all(0.0), - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.circular(10), - // side: BorderSide(width: 0.5, color: HexColor('#CCCCCC'))), - // child: Container( - // padding: const EdgeInsets.all(10.0), - // height: 50, - // width: SizeConfig.realScreenWidth * 0.35, - // child: ), - // ) - // ], - // ), ], ), ); - } - -/* - *@author: Elham Rababah - *@Date:20/4/2020 - *@param: context, hint, asset - *@return: InputDecoration - *@desc: decorate input feilds - */ - InputDecoration buildInputDecoration(BuildContext context, hint, asset) { - return InputDecoration( - // prefixIcon: Image.asset(asset), - hintText: hint, - hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier), - fillColor: Colors.white, - enabledBorder: OutlineInputBorder( - //borderRadius: BorderRadius.all(Radius.circular(20)), - borderSide: BorderSide(color: HexColor('#CCCCCC')), - ), - focusedBorder: OutlineInputBorder( - // borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: BorderSide(color: Theme.of(context).primaryColor), - ), - errorBorder: OutlineInputBorder( - // borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: BorderSide(color: Theme.of(context).errorColor), - ), - focusedErrorBorder: OutlineInputBorder( - // borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: BorderSide(color: Theme.of(context).errorColor), - ), - ); + //)); } SizedBox buildSizedBox() { @@ -337,103 +246,27 @@ class _LoginFormState extends State { ); } - login(context, AuthViewModel authProv, Function changeLoadingStata) { - showLoading(); + login( + context, + model, + ) { if (loginFormKey.currentState.validate()) { loginFormKey.currentState.save(); sharedPref.setInt(PROJECT_ID, userInfo.projectID); - authProv.login(userInfo).then((res) { - //changeLoadingStata(false); - hideLoading(); - if (res['MessageStatus'] == 1) { - // insertDeviceImei(res, authProv); - saveObjToString(LOGGED_IN_USER, res); + model.login(userInfo).then((res) { + if (model.loginInfo['MessageStatus'] == 1) { + saveObjToString(LOGGED_IN_USER, model.loginInfo); sharedPref.remove(LAST_LOGIN_USER); - sharedPref.setString(TOKEN, res['LogInTokenID']); - print("token" + res['LogInTokenID']); - Navigator.of(context).pushReplacement(MaterialPageRoute( - builder: (BuildContext context) => VerificationMethodsScreen( - password: userInfo.password, - ))); - } else { - // handel error - helpers.showErrorToast(res['ErrorEndUserMessage']); - } - }).catchError((err) { - //TODO change the logic here - if(!err.contains('eservices.hmg@drsulaimanalhabib.com') ){ - hideLoading(); - changeLoadingStata(false); - helpers.showErrorToast(err);} - }); - } else { - changeLoadingStata(false); - } - } - - insertDeviceImei(preRes, AuthViewModel authProv) { - if (_platformImei != 'Unknown') { - var imeiInfo = { - "IMEI": _platformImei, - "LogInType": 1, - "DoctorID": preRes['DoctorID'], - "DoctorName": "Test User", - "Gender": 1, - "ClinicID": 3, - "ProjectID": 15, - "DoctorTitle": "Mr.", - "ClinicName": "MED", - "ProjectName": "", - "DoctorImageURL": "UNKNOWN", - "LogInTokenID": preRes['LogInTokenID'], - "VersionID": 5.3 - }; - authProv.insertDeviceImei(imeiInfo).then((res) { - if (res['MessageStatus'] == 1) { - setSharedPref('platformImei', _platformImei); - saveObjToString(LOGGED_IN_USER, preRes); - - Navigator.of(context).pushReplacement(MaterialPageRoute( + sharedPref.setString(TOKEN, model.loginInfo['LogInTokenID']); + Navigator.of(AppGlobal.CONTEX).pushReplacement(MaterialPageRoute( builder: (BuildContext context) => VerificationMethodsScreen( password: userInfo.password, ))); - - // save imei on shared preferance - } else { - // handel error - helpers.showErrorToast(res['ErrorEndUserMessage']); } - }).catchError((err) { - print(err); - helpers.showErrorToast(); }); } } - // Platform messages are asynchronous, so we initialize in an async method. - Future initPlatformState() async { - String platformImei; - String idunique; - // Platform messages may fail, so we use a try/catch PlatformException. - try { - platformImei = - await ImeiPlugin.getImei(shouldShowRequestPermissionRationale: false); - idunique = await ImeiPlugin.getImei(); - } catch (e) { - platformImei = 'Failed to get platform version.'; - } - - // If the widget was removed from the tree while the asynchronous platform - // message was in flight, we want to discard the reply rather than calling - // setState to update our non-existent appearance. - if (!mounted) return; - - setState(() { - _platformImei = platformImei; - uniqueId = idunique; - }); - } - Future setSharedPref(key, value) async { sharedPref.setString(key, value).then((success) { print("sharedPref.setString" + success.toString()); @@ -441,9 +274,7 @@ class _LoginFormState extends State { } getProjectsList(memberID) { - //showLoading(); projectsProv.getProjectsList(memberID).then((res) { - //hideLoading(); if (res['MessageStatus'] == 1) { projectsList = res['ProjectInfo']; setState(() { @@ -452,16 +283,7 @@ class _LoginFormState extends State { }); } else { print(res); - // handel error - // setState(() { - // projectsList = ListProject; - // }); } - }).catchError((err) { - setState(() { - print(err); - }); - print(err); }); } @@ -478,26 +300,11 @@ class _LoginFormState extends State { primaryFocus.unfocus(); } - showLoading() { - showDialog( - context: context, - builder: (BuildContext context) { - return Center( - child: CircularProgressIndicator(), - ); - }); - } - - hideLoading() { - Navigator.pop(context); - } - getProjects(value) { if (value != null && value != '') { if (projectsList.length == 0) { getProjectsList(value); } } - //_isInit = false; } } diff --git a/lib/widgets/auth/show_timer_text.dart b/lib/widgets/auth/show_timer_text.dart index fd09ec25..a418e1b5 100644 --- a/lib/widgets/auth/show_timer_text.dart +++ b/lib/widgets/auth/show_timer_text.dart @@ -96,10 +96,10 @@ class _ShowTimerTextState extends State { if (res['MessageStatus'] == 1) {resendCode()} else - {helpers.showErrorToast(res['ErrorEndUserMessage'])} + {Helpers.showErrorToast(res['ErrorEndUserMessage'])} }) .catchError((err) { - helpers.showErrorToast(); + Helpers.showErrorToast(); }); } } diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index 587c248c..575bda08 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -239,13 +239,6 @@ class _VerifyAccountState extends State { }); } -/* - *@author: Elham Rababah - *@Date:19/4/2020 - *@param: - *@return: - *@desc: change the style for the input field - */ TextStyle buildTextStyle() { return TextStyle( fontSize: SizeConfig.textMultiplier * 3, @@ -260,16 +253,8 @@ class _VerifyAccountState extends State { return null; } -/* - *@author: Elham Rababah - *@Date:28/4/2020 - *@param: context - *@return:InputDecoration - *@desc: buildInputDecoration - */ InputDecoration buildInputDecoration(BuildContext context) { return InputDecoration( - // ts/images/password_icon.png contentPadding: EdgeInsets.only(top: 30, bottom: 30), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), @@ -290,13 +275,6 @@ class _VerifyAccountState extends State { ); } -/* - *@author: Elham Rababah - *@Date:28/4/2020 - *@param: - *@return: RichText - *@desc: buildText - */ RichText buildText() { String medthodName; switch (model['OTP_SendType']) { @@ -329,13 +307,6 @@ class _VerifyAccountState extends State { ); } -/* - *@author: Elham Rababah - *@Date:15/4/2020 - *@param: authProv - *@return: - *@desc: verify Account func call sendActivationCodeByOtpNotificationType service - */ verifyAccount(AuthViewModel authProv, Function changeLoadingStata) async { if (verifyAccountForm.currentState.validate()) { changeLoadingStata(true); @@ -346,23 +317,6 @@ class _VerifyAccountState extends State { verifyAccountFormValue['digit3'] + verifyAccountFormValue['digit4']; - int projectID = await sharedPref.getInt(PROJECT_ID); - - Map model = { - "activationCode": activationCode, - "DoctorID": _loggedUser['DoctorID'], - "LogInTokenID": _loggedUser['LogInTokenID'], - "ProjectID": projectID, - "LanguageID": 2, - "stamp": "2020-02-26T14:48:27.221Z", - "IPAdress": "11.11.11.11", - "VersionID": 1.2, - "Channel": 9, - "TokenID": "", - "SessionID": "i1UJwCTSqt", - "IsLoginForDoctorApp": true, - "IsSilentLogIN": false - }; CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = new CheckActivationCodeRequestModel( zipCode: _loggedUser['ZipCode'], @@ -387,22 +341,15 @@ class _VerifyAccountState extends State { } } else { changeLoadingStata(false); - helpers.showErrorToast(res['ErrorEndUserMessage']); + Helpers.showErrorToast(res['ErrorEndUserMessage']); } }).catchError((err) { changeLoadingStata(false); - helpers.showErrorToast(err); + Helpers.showErrorToast(err); }); } } - /* - *@author: Elham Rababah - *@Date:17/5/2020 - *@param: Map profile, Function changeLoadingStata - *@return: - *@desc: loginProcessCompleted - */ loginProcessCompleted( Map profile, Function changeLoadingStata) { var doctor = DoctorProfileModel.fromJson(profile); @@ -412,43 +359,10 @@ class _VerifyAccountState extends State { } getDashboard(doctor, Function changeLoadingStata) { - // authProv.getDashboard(doctor).then((value) { - // print(value); changeLoadingStata(false); - // sharedPref.setObj(DASHBOARD_DATA, value); Navigator.of(context).pushReplacementNamed(HOME); - // }); - } - - Future _asyncSimpleDialog( - BuildContext context, List list, String txtKey, - [String text = '']) async { - return await showDialog( - context: context, - barrierDismissible: true, - builder: (BuildContext context) { - return SimpleDialog( - title: Text(text), - children: list.map((value) { - return SimpleDialogOption( - onPressed: () { - Navigator.pop(context, - value); //here passing the index to be return on item selection - }, - child: Text(value[txtKey]), //item value - ); - }).toList(), - ); - }); } - /* - *@author: Elham Rababah - *@Date:17/5/2020 - *@param: ClinicModel clinicInfo, Function changeLoadingStata - *@return: - *@desc: getDocProfiles - */ getDocProfiles(ClinicModel clinicInfo, Function changeLoadingStata) { ProfileReqModel docInfo = new ProfileReqModel( doctorID: clinicInfo.doctorID, @@ -462,11 +376,11 @@ class _VerifyAccountState extends State { loginProcessCompleted(res['DoctorProfileList'][0], changeLoadingStata); } else { changeLoadingStata(false); - helpers.showErrorToast(res['ErrorEndUserMessage']); + Helpers.showErrorToast(res['ErrorEndUserMessage']); } }).catchError((err) { changeLoadingStata(false); - helpers.showErrorToast(err); + Helpers.showErrorToast(err); }); } } diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index b4d39894..56ad5c62 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/models/auth/send_activation_code_model2.dart' import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/otp/sms-popup.dart'; @@ -111,7 +112,7 @@ class _VerificationMethodsState extends State { return DrAppCircularProgressIndeicator(); default: if (snapshot.hasError) { - helpers.showErrorToast('Error: ${snapshot.error}'); + Helpers.showErrorToast('Error: ${snapshot.error}'); return Text('Error: ${snapshot.error}'); } else { return SingleChildScrollView( @@ -177,36 +178,19 @@ class _VerificationMethodsState extends State { user.logInTypeID, context), fontSize: 14, - ) - // Text( - // user.editedOn != null - // ? formatDate(Helpers - // .convertStringToDate( - // user.editedOn)) - // : user.createdOn != null - // ? formatDate(Helpers - // .convertStringToDate(user - // .createdOn)) - // : '--', - // overflow: - // TextOverflow.ellipsis, - // style: TextStyle( - // fontFamily: 'Poppins'), - // textAlign: - // TextAlign.center), - )), + ))), Flexible( flex: 2, child: ListTile( title: AppText( user.editedOn != null - ? getDate(Helpers + ? getDate(DateUtils .convertStringToDate( user .editedOn)) : user.createdOn != null - ? getDate(Helpers + ? getDate(DateUtils .convertStringToDate( user.createdOn)) : '--', @@ -218,13 +202,13 @@ class _VerificationMethodsState extends State { ), subtitle: AppText( user.editedOn != null - ? getTime(Helpers + ? getTime(DateUtils .convertStringToDate( user .editedOn)) : user.createdOn != null - ? getTime(Helpers + ? getTime(DateUtils .convertStringToDate( user.createdOn)) : '--', @@ -288,16 +272,6 @@ class _VerificationMethodsState extends State { Expanded( child: getButton(5, authProv)) ]), - // Row( - // mainAxisAlignment: - // MainAxisAlignment.center, - // children: [ - // Expanded( - // child: getButton(1, authProv)), - // Expanded( - // child: getButton(2, authProv)) - // ], - // ) ]) : Column( mainAxisAlignment: MainAxisAlignment.start, @@ -366,13 +340,6 @@ class _VerificationMethodsState extends State { return verificationMethod == 4 || verificationMethod == 3 ? true : false; } -/* - *@author: Elham Rababah - *@Date:15/4/2020 - *@param: oTPSendType - *@return: - *@desc: send Activation Code By Otp Notification Type - */ sendActivationCodeByOtpNotificationType( oTPSendType, AuthViewModel authProv) async { // TODO : build enum for verfication method @@ -401,19 +368,19 @@ class _VerificationMethodsState extends State { this.startSMSService(oTPSendType, authProv); } else { print(res['ErrorEndUserMessage']); - helpers.showErrorToast(res['ErrorEndUserMessage']); + Helpers.showErrorToast(res['ErrorEndUserMessage']); } }).catchError((err) { print('$err'); widget.changeLoadingStata(false); - helpers.showErrorToast(); + Helpers.showErrorToast(); }); } catch (e) {} } else { // TODO route to this page with parameters to inicate we should present 2 option if (Platform.isAndroid && oTPSendType == 3) { - helpers.showErrorToast('Your device not support this feature'); + Helpers.showErrorToast('Your device not support this feature'); } else { // Navigator.of(context).push(MaterialPageRoute( // builder: (BuildContext context) => @@ -459,13 +426,13 @@ class _VerificationMethodsState extends State { } } else { print(res['ErrorEndUserMessage']); - helpers.showErrorToast(res['ErrorEndUserMessage']); + Helpers.showErrorToast(res['ErrorEndUserMessage']); } }).catchError((err) { print('$err'); widget.changeLoadingStata(false); - helpers.showErrorToast(); + Helpers.showErrorToast(); }); } catch (e) {} // } @@ -846,11 +813,11 @@ class _VerificationMethodsState extends State { } } else { Navigator.pop(context); - helpers.showErrorToast(res['ErrorEndUserMessage']); + Helpers.showErrorToast(res['ErrorEndUserMessage']); } }).catchError((err) { Navigator.pop(context); - helpers.showErrorToast(err); + Helpers.showErrorToast(err); }); } @@ -860,7 +827,12 @@ class _VerificationMethodsState extends State { sharedPref.setObj(DOCTOR_PROFILE, profile); projectsProvider.isLogin = true; - Navigator.pushAndRemoveUntil(context, FadePage(page: LandingPage(),), (r) => false); + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: LandingPage(), + ), + (r) => false); } getDocProfiles(ClinicModel clinicInfo, authProv) { @@ -876,11 +848,11 @@ class _VerificationMethodsState extends State { loginProcessCompleted(res['DoctorProfileList'][0], authProv); } else { // changeLoadingStata(false); - helpers.showErrorToast(res['ErrorEndUserMessage']); + Helpers.showErrorToast(res['ErrorEndUserMessage']); } }).catchError((err) { // changeLoadingStata(false); - helpers.showErrorToast(err); + Helpers.showErrorToast(err); }); } diff --git a/lib/widgets/patients/dynamic_elements.dart b/lib/widgets/patients/dynamic_elements.dart index 1760c796..1d85574d 100644 --- a/lib/widgets/patients/dynamic_elements.dart +++ b/lib/widgets/patients/dynamic_elements.dart @@ -2,7 +2,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/widgets/shared/user-guid/custom_validation_error.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/app_text_form_field.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:intl/intl.dart'; diff --git a/lib/widgets/patients/vital_sign_details_wideget.dart b/lib/widgets/patients/vital_sign_details_wideget.dart index 41af8e1d..7665778a 100644 --- a/lib/widgets/patients/vital_sign_details_wideget.dart +++ b/lib/widgets/patients/vital_sign_details_wideget.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_res_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:flutter/cupertino.dart'; @@ -90,7 +91,7 @@ class _VitalSignDetailsWidgetState extends State { color: Colors.white, child: Center( child: Texts( - '${Helpers.getWeekDay(vital.vitalSignDate.weekday)}, ${vital.vitalSignDate.day} ${Helpers.getMonth(vital.vitalSignDate.month)}, ${vital.vitalSignDate.year} ', + '${DateUtils.getWeekDay(vital.vitalSignDate.weekday)}, ${vital.vitalSignDate.day} ${DateUtils.getMonth(vital.vitalSignDate.month)}, ${vital.vitalSignDate.year} ', textAlign: TextAlign.center, ), ), diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index e654c760..060f9041 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -177,7 +177,7 @@ class _AppDrawerState extends State { ), onTap: () async { Navigator.pop(context); - await helpers.logout(); + await Helpers.logout(); projectsProvider.isLogin = false; }, ), diff --git a/lib/widgets/shared/master_key_checkbox_search_allergies_widget.dart b/lib/widgets/shared/master_key_checkbox_search_allergies_widget.dart index 3e4d1186..e3581065 100644 --- a/lib/widgets/shared/master_key_checkbox_search_allergies_widget.dart +++ b/lib/widgets/shared/master_key_checkbox_search_allergies_widget.dart @@ -7,13 +7,13 @@ import 'package:doctor_app_flutter/widgets/shared/user-guid/custom_validation_er import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/new_text_Field.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/new_text_Field.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'app-textfield-custom.dart'; +import 'user-guid/text_fields/app-textfield-custom.dart'; import 'app_texts_widget.dart'; import 'dialogs/master_key_dailog.dart'; import 'divider_with_spaces_around.dart'; @@ -81,7 +81,7 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState AppTextFieldCustom( height: MediaQuery.of(context).size.height * 0.070, hintText: TranslationBase.of(context).selectAllergy, - isDropDown: true, + isTextFieldHasSuffix: true, hasBorder: false, // controller: filteredSearchController, onChanged: (value) { @@ -284,7 +284,7 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState ); } : null, - isDropDown: true, + isTextFieldHasSuffix: true, hintText: TranslationBase .of(context) diff --git a/lib/widgets/shared/master_key_checkbox_search_widget.dart b/lib/widgets/shared/master_key_checkbox_search_widget.dart index f0ef63bd..ea1fc70e 100644 --- a/lib/widgets/shared/master_key_checkbox_search_widget.dart +++ b/lib/widgets/shared/master_key_checkbox_search_widget.dart @@ -11,7 +11,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'app-textfield-custom.dart'; +import 'user-guid/text_fields/app-textfield-custom.dart'; import 'app_texts_widget.dart'; class MasterKeyCheckboxSearchWidget extends StatefulWidget { @@ -75,7 +75,7 @@ class _MasterKeyCheckboxSearchWidgetState extends State { Container( height: widget.height != 0 ? widget.height + 8 : null, decoration: widget.hasBorder - ? containerBorderDecoration( + ? TextFieldsUtils.containerBorderDecoration( Color(0Xffffffff), widget.validationError == null ? Color(0xFFEFEFEF) @@ -87,7 +89,7 @@ class _AppTextFieldCustomState extends State { widget.dropDownText == null ? TextField( textAlign: TextAlign.left, - decoration: textFieldSelectorDecoration( + decoration: TextFieldsUtils.textFieldSelectorDecoration( widget.hintText, null, true), style: TextStyle( fontSize: SizeConfig.textMultiplier * 1.7, @@ -119,7 +121,7 @@ class _AppTextFieldCustomState extends State { ), ), ), - widget.isDropDown + widget.isTextFieldHasSuffix ? widget.suffixIcon != null ? widget.suffixIcon : Icon( @@ -134,91 +136,9 @@ class _AppTextFieldCustomState extends State { ), ), if (widget.validationError != null) - Container( - margin: EdgeInsets.only(top: 8, right: 8, left: 8, bottom: 8), - child: Row( - children: [ - Icon( - DoctorApp.warning, - size: 20, - color: Colors.red.shade700, - ), - SizedBox( - width: 12, - ), - AppText( - widget.validationError, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.7, - color: Colors.red.shade700, - fontWeight: FontWeight.w700, - ), - ], - ), - ), + TextFieldsError(error: widget.validationError), ], ); } - - BoxDecoration containerBorderDecoration( - Color containerColor, Color borderColor, - {double borderWidth = -1}) { - return BoxDecoration( - color: containerColor, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all(Radius.circular(12)), - border: Border.fromBorderSide(BorderSide( - color: borderColor, - width: borderWidth == -1 ? 2.0 : borderWidth, - )), - ); - } - - static InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {Icon suffixIcon, Color dropDownColor}) { - return InputDecoration( - isDense: true, - contentPadding: EdgeInsets.symmetric(horizontal: 0, vertical: 0), - enabledBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Color(0Xffffffff)), - ), - disabledBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Color(0Xffffffff)), - ), - focusedBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Color(0Xffffffff)), - ), - border: UnderlineInputBorder( - borderSide: BorderSide(color: Color(0Xffffffff)), - ), - /*focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ),*/ - hintText: selectedText != null ? selectedText : hintText, - hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - /*suffixIcon: isDropDown - ? suffixIcon != null - ? suffixIcon - : Icon( - Icons.arrow_drop_down, - color: dropDownColor != null ? dropDownColor : Colors.black, - ) - : null,*/ - // labelText: - // labelStyle: - ); - } } + diff --git a/lib/widgets/shared/app_text_form_field.dart b/lib/widgets/shared/user-guid/text_fields/app_text_form_field.dart similarity index 100% rename from lib/widgets/shared/app_text_form_field.dart rename to lib/widgets/shared/user-guid/text_fields/app_text_form_field.dart diff --git a/lib/widgets/shared/user-guid/text_fields/auto_complete_text_field.dart b/lib/widgets/shared/user-guid/text_fields/auto_complete_text_field.dart new file mode 100644 index 00000000..b31dce48 --- /dev/null +++ b/lib/widgets/shared/user-guid/text_fields/auto_complete_text_field.dart @@ -0,0 +1,44 @@ +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; +import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/text_field_error.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/text_fields_utils.dart'; +import 'package:flutter/material.dart'; + +import '../../Text.dart'; + +class CustomAutoCompleteTextField extends StatelessWidget { + final bool isShowError; + final Widget child; + + const CustomAutoCompleteTextField({ + Key key, + this.isShowError, + this.child, + }) : super(key: key); + + + + @override + Widget build(BuildContext context) { + return Container( + child: Column( + children: [ + Container( + decoration: TextFieldsUtils.containerBorderDecoration( + Color(0Xffffffff), + isShowError ? Colors.red.shade700 : Color(0xFFEFEFEF), + ), + padding: + EdgeInsets.only(top: 0.2, bottom: 2.0, left: 8.0, right: 0.0), + child: child, + ), + if (isShowError) + TextFieldsError( + error: TranslationBase.of(context).emptyMessage, + ) + ], + ), + ); + } +} diff --git a/lib/widgets/shared/new_text_Field.dart b/lib/widgets/shared/user-guid/text_fields/new_text_Field.dart similarity index 100% rename from lib/widgets/shared/new_text_Field.dart rename to lib/widgets/shared/user-guid/text_fields/new_text_Field.dart diff --git a/lib/widgets/shared/user-guid/text_fields/text_field_error.dart b/lib/widgets/shared/user-guid/text_fields/text_field_error.dart new file mode 100644 index 00000000..6108f997 --- /dev/null +++ b/lib/widgets/shared/user-guid/text_fields/text_field_error.dart @@ -0,0 +1,41 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:flutter/material.dart'; + +import '../../app_texts_widget.dart'; + +class TextFieldsError extends StatelessWidget { + const TextFieldsError({ + Key key, + @required this.error, + }) : super(key: key); + + final String error; + + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only(top: 8, right: 8, left: 8, bottom: 8), + child: Row( + children: [ + Icon( + DoctorApp.warning, + size: 20, + color: Colors.red.shade700, + ), + SizedBox( + width: 12, + ), + AppText( + error, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.7, + color: Colors.red.shade700, + fontWeight: FontWeight.w700, + ), + ], + ), + ); + } +} diff --git a/lib/widgets/shared/user-guid/text_fields/text_fields_utils.dart b/lib/widgets/shared/user-guid/text_fields/text_fields_utils.dart new file mode 100644 index 00000000..ed0c427a --- /dev/null +++ b/lib/widgets/shared/user-guid/text_fields/text_fields_utils.dart @@ -0,0 +1,59 @@ +import 'package:flutter/material.dart'; + +class TextFieldsUtils{ + static BoxDecoration containerBorderDecoration( + Color containerColor, Color borderColor, + {double borderWidth = -1}) { + return BoxDecoration( + color: containerColor, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(12)), + border: Border.fromBorderSide(BorderSide( + color: borderColor, + width: borderWidth == -1 ? 2.0 : borderWidth, + )), + ); + } + + + + static InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {IconData suffixIcon, Color dropDownColor}) { + return InputDecoration( + isDense: true, + contentPadding: EdgeInsets.symmetric(horizontal: 0, vertical: 0), + enabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Color(0Xffffffff)), + ), + disabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Color(0Xffffffff)), + ), + focusedBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Color(0Xffffffff)), + ), + border: UnderlineInputBorder( + borderSide: BorderSide(color: Color(0Xffffffff)), + ), + /*focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ),*/ + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: Icon(suffixIcon??null, color: Colors.grey.shade600,), + + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } +} \ No newline at end of file