hcValidateTextField function
bool
hcValidateTextField(
- BuildContext context,
- dynamic controller,
- String fieldName, {
- FocusNode? focusNode,
Validate Text Field or Dropdown Value
Implementation
bool hcValidateTextField(BuildContext context, var controller, String fieldName,
{FocusNode? focusNode}) {
if (controller.isEmpty) {
if (focusNode != null) {
focusNode.requestFocus();
}
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text('$fieldName can\'t be empty'),
));
return false;
}
return true;
}