Er refferal Fix #310

Merged
Haroon6138 merged 1 commits from dev_aamir into master 1 day ago

@ -89,87 +89,75 @@ class PatientInformationStepState extends State<PatientInformationStep> {
} }
Widget _buildSectionTitle(String title) { Widget _buildSectionTitle(String title) {
return Text( return Text(title, style: const TextStyle(fontWeight: FontWeight.w700, fontSize: 16)).paddingSymmetrical(4, 0);
title,
style: const TextStyle(fontWeight: FontWeight.w700, fontSize: 16)
).paddingSymmetrical(4, 0);
} }
Widget _buildIdentificationField(ReferralFormManager formManager) { Widget _buildIdentificationField(ReferralFormManager formManager) {
return Focus( return TextInputWidget(
controller: _identificationController,
focusNode: _identificationFocusNode, focusNode: _identificationFocusNode,
child: TextInputWidget( padding: EdgeInsets.symmetric(
controller: _identificationController, vertical: ResponsiveExtension(12).h,
padding: EdgeInsets.symmetric( horizontal: ResponsiveExtension(16).h,
vertical: ResponsiveExtension(12).h, ),
horizontal: ResponsiveExtension(16).h, hintText: LocaleKeys.enterIdentificationNumber.tr(context: context),
), labelText: LocaleKeys.identificationNumber.tr(context: context),
hintText: LocaleKeys.enterIdentificationNumber.tr(context: context), errorMessage: formManager.errors.patientIdentification,
labelText: LocaleKeys.identificationNumber.tr(context: context), hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.patientIdentification),
errorMessage: formManager.errors.patientIdentification, onChange: (value) {
hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.patientIdentification), formManager.updatePatientIdentification(value ?? '');
onChange: (value) { },
formManager.updatePatientIdentification(value ?? ''); onSubmitted: (value) {
}, _nameFocusNode.requestFocus();
onSubmitted: (value) { },
_nameFocusNode.requestFocus(); ).paddingSymmetrical(0, 4);
},
).paddingSymmetrical(0, 4),
);
} }
Widget _buildPatientNameField(ReferralFormManager formManager) { Widget _buildPatientNameField(ReferralFormManager formManager) {
return Focus( return TextInputWidget(
controller: _nameController,
focusNode: _nameFocusNode, focusNode: _nameFocusNode,
child: TextInputWidget( padding: EdgeInsets.symmetric(vertical: ResponsiveExtension(12).h, horizontal: ResponsiveExtension(16).h),
controller: _nameController, hintText: LocaleKeys.patientName.tr(context: context),
padding: EdgeInsets.symmetric( labelText: LocaleKeys.name.tr(context: context),
vertical: ResponsiveExtension(12).h, keyboardType: TextInputType.text,
horizontal: ResponsiveExtension(16).h, errorMessage: formManager.errors.patientName,
), hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.patientName),
hintText: LocaleKeys.patientName.tr(context: context), onChange: (value) {
labelText: LocaleKeys.name.tr(context: context), formManager.updatePatientName(value ?? '');
keyboardType: TextInputType.text, },
errorMessage: formManager.errors.patientName, onSubmitted: (value) {
hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.patientName), _phoneFocusNode.requestFocus();
onChange: (value) { },
formManager.updatePatientName(value ?? ''); ).paddingSymmetrical(0, 4);
},
onSubmitted: (value) {
// Optionally move to next field or keep focus
},
).paddingSymmetrical(0, 4),
);
} }
Widget _buildPatientPhoneField(ReferralFormManager formManager) { Widget _buildPatientPhoneField(ReferralFormManager formManager) {
return Directionality( return Directionality(
textDirection: ui.TextDirection.ltr, textDirection: ui.TextDirection.ltr,
child: Focus( child: TextInputWidget(
labelText: LocaleKeys.phoneNumber.tr(context: context),
hintText: "5xxxxxxxx",
controller: _phoneController,
focusNode: _phoneFocusNode, focusNode: _phoneFocusNode,
child: TextInputWidget( padding: const EdgeInsets.all(8),
labelText: LocaleKeys.phoneNumber.tr(context: context), keyboardType: TextInputType.number,
hintText: "5xxxxxxxx", fontFamily: "Poppins",
controller: _phoneController, onChange: (value) {
padding: const EdgeInsets.all(8), formManager.updatePatientPhone(value ?? '');
keyboardType: TextInputType.number, },
fontFamily: "Poppins", onCountryChange: (value) {
onChange: (value) { formManager.updatePatientCountryEnum(value);
formManager.updatePatientPhone(value ?? ''); },
}, prefix: '966',
onCountryChange: (value) { isBorderAllowed: false,
formManager.updatePatientCountryEnum(value); isAllowLeadingIcon: true,
}, fontSize: 13,
prefix: '966', isCountryDropDown: true,
isBorderAllowed: false, leadingIcon: AppAssets.smart_phone,
isAllowLeadingIcon: true, errorMessage: formManager.errors.patientPhone,
fontSize: 13, hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.patientPhone),
isCountryDropDown: true, ).paddingSymmetrical(0, 8),
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<PatientInformationStep> {
leadingIcon: AppAssets.globe, leadingIcon: AppAssets.globe,
dropdownItems: [], dropdownItems: [],
errorMessage: formManager.errors.patientCity, errorMessage: formManager.errors.patientCity,
hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.patientCity), hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.patientCity),
).paddingSymmetrical(0, 4).onPress(() { ).paddingSymmetrical(0, 4).onPress(() {
_showCityBottomSheet(context, formManager); _showCityBottomSheet(context, formManager);
}); });
} }
String? getLocaleDescription(GetAllCitiesResponseModel? patientCity){ String? getLocaleDescription(GetAllCitiesResponseModel? patientCity) {
return getIt.get<AppState>().isArabic() ? patientCity?.descriptionN: patientCity?.description; return getIt.get<AppState>().isArabic() ? patientCity?.descriptionN : patientCity?.description;
} }
void _showCityBottomSheet(BuildContext context, ReferralFormManager formManager) { void _showCityBottomSheet(BuildContext context, ReferralFormManager formManager) {
showCommonBottomSheetWithoutHeight( showCommonBottomSheetWithoutHeight(
context, context,
title: LocaleKeys.selectCity.tr(context: context), title: LocaleKeys.selectCity.tr(context: context),
@ -216,25 +202,25 @@ class PatientInformationStepState extends State<PatientInformationStep> {
return DecoratedBox( return DecoratedBox(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: Colors.white, color: Colors.white,
customBorder: BorderRadius.all(Radius.circular(24.h)) , customBorder: BorderRadius.all(Radius.circular(24.h)),
),
), child: ListView.builder( child: ListView.builder(
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.all(16.h), padding: EdgeInsets.all(16.h),
physics: const BouncingScrollPhysics(), physics: const BouncingScrollPhysics(),
itemBuilder: (context, index) { itemBuilder: (context, index) {
final city = cities[index]; final city = cities[index];
return ListTile( return ListTile(
title: (getLocaleDescription(city) ?? 'Unknown').toText14(), title: (getLocaleDescription(city) ?? 'Unknown').toText14(),
onTap: () { onTap: () {
formManager.updatePatientCity(city); formManager.updatePatientCity(city);
Navigator.pop(context); Navigator.pop(context);
},
);
}, },
); // separatorBuilder: (context, index) => const Divider(),
}, itemCount: cities.length,
// separatorBuilder: (context, index) => const Divider(), ));
itemCount: cities.length,
));
}, },
), ),
useSafeArea: true, useSafeArea: true,
@ -253,4 +239,4 @@ class PatientInformationStepState extends State<PatientInformationStep> {
_phoneFocusNode.dispose(); _phoneFocusNode.dispose();
super.dispose(); super.dispose();
} }
} }

Loading…
Cancel
Save