branchCodeFormEntry method
Implementation
Widget branchCodeFormEntry({
String title = 'Branch Code',
String subTitle = 'the branch code',
Function(String?)? onSaved,
String? defaultValue,
}) {
return formEntry(
title: title,
subTitle: subTitle,
inputWidget: TextFormField(
onChanged: (_) {
widget.formKey.currentState!.save();
if (widget.onModified != null) {
widget.onModified!();
}
},
style: Theme.of(context).textTheme.bodyLarge,
enabled: isEdit,
controller: TextEditingController(text: defaultValue),
decoration: elegantInputDecoration(
hintText: 'Branch Code',
prefix: const Icon(Icons.code),
),
validator: (value) => value!.isEmpty
? 'Branch code is required'
: (value.isValidNumber() ? null : 'Invalid branch code'),
onSaved: onSaved,
),
);
}