Simple and easy way to handle Form Fields and Validation.
- Controllers
- Input Formatters
- Input Validators
- Predefined Form Widgets
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"),
),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 |
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 |
You like the package ? Give me a thumbsup 👍