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 b395a623..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 @@ -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 d0dfff21..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 @@ -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 99dad8fe..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 @@ -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/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index 391d40ca..3297a405 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.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 9b1a1db6..59d03ed9 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 @@ -19,7 +19,9 @@ 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'; @@ -146,10 +148,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, ), @@ -171,64 +173,45 @@ class _AddAssessmentDetailsState extends State { child: widget .mySelectedAssessment.selectedICD == null - ? Container( - child: Column( - children: [ - AutoCompleteTextField( + ? CustomAutoCompleteTextField( + isShowError: isFormSubmitted && + widget.mySelectedAssessment.selectedICD == null, + child:AutoCompleteTextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context) - .nameOrICD, + decoration: TextFieldsUtils.textFieldSelectorDecoration( + TranslationBase.of(context) + .nameOrICD, null, true, suffixIcon: Icons.search), + + itemSubmitted: (item) => setState(() { widget.mySelectedAssessment - .selectedICD != - null - ? widget.mySelectedAssessment - .selectedICD.nameEn - : null, - true, - icon: Icons.search, - validationError: isFormSubmitted && - widget.mySelectedAssessment.selectedICD == null?TranslationBase - .of(context) - .emptyMessage:null + .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()), ), - - 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()), - ), - if (isFormSubmitted && - widget.mySelectedAssessment.selectedICD == null) - TextFieldsError(error:TranslationBase - .of(context) - .emptyMessage ,) - ], - ),) + ) : AppTextFieldCustom( onClick: model.listOfICD10 != null ? () { @@ -245,6 +228,8 @@ class _AddAssessmentDetailsState extends State { minLines: 1, controller: icdNameController, enabled: true, + isTextFieldHasSuffix: true, + suffixIcon: Icon(Icons.search,color: Colors.grey.shade600,), ) ), ), @@ -252,7 +237,6 @@ class _AddAssessmentDetailsState extends State { height: 7, ), AppTextFieldCustom( - height: 55.0, onClick: model.listOfDiagnosisCondition != null ? () { MasterKeyDailog dialog = MasterKeyDailog( @@ -291,7 +275,7 @@ class _AddAssessmentDetailsState extends State { maxLines: 2, minLines: 1, controller: conditionController, - isDropDown: true, + isTextFieldHasSuffix: true, enabled: false, hasBorder: true, validationError: isFormSubmitted && @@ -305,7 +289,6 @@ class _AddAssessmentDetailsState extends State { height: 10, ), AppTextFieldCustom( - height: 55.0, onClick: model.listOfDiagnosisType != null ? () { MasterKeyDailog dialog = MasterKeyDailog( @@ -337,7 +320,7 @@ class _AddAssessmentDetailsState extends State { maxLines: 2, minLines: 1, enabled: false, - isDropDown: true, + isTextFieldHasSuffix: true, controller: typeController, hasBorder: true, validationError: isFormSubmitted && 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 7d20d4ff..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 @@ -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/subjective/medication/add_medication.dart b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart index 062e8b84..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/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/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( + ? + + + CustomAutoCompleteTextField( + isShowError: isFormSubmitted && + _selectedMedication ==null, + child: AutoCompleteTextField< + GetMedicationResponseModel>( + + decoration: + TextFieldsUtils.textFieldSelectorDecoration( + TranslationBase.of(context) + .searchMedicineNameHere, null, true, suffixIcon: Icons.search), - 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()), + 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) - Container(child: CustomValidationError()), SizedBox( height: 5, ), @@ -246,7 +220,7 @@ class _AddMedicationState extends State { TranslationBase.of(context).doseTime, maxLines: 2, minLines: 2, - isDropDown: true, + isTextFieldHasSuffix: true, controller: doseController, validationError:isFormSubmitted && _selectedMedicationDose == null?TranslationBase @@ -258,7 +232,7 @@ class _AddMedicationState extends State { ), AppTextFieldCustom( enabled: false, - isDropDown: true, + isTextFieldHasSuffix: true, onClick: model.medicationStrengthList != null ? () { MasterKeyDailog dialog = @@ -308,7 +282,7 @@ class _AddMedicationState extends State { ), AppTextFieldCustom( enabled: false, - isDropDown: true, + isTextFieldHasSuffix: true, onClick: model.medicationRouteList != null ? () { MasterKeyDailog dialog = @@ -392,7 +366,7 @@ class _AddMedicationState extends State { enabled: false, maxLines: 2, minLines: 2, - isDropDown: true, + isTextFieldHasSuffix: true, controller: frequencyController, validationError:isFormSubmitted && _selectedMedicationFrequency == null?TranslationBase 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 c9282245..e3581065 100644 --- a/lib/widgets/shared/master_key_checkbox_search_allergies_widget.dart +++ b/lib/widgets/shared/master_key_checkbox_search_allergies_widget.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 6e436625..ea1fc70e 100644 --- a/lib/widgets/shared/master_key_checkbox_search_widget.dart +++ b/lib/widgets/shared/master_key_checkbox_search_widget.dart @@ -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) @@ -88,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, @@ -120,7 +121,7 @@ class _AppTextFieldCustomState extends State { ), ), ), - widget.isDropDown + widget.isTextFieldHasSuffix ? widget.suffixIcon != null ? widget.suffixIcon : Icon( @@ -139,57 +140,5 @@ class _AppTextFieldCustomState extends State { ], ); } - - 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, - ), - ); - } } 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 index e69de29b..b31dce48 100644 --- 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 @@ -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/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