postalCodeFormEntry method
Postal code form field
Implementation
Widget postalCodeFormEntry({
String title = 'Postal Code',
String subTitle = 'Enter postal code',
Function(String?)? onSaved,
String? defaultValue,
}) {
return TextFormEntries.textFormEntry(
title: title,
subTitle: subTitle,
hint: 'Postal Code (numbers only)',
iconData: Icons.post_add,
onSaved: onSaved,
defaultValue: defaultValue,
enabled: isEdit,
formKey: widget.formKey,
onModified: widget.onModified,
context: context,
validator: (value) => value?.isEmpty == true
? 'Postal code is required'
: (value!.length < 5 || value.length > 10
? 'Postal code must be 5-10 digits'
: null),
);
}