easy_form_fields 0.0.2

Flutter Android iOS web

A set of pre-built form fields you can quickly import to do validation in various common scenarios.

Easy Form Fields #

It can be complicated and verbose to get Flutter's form setup to validate when you want it to. This library provides a few pre-built classes that make some common use cases very easy.

API #

This library exports several variations on TextFormField that handle validation in various ways. All other parameters on TextFormField are passed through directly to the underlying TextFormField.

EasyTextFormFieldFocus #

Validates when the field has been focused and on any change after that.

EasyTextFormFieldFocus(
  validator: (String value) => value.length > 5 ? null : 'Must be longer than 5',
),

EasyTextFormFieldUnfocus #

Validates only when the field is unfocused.

EasyTextFormFieldUnfocus(
  validator: (String value) => value.length > 5 ? null : 'Must be longer than 5',
),

Others? #

Have a use case that's different than any of the given classes? Please file an issue or open a pull request!

If you want to roll your own solution, it may also be useful to take a look at the source code of the closest class to what you want. Copy it into your project and make the necessary modifications.

Lastly, don't forget that the default behavior of a TextFormField in Flutter is to validate only on submit, so if that's the behavior you want, there is no need for this libarary!

Example #

A complete example can be found in the example/ directory of this project. It shows a form using EasyTextFormFieldFocus widgets to provide a realistic set of features.

1
likes
90
pub points
0%
popularity

A set of pre-built form fields you can quickly import to do validation in various common scenarios.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

justinjmccandless@gmail.com

License

BSD (LICENSE)

Dependencies

flutter

More

Packages that depend on easy_form_fields