diff --git a/lib/screens/patients/insurance_approvals_details.dart b/lib/screens/patients/insurance_approvals_details.dart index de530c3d..708c5549 100644 --- a/lib/screens/patients/insurance_approvals_details.dart +++ b/lib/screens/patients/insurance_approvals_details.dart @@ -14,6 +14,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../config/config.dart'; + class InsuranceApprovalsDetails extends StatefulWidget { PatiantInformtion patient; int indexInsurance; @@ -106,7 +108,7 @@ class _InsuranceApprovalsDetailsState extends State { "Approved" || "${model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption}" == "تمت الموافقة" - ? Color(0xff359846) + ? AppGlobal.appGreenColor : Color(0xffD02127) : Color(0xffD02127), letterSpacing: -0.4, @@ -484,7 +486,7 @@ class _InsuranceApprovalsDetailsState extends State { null ? "${model.insuranceApproval[indexInsurance].approvalStatusDescption}" == "Approved" - ? Color(0xff359846) + ? AppGlobal.appGreenColor : Color(0xffD02127) : Color(0xffD02127), ), diff --git a/lib/screens/patients/out_patient/filter_date_page.dart b/lib/screens/patients/out_patient/filter_date_page.dart index 14ae707b..d03f19ee 100644 --- a/lib/screens/patients/out_patient/filter_date_page.dart +++ b/lib/screens/patients/out_patient/filter_date_page.dart @@ -12,6 +12,8 @@ import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import '../../../config/config.dart'; + class FilterDatePage extends StatefulWidget { final OutPatientFilterType outPatientFilterType; final PatientSearchViewModel patientSearchViewModel; @@ -144,7 +146,7 @@ class _FilterDatePageState extends State { child: AppButton( title: TranslationBase.of(context).search, padding: 10, - color: Color(0xFF359846), + color: AppGlobal.appGreenColor, onPressed: () async { if (widget.patientSearchViewModel.selectedFromDate == null || diff --git a/lib/screens/patients/profile/UCAF/page-stepper-widget.dart b/lib/screens/patients/profile/UCAF/page-stepper-widget.dart index 628f6663..d43dafb2 100644 --- a/lib/screens/patients/profile/UCAF/page-stepper-widget.dart +++ b/lib/screens/patients/profile/UCAF/page-stepper-widget.dart @@ -3,6 +3,8 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; +import '../../../../config/config.dart'; + /// * /// By Mousa Zaid Mousa Abuzaid /// At 13/4/2021 @@ -102,14 +104,14 @@ class StepWidget extends StatelessWidget { ? Color(0xFFCC9B14) : status == StepStatus.Locked ? Color(0xFFE3E3E3) - : Color(0xFF359846), + : AppGlobal.appGreenColor, shape: BoxShape.circle, border: Border.all( color: status == StepStatus.InProgress ? Color(0xFFCC9B14) : status == StepStatus.Locked ? Color(0xFFE3E3E3) - : Color(0xFF359846), + : AppGlobal.appGreenColor, width: 1), ), child: Center( @@ -127,7 +129,7 @@ class StepWidget extends StatelessWidget { width: dividerWidth, height: 2, color: status == StepStatus.Completed - ? Color(0xFF359846) + ? AppGlobal.appGreenColor : Color(0xFFCCCCCC), ), ], @@ -178,7 +180,7 @@ class StepWidget extends StatelessWidget { ? Color(0xFFCC9B14) : status == StepStatus.Locked ? Color(0xFF969696) - : Color(0xFF359846), + : AppGlobal.appGreenColor, ), ) ], diff --git a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart index 9bd1da29..18452142 100644 --- a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart +++ b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart @@ -13,6 +13,8 @@ import 'package:flutter/material.dart'; import 'package:html_editor_enhanced/html_editor.dart'; import 'package:permission_handler/permission_handler.dart'; +import '../../../../config/config.dart'; + class AddVerifyMedicalReport extends StatefulWidget { final PatiantInformtion patient; final String patientType; @@ -157,7 +159,7 @@ class _AddVerifyMedicalReportState extends State { title: widget.status == MedicalReportStatus.ADD ? TranslationBase.of(context).add : TranslationBase.of(context).verify, - color: Color(0xff359846), + color: AppGlobal.appGreenColor, fontWeight: FontWeight.w700, onPressed: () async { txtOfMedicalReport = diff --git a/lib/screens/patients/profile/notes/note/update_note.dart b/lib/screens/patients/profile/notes/note/update_note.dart index 85b33f5e..4f0f9d58 100644 --- a/lib/screens/patients/profile/notes/note/update_note.dart +++ b/lib/screens/patients/profile/notes/note/update_note.dart @@ -201,7 +201,7 @@ class _UpdateNoteOrderState extends State { ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + TranslationBase.of(context).progressNote, - color: Color(0xff359846), + color: AppGlobal.appGreenColor, // disabled: progressNoteController.text.isEmpty, fontWeight: FontWeight.w700, onPressed: () async { diff --git a/lib/screens/patients/profile/operation_report/update_operation_report.dart b/lib/screens/patients/profile/operation_report/update_operation_report.dart index 12f6739c..1abefd75 100644 --- a/lib/screens/patients/profile/operation_report/update_operation_report.dart +++ b/lib/screens/patients/profile/operation_report/update_operation_report.dart @@ -20,6 +20,8 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; +import '../../../../config/config.dart'; + class UpdateOperationReport extends StatefulWidget { final GetReservationsResponseModel reservation; @@ -532,7 +534,7 @@ class _UpdateOperationReportState extends State { : TranslationBase.of(context).noteAdd) + " " + TranslationBase.of(context).operationReports, - color: Color(0xff359846), + color: AppGlobal.appGreenColor, // disabled: operationReportsController.text.isEmpty, fontWeight: FontWeight.w700, onPressed: () async { diff --git a/lib/screens/patients/profile/pharmacy-intervention/pharmacy_intervention_screen.dart b/lib/screens/patients/profile/pharmacy-intervention/pharmacy_intervention_screen.dart index 96ae8052..09136556 100644 --- a/lib/screens/patients/profile/pharmacy-intervention/pharmacy_intervention_screen.dart +++ b/lib/screens/patients/profile/pharmacy-intervention/pharmacy_intervention_screen.dart @@ -8,6 +8,7 @@ import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dar import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import '../../../../config/config.dart'; import '../../../../core/viewModel/profile/intervention_medication_view_model.dart'; import '../../../../models/patient/patiant_info_model.dart'; import '../../../base/base_view.dart'; @@ -163,7 +164,7 @@ class _PharmacyInterventionScreenState child: AppButton( title: TranslationBase.of(context).search, padding: 5, - color: Color(0xFF359846), + color: AppGlobal.appGreenColor, onPressed: () async { Navigator.push( context, diff --git a/lib/screens/patients/profile/referral/refer-patient-screen-in-patient.dart b/lib/screens/patients/profile/referral/refer-patient-screen-in-patient.dart index 500378f9..12c27fe5 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen-in-patient.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen-in-patient.dart @@ -515,7 +515,7 @@ class _PatientMakeInPatientReferralScreenState child: AppButton( title: TranslationBase.of(context).refer, fontWeight: FontWeight.w700, - color: Color(0XFF359846), + color: AppGlobal.appGreenColor, onPressed: () async { setState(() { if (_referTo == null) { diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart index 92275fb4..440e1e3e 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart @@ -3,6 +3,8 @@ import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dar import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import '../../../../../config/config.dart'; + class BottomSheetDialogButton extends StatelessWidget { final Function onTap; final String label; @@ -33,7 +35,7 @@ class BottomSheetDialogButton extends StatelessWidget { child: Center( child: AppButton( title: label, - color: Color(0xFF359846), + color: AppGlobal.appGreenColor, onPressed: onTap, ), ), diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/status_Label.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/status_Label.dart index d43168e3..95b3d061 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/status_Label.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/status_Label.dart @@ -4,6 +4,8 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import '../../../../../../config/config.dart'; + class StatusLabel extends StatelessWidget { const StatusLabel({ Key key, @@ -43,7 +45,7 @@ class StatusLabel extends StatelessWidget { color: stepId == selectedStepId ? Color(0xFFCC9B14) : stepId < selectedStepId - ? Color(0xFF359846) + ? AppGlobal.appGreenColor : Color(0xFF969696), ), ), diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/steps_widget.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/steps_widget.dart index bd31e4ce..38c3f481 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/steps_widget.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/steps_widget.dart @@ -7,6 +7,7 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; +import '../../../../../../config/config.dart'; import 'Step_details_widget.dart'; class StepsWidget extends StatelessWidget { @@ -85,7 +86,7 @@ class StepsWidget extends StatelessWidget { color: index == 0 ? Color(0xFFCC9B14) : index > 0 - ? Color(0xFF359846) + ? AppGlobal.appGreenColor : Color(0xFFCCCCCC), ), child: Center( @@ -137,7 +138,7 @@ class StepsWidget extends StatelessWidget { color: index == 1 ? Color(0xFFCC9B14) : index > 1 - ? Color(0xFF359846) + ? AppGlobal.appGreenColor : Color(0xFFCCCCCC), ), child: Center( @@ -192,7 +193,7 @@ class StepsWidget extends StatelessWidget { color: index == 2 ? Color(0xFFCC9B14) : index > 2 - ? Color(0xFF359846) + ? AppGlobal.appGreenColor : Color(0xFFCCCCCC), ), child: Center( @@ -245,7 +246,7 @@ class StepsWidget extends StatelessWidget { color: index == 3 ? Color(0xFFCC9B14) : index > 3 - ? Color(0xFF359846) + ? AppGlobal.appGreenColor : Color(0xFFCCCCCC), ), child: Center( @@ -323,7 +324,7 @@ class StepsWidget extends StatelessWidget { color: index == 0 ? Color(0xFFCC9B14) : index > 0 - ? Color(0xFF359846) + ? AppGlobal.appGreenColor : Color(0xFFCCCCCC), ), child: Center( @@ -375,7 +376,7 @@ class StepsWidget extends StatelessWidget { color: index == 1 ? Color(0xFFCC9B14) : index > 1 - ? Color(0xFF359846) + ? AppGlobal.appGreenColor : Color(0xFFCCCCCC), ), child: Center( diff --git a/lib/screens/patients/register_patient/RegisterPatientPage.dart b/lib/screens/patients/register_patient/RegisterPatientPage.dart index 59747e37..671511b9 100644 --- a/lib/screens/patients/register_patient/RegisterPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterPatientPage.dart @@ -158,8 +158,8 @@ class _RegisterPatientPageState extends State hasBorder: true, vPadding: 12, hPadding: 8, - borderColor: Color(0xFF359846), - color: Color(0xFF359846), + borderColor: AppGlobal.appGreenColor, + color: AppGlobal.appGreenColor, fontColor: Colors.white, onPressed: () {}, ), diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index f79f9ba3..d10124f9 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -118,6 +118,7 @@ class _PrescriptionFormWidgetState extends State { int selectedType; TextEditingController strengthController = TextEditingController(); + TextEditingController unitController = TextEditingController(); TextEditingController indicationController = TextEditingController(); TextEditingController instructionController = TextEditingController(); @@ -476,6 +477,40 @@ class _PrescriptionFormWidgetState extends State { SizedBox( width: 5.0, ), + // Container( + // width: MediaQuery.of(context) + // .size + // .width * + // 0.35, + // child: AppTextFieldCustom( + // height: 38, + // validationError: + // unitError, + // hintText: 'Unit', + // isTextFieldHasSuffix: false, + // enabled: true, + // controller: + // unitController, + // onChanged: (selectedValue) { + // setState(() { + // units = selectedValue; + // units['isDefault'] = true; + // }); + // if (strengthChar >= 5) { + // DrAppToastMsg + // .showErrorToast( + // TranslationBase.of( + // context) + // .only5DigitsAllowedForStrength, + // ); + // } + // }, + // inputType: TextInputType + // .numberWithOptions( + // decimal: true, + // ), + // ), + // ), PrescriptionTextFiled( width: MediaQuery.of(context) .size @@ -484,7 +519,7 @@ class _PrescriptionFormWidgetState extends State { element: model .itemMedicineListUnit .length == - 1 + 1 ? model .itemMedicineListUnit[0] : units, diff --git a/lib/screens/prescription/prescription_checkout_screen.dart b/lib/screens/prescription/prescription_checkout_screen.dart index f94c3b52..997a7554 100644 --- a/lib/screens/prescription/prescription_checkout_screen.dart +++ b/lib/screens/prescription/prescription_checkout_screen.dart @@ -638,7 +638,7 @@ class _PrescriptionCheckOutScreenState alignment: WrapAlignment.center, children: [ AppButton( - color: Color(0xff359846), + color: AppGlobal.appGreenColor, title: TranslationBase.of(context) .addMedication, fontWeight: FontWeight.w600, diff --git a/lib/screens/procedures/add-favourite-procedure.dart b/lib/screens/procedures/add-favourite-procedure.dart index 0a2a943e..2a218ff0 100644 --- a/lib/screens/procedures/add-favourite-procedure.dart +++ b/lib/screens/procedures/add-favourite-procedure.dart @@ -16,6 +16,7 @@ import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import '../../config/config.dart'; import 'ProcedureType.dart'; class AddFavouriteProcedure extends StatefulWidget { @@ -100,7 +101,7 @@ class _AddFavouriteProcedureState extends State { AppButton( title: widget.procedureType.getAddButtonTitle(context) ?? TranslationBase.of(context).addSelectedProcedures, - color: Color(0xff359846), + color: AppGlobal.appGreenColor, disabled: model.templateList.length == 0 ? true : false, fontWeight: FontWeight.w700, onPressed: () { diff --git a/lib/screens/procedures/add-procedure-page.dart b/lib/screens/procedures/add-procedure-page.dart index e0b7374f..df4c3c37 100644 --- a/lib/screens/procedures/add-procedure-page.dart +++ b/lib/screens/procedures/add-procedure-page.dart @@ -12,6 +12,7 @@ import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; +import '../../config/config.dart'; import 'ProcedureType.dart'; import 'entity_list_checkbox_search_widget.dart'; @@ -183,7 +184,7 @@ class _AddProcedurePageState extends State { AppButton( title: procedureType.getAddButtonTitle(context), fontWeight: FontWeight.w700, - color: Color(0xff359846), + color: AppGlobal.appGreenColor, onPressed: () async { if (entityList.isEmpty == true) { DrAppToastMsg.showErrorToast( diff --git a/lib/screens/procedures/procedure_checkout_screen.dart b/lib/screens/procedures/procedure_checkout_screen.dart index 7c8b1074..9ce5b898 100644 --- a/lib/screens/procedures/procedure_checkout_screen.dart +++ b/lib/screens/procedures/procedure_checkout_screen.dart @@ -14,6 +14,8 @@ import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dar import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import '../../config/config.dart'; + class ProcedureCheckOutScreen extends StatefulWidget { final List items; final ProcedureViewModel model; @@ -214,7 +216,7 @@ class _ProcedureCheckOutScreenState extends State { AppButton( title: widget.addButtonTitle ?? TranslationBase.of(context).addSelectedProcedures, - color: Color(0xff359846), + color: AppGlobal.appGreenColor, fontWeight: FontWeight.w700, onPressed: () async { List entityList = List(); diff --git a/lib/screens/procedures/update-procedure.dart b/lib/screens/procedures/update-procedure.dart index a1f3615e..0bf6a872 100644 --- a/lib/screens/procedures/update-procedure.dart +++ b/lib/screens/procedures/update-procedure.dart @@ -297,7 +297,7 @@ class _UpdateProcedureWidgetState extends State { //alignment: WrapAlignment.center, children: [ AppButton( - color: Color(0xff359846), + color: AppGlobal.appGreenColor, title: TranslationBase.of(context) .updateProcedure .toUpperCase(), diff --git a/lib/widgets/patients/dynamic_elements.dart b/lib/widgets/patients/dynamic_elements.dart deleted file mode 100644 index bca60f5b..00000000 --- a/lib/widgets/patients/dynamic_elements.dart +++ /dev/null @@ -1,166 +0,0 @@ -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/models/patient/patient_model.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart'; -import 'package:doctor_app_flutter/widgets/shared/user-guid/custom_validation_error.dart'; -import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:intl/intl.dart'; - -class DynamicElements extends StatefulWidget { - final PatientModel _patientSearchFormValues; - final bool isFormSubmitted; - - DynamicElements(this._patientSearchFormValues, this.isFormSubmitted); - - @override - _DynamicElementsState createState() => _DynamicElementsState(); -} - -class _DynamicElementsState extends State { - TextEditingController _toDateController = new TextEditingController(); - TextEditingController _fromDateController = new TextEditingController(); - - void _presentDatePicker(id) { - showDatePicker( - context: context, - initialDate: DateTime.now(), - firstDate: DateTime(2019), - lastDate: DateTime.now(), - ).then((pickedDate) { - if (pickedDate == null) { - return; - } - setState(() { - print(id); - var selectedDate = DateFormat.yMd().format(pickedDate); - - if (id == '_selectedFromDate') { - // _fromDateController.text = selectedDate; - selectedDate = pickedDate.year.toString() + - "-" + - pickedDate.month.toString().padLeft(2, '0') + - "-" + - pickedDate.day.toString().padLeft(2, '0'); - - _fromDateController.text = selectedDate; - } else { - selectedDate = pickedDate.year.toString() + - "-" + - pickedDate.month.toString().padLeft(2, '0') + - "-" + - pickedDate.day.toString().padLeft(2, '0'); - - _toDateController.text = selectedDate; - // _toDateController.text = selectedDate; - } - }); - }); - } - - @override - Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - InputDecoration textFieldSelectorDecoration( - {String hintText, - String selectedText, - bool isDropDown, - IconData icon}) { - return InputDecoration( - 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: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null, - hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - ); - } - - return LayoutBuilder( - builder: (ctx, constraints) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 10, - ), - SizedBox( - height: 10, - ), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(10), - child: AppTextFormField( - borderColor: Colors.white, - onTap: () => _presentDatePicker('_selectedFromDate'), - hintText: TranslationBase.of(context).fromDate, - controller: _fromDateController, - inputFormatter: ONLY_DATE, - onSaved: (value) { - if (_fromDateController.text.toString().trim().isEmpty) { - widget._patientSearchFormValues.From = "0"; - } else { - widget._patientSearchFormValues.From = - _fromDateController.text.replaceAll("/", "-"); - } - }, - readOnly: true, - )), - SizedBox( - height: 5, - ), - if (widget._patientSearchFormValues.From == "0" && - widget.isFormSubmitted) - CustomValidationError(), - SizedBox( - height: 10, - ), - Container( - decoration: BoxDecoration( - border: Border.all(width: 1.0, color: HexColor("#CCCCCC")), - borderRadius: BorderRadius.all(Radius.circular(6.0))), - padding: EdgeInsets.all(10), - child: AppTextFormField( - readOnly: true, - borderColor: Colors.white, - hintText: TranslationBase.of(context).toDate, - controller: _toDateController, - onTap: () { - _presentDatePicker('_selectedToDate'); - }, - inputFormatter: ONLY_DATE, - onSaved: (value) { - if (_toDateController.text.toString().trim().isEmpty) { - widget._patientSearchFormValues.To = "0"; - } else { - widget._patientSearchFormValues.To = - _toDateController.text.replaceAll("/", "-"); - } - }, - )), - if (widget._patientSearchFormValues.To == "0" && - widget.isFormSubmitted) - CustomValidationError(), - SizedBox( - height: 10, - ), - ], - ); - }, - ); - } -} diff --git a/lib/widgets/shared/doctor_card_insurance.dart b/lib/widgets/shared/doctor_card_insurance.dart index abb8efcc..dbcd8556 100644 --- a/lib/widgets/shared/doctor_card_insurance.dart +++ b/lib/widgets/shared/doctor_card_insurance.dart @@ -9,6 +9,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../config/config.dart'; + class DoctorCardInsurance extends StatelessWidget { final String doctorName; final String approvalNo; @@ -63,7 +65,7 @@ class DoctorCardInsurance extends StatelessWidget { ), color: approvalStatus == "Approved" || approvalStatus == "تمت الموافقة" - ? Color(0xff359846) + ? AppGlobal.appGreenColor : Color(0xffD02127), ), ), @@ -84,7 +86,7 @@ class DoctorCardInsurance extends StatelessWidget { "$approvalStatus", color: approvalStatus == "Approved" || approvalStatus == "تمت الموافقة" - ? Color(0xff359846) + ? AppGlobal.appGreenColor : Color(0xffD02127), letterSpacing: -0.4, fontSize: diff --git a/lib/widgets/shared/text_fields/new_text_Field.dart b/lib/widgets/shared/text_fields/new_text_Field.dart deleted file mode 100644 index 77cd0262..00000000 --- a/lib/widgets/shared/text_fields/new_text_Field.dart +++ /dev/null @@ -1,237 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:hexcolor/hexcolor.dart'; - -class NumberTextInputFormatter extends TextInputFormatter { - @override - TextEditingValue formatEditUpdate( - TextEditingValue oldValue, TextEditingValue newValue) { - final int newTextLength = newValue.text.length; - int selectionIndex = newValue.selection.end; - int usedSubstringIndex = 0; - final StringBuffer newText = StringBuffer(); - if (newTextLength >= 1) { - newText.write('('); - if (newValue.selection.end >= 1) selectionIndex++; - } - if (newTextLength >= 4) { - newText.write(newValue.text.substring(0, usedSubstringIndex = 3) + ') '); - if (newValue.selection.end >= 3) selectionIndex += 2; - } - if (newTextLength >= 7) { - newText.write(newValue.text.substring(3, usedSubstringIndex = 6) + '-'); - if (newValue.selection.end >= 6) selectionIndex++; - } - if (newTextLength >= 11) { - newText.write(newValue.text.substring(6, usedSubstringIndex = 10) + ' '); - if (newValue.selection.end >= 10) selectionIndex++; - } - // Dump the rest. - if (newTextLength >= usedSubstringIndex) - newText.write(newValue.text.substring(usedSubstringIndex)); - return TextEditingValue( - text: newText.toString(), - selection: TextSelection.collapsed(offset: selectionIndex), - ); - } -} - -final _mobileFormatter = NumberTextInputFormatter(); - -class NewTextFields extends StatefulWidget { - NewTextFields( - {Key key, - this.type, - this.hintText, - this.suffixIcon, - this.autoFocus, - this.onChanged, - this.initialValue, - this.minLines, - this.maxLines, - this.inputFormatters, - this.padding, - this.focus = false, - this.maxLengthEnforced = true, - this.suffixIconColor, - this.inputAction, - this.onSubmit, - this.keepPadding = true, - this.textCapitalization = TextCapitalization.none, - this.controller, - this.keyboardType, - this.validator, - this.borderOnlyError = false, - this.onSaved, - this.onSuffixTap, - this.readOnly: false, - this.maxLength, - this.prefixIcon, - this.bare = false, - this.onTap, - this.fontSize = 15.0, - this.fontWeight = FontWeight.w500, - this.autoValidate = false, - this.hintColor, - this.isEnabled = true}) - : super(key: key); - - final String hintText; - - // final String initialValue; - final String type; - final bool autoFocus; - final IconData suffixIcon; - final Color suffixIconColor; - final Icon prefixIcon; - final VoidCallback onTap; - final TextEditingController controller; - final TextInputType keyboardType; - final FormFieldValidator validator; - final Function onSaved; - final Function onSuffixTap; - final Function onChanged; - final Function onSubmit; - final bool readOnly; - final int maxLength; - final int minLines; - final int maxLines; - final bool maxLengthEnforced; - final bool bare; - final bool isEnabled; - final TextInputAction inputAction; - final double fontSize; - final FontWeight fontWeight; - final bool keepPadding; - final TextCapitalization textCapitalization; - final List inputFormatters; - final bool autoValidate; - final EdgeInsets padding; - final bool focus; - final bool borderOnlyError; - final Color hintColor; - final String initialValue; - - @override - _NewTextFieldsState createState() => _NewTextFieldsState(); -} - -class _NewTextFieldsState extends State { - final FocusNode _focusNode = FocusNode(); - bool focus = false; - bool view = false; - - @override - void initState() { - super.initState(); - _focusNode.addListener(() { - setState(() { - focus = _focusNode.hasFocus; - }); - }); - } - - @override - void didUpdateWidget(NewTextFields oldWidget) { - if (widget.focus) _focusNode.requestFocus(); - super.didUpdateWidget(oldWidget); - } - - @override - void dispose() { - _focusNode.dispose(); - super.dispose(); - } - - bool _determineReadOnly() { - if (widget.readOnly != null && widget.readOnly) { - _focusNode.unfocus(); - return true; - } else { - return false; - } - } - - @override - Widget build(BuildContext context) { - return AnimatedContainer( - duration: Duration(milliseconds: 300), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - border: Border.all(color: HexColor('#707070'), width: 0.30), - color: Colors.white), - child: Container( - margin: EdgeInsets.only(top: 8), - padding: EdgeInsets.only(top: 8), - child: TextFormField( - enabled: widget.isEnabled, - initialValue: widget.initialValue, - keyboardAppearance: Theme.of(context).brightness, - scrollPhysics: BouncingScrollPhysics(), - // autovalidate: widget.autoValidate, - textCapitalization: widget.textCapitalization, - onFieldSubmitted: widget.inputAction == TextInputAction.next - ? (widget.onSubmit != null - ? widget.onSubmit - : (val) { - _focusNode.nextFocus(); - }) - : widget.onSubmit, - textInputAction: widget.inputAction, - minLines: widget.minLines ?? 1, - maxLines: widget.maxLines ?? 1, - maxLengthEnforced: widget.maxLengthEnforced, - onChanged: widget.onChanged, - focusNode: _focusNode, - maxLength: widget.maxLength ?? null, - controller: widget.controller, - keyboardType: widget.keyboardType, - readOnly: _determineReadOnly(), - obscureText: widget.type == "password" && !view ? true : false, - autofocus: widget.autoFocus ?? false, - validator: widget.validator, - onSaved: widget.onSaved, - style: Theme.of(context).textTheme.bodyText1.copyWith( - fontSize: widget.fontSize, - fontWeight: widget.fontWeight, - color: Color(0xFF575757), - fontFamily: 'Poppins'), - inputFormatters: widget.keyboardType == TextInputType.phone - ? [ - // WhitelistingTextInputFormatter.digitsOnly, - _mobileFormatter, - ] - : widget.inputFormatters, - decoration: InputDecoration( - labelText: widget.hintText, - labelStyle: TextStyle( - color: Color(0xFF2E303A), - fontSize: 15, - fontWeight: FontWeight.w700), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Theme.of(context).errorColor.withOpacity(0.5), - width: 1.0), - borderRadius: BorderRadius.circular(12.0)), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Theme.of(context).errorColor.withOpacity(0.5), - width: 1.0), - borderRadius: BorderRadius.circular(8.0)), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.white, width: 1.0), - borderRadius: BorderRadius.circular(12)), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.white, width: 1.0), - borderRadius: BorderRadius.circular(12)), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.white, width: 1.0), - borderRadius: BorderRadius.circular(12), - ), - ), - ), - ), - ); - } -}