Form Field Controller
Simple and easy way to handle Form Fields and Validation.
Features
x
Controllersx
Input Formattersx
Input Validators
Available Form Field Controller
How to use
Wrap all the form field widget inside Form
widget.
PhoneFormFieldController phoneController = PhoneFormFieldController(const ValueKey("txtPhone"));
TextFormField(
controller: phoneController.textEditingController,
focusNode: phoneController.focusNode,
validator: phoneController.validator,
inputFormatters: phoneController.inputFormatter,
maxLength: phoneController.maxLength,
decoration: const InputDecoration(labelText: "Phone Number"),
),
Phone Form Field Controller
This controller is used to validate Phone number. It uses InputFormatter.phoneNoFormatter
, InputValidator.phoneValidator
PhoneFormFieldController phoneController = PhoneFormFieldController(const ValueKey("txtPhone"), maxlength: 10);
Arguments | Default Value | Description |
---|---|---|
key | ValueKey |
|
maxlength | 10 | |
required | true | true - mandatory field it can't be empty |
requiredText | Required! | Message to show if the field is in error state |
Email Form Field Controller
This controller is used to validate Email Field. It uses InputValidator.emailValidator
PhoneFormFieldController phoneController = PhoneFormFieldController(const ValueKey("txtPhone"), maxlength: 10);
Arguments | Default Value | Description |
---|---|---|
key | ValueKey |
|
required | true | true - mandatory field it can't be empty |
requiredText | Please enter a valid Email | Message to show if the field is in error state |
Feedback
You like the package ? Give me a thumbsup :thumbsup: