From 8ddd27fe8c9ba77ac23f392b79b6219d95e1ee6c Mon Sep 17 00:00:00 2001 From: Aamir CSol Date: Sun, 3 May 2026 14:33:21 +0300 Subject: [PATCH] Er refferal Fix --- .../widget/e_referral_patient_info.dart | 168 ++++++++---------- 1 file changed, 77 insertions(+), 91 deletions(-) diff --git a/lib/presentation/e_referral/widget/e_referral_patient_info.dart b/lib/presentation/e_referral/widget/e_referral_patient_info.dart index a30c0c3e..ce70b9b9 100644 --- a/lib/presentation/e_referral/widget/e_referral_patient_info.dart +++ b/lib/presentation/e_referral/widget/e_referral_patient_info.dart @@ -89,87 +89,75 @@ class PatientInformationStepState extends State { } Widget _buildSectionTitle(String title) { - return Text( - title, - style: const TextStyle(fontWeight: FontWeight.w700, fontSize: 16) - ).paddingSymmetrical(4, 0); + return Text(title, style: const TextStyle(fontWeight: FontWeight.w700, fontSize: 16)).paddingSymmetrical(4, 0); } Widget _buildIdentificationField(ReferralFormManager formManager) { - return Focus( + return TextInputWidget( + controller: _identificationController, focusNode: _identificationFocusNode, - child: TextInputWidget( - controller: _identificationController, - padding: EdgeInsets.symmetric( - vertical: ResponsiveExtension(12).h, - horizontal: ResponsiveExtension(16).h, - ), - hintText: LocaleKeys.enterIdentificationNumber.tr(context: context), - labelText: LocaleKeys.identificationNumber.tr(context: context), - errorMessage: formManager.errors.patientIdentification, - hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.patientIdentification), - onChange: (value) { - formManager.updatePatientIdentification(value ?? ''); - }, - onSubmitted: (value) { - _nameFocusNode.requestFocus(); - }, - ).paddingSymmetrical(0, 4), - ); + padding: EdgeInsets.symmetric( + vertical: ResponsiveExtension(12).h, + horizontal: ResponsiveExtension(16).h, + ), + hintText: LocaleKeys.enterIdentificationNumber.tr(context: context), + labelText: LocaleKeys.identificationNumber.tr(context: context), + errorMessage: formManager.errors.patientIdentification, + hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.patientIdentification), + onChange: (value) { + formManager.updatePatientIdentification(value ?? ''); + }, + onSubmitted: (value) { + _nameFocusNode.requestFocus(); + }, + ).paddingSymmetrical(0, 4); } Widget _buildPatientNameField(ReferralFormManager formManager) { - return Focus( + return TextInputWidget( + controller: _nameController, focusNode: _nameFocusNode, - child: TextInputWidget( - controller: _nameController, - padding: EdgeInsets.symmetric( - vertical: ResponsiveExtension(12).h, - horizontal: ResponsiveExtension(16).h, - ), - hintText: LocaleKeys.patientName.tr(context: context), - labelText: LocaleKeys.name.tr(context: context), - keyboardType: TextInputType.text, - errorMessage: formManager.errors.patientName, - hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.patientName), - onChange: (value) { - formManager.updatePatientName(value ?? ''); - }, - onSubmitted: (value) { - // Optionally move to next field or keep focus - }, - ).paddingSymmetrical(0, 4), - ); + padding: EdgeInsets.symmetric(vertical: ResponsiveExtension(12).h, horizontal: ResponsiveExtension(16).h), + hintText: LocaleKeys.patientName.tr(context: context), + labelText: LocaleKeys.name.tr(context: context), + keyboardType: TextInputType.text, + errorMessage: formManager.errors.patientName, + hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.patientName), + onChange: (value) { + formManager.updatePatientName(value ?? ''); + }, + onSubmitted: (value) { + _phoneFocusNode.requestFocus(); + }, + ).paddingSymmetrical(0, 4); } Widget _buildPatientPhoneField(ReferralFormManager formManager) { return Directionality( textDirection: ui.TextDirection.ltr, - child: Focus( + child: TextInputWidget( + labelText: LocaleKeys.phoneNumber.tr(context: context), + hintText: "5xxxxxxxx", + controller: _phoneController, focusNode: _phoneFocusNode, - child: TextInputWidget( - labelText: LocaleKeys.phoneNumber.tr(context: context), - hintText: "5xxxxxxxx", - controller: _phoneController, - padding: const EdgeInsets.all(8), - keyboardType: TextInputType.number, - fontFamily: "Poppins", - onChange: (value) { - formManager.updatePatientPhone(value ?? ''); - }, - onCountryChange: (value) { - formManager.updatePatientCountryEnum(value); - }, - prefix: '966', - isBorderAllowed: false, - isAllowLeadingIcon: true, - fontSize: 13, - isCountryDropDown: true, - leadingIcon: AppAssets.smart_phone, - errorMessage: formManager.errors.patientPhone, - hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.patientPhone) - ).paddingSymmetrical(0, 8), - ), + padding: const EdgeInsets.all(8), + keyboardType: TextInputType.number, + fontFamily: "Poppins", + onChange: (value) { + formManager.updatePatientPhone(value ?? ''); + }, + onCountryChange: (value) { + formManager.updatePatientCountryEnum(value); + }, + prefix: '966', + isBorderAllowed: false, + isAllowLeadingIcon: true, + fontSize: 13, + isCountryDropDown: true, + leadingIcon: AppAssets.smart_phone, + errorMessage: formManager.errors.patientPhone, + hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.patientPhone), + ).paddingSymmetrical(0, 8), ); } @@ -185,19 +173,17 @@ class PatientInformationStepState extends State { leadingIcon: AppAssets.globe, dropdownItems: [], errorMessage: formManager.errors.patientCity, - hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.patientCity), + hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.patientCity), ).paddingSymmetrical(0, 4).onPress(() { _showCityBottomSheet(context, formManager); }); } - String? getLocaleDescription(GetAllCitiesResponseModel? patientCity){ - return getIt.get().isArabic() ? patientCity?.descriptionN: patientCity?.description; + String? getLocaleDescription(GetAllCitiesResponseModel? patientCity) { + return getIt.get().isArabic() ? patientCity?.descriptionN : patientCity?.description; } - void _showCityBottomSheet(BuildContext context, ReferralFormManager formManager) { - showCommonBottomSheetWithoutHeight( context, title: LocaleKeys.selectCity.tr(context: context), @@ -216,25 +202,25 @@ class PatientInformationStepState extends State { return DecoratedBox( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: Colors.white, - customBorder: BorderRadius.all(Radius.circular(24.h)) , - - ), child: ListView.builder( - shrinkWrap: true, - padding: EdgeInsets.all(16.h), - physics: const BouncingScrollPhysics(), - itemBuilder: (context, index) { - final city = cities[index]; - return ListTile( - title: (getLocaleDescription(city) ?? 'Unknown').toText14(), - onTap: () { - formManager.updatePatientCity(city); - Navigator.pop(context); + customBorder: BorderRadius.all(Radius.circular(24.h)), + ), + child: ListView.builder( + shrinkWrap: true, + padding: EdgeInsets.all(16.h), + physics: const BouncingScrollPhysics(), + itemBuilder: (context, index) { + final city = cities[index]; + return ListTile( + title: (getLocaleDescription(city) ?? 'Unknown').toText14(), + onTap: () { + formManager.updatePatientCity(city); + Navigator.pop(context); + }, + ); }, - ); - }, - // separatorBuilder: (context, index) => const Divider(), - itemCount: cities.length, - )); + // separatorBuilder: (context, index) => const Divider(), + itemCount: cities.length, + )); }, ), useSafeArea: true, @@ -253,4 +239,4 @@ class PatientInformationStepState extends State { _phoneFocusNode.dispose(); super.dispose(); } -} \ No newline at end of file +}