smart_forms 1.0.2 smart_forms: ^1.0.2 copied to clipboard
A flutter forms generator based on objects with multiple parameters.
Smart Forms #
The idea behind this package is a easy way to build and validate a form with especific field types.
Examples #
Features #
Field Types #
You have an ENUM which contains the available field types (I will add more progressively). The supported types are:
- Text
- Multiline
- Number
- Phone
- URL
Input Actions #
You can handle the action to show on the key enter of the keyboard for each field. By now are supported only 3 actions:
- Next
- Done
- Auto (If you use this the plugin will decide considering if this is the last field or not);
Buttons #
In this plugin you can add two buttons that only require the label to show and will be rendered.
- Submit Button
- Reset Button
Now you can use your custom button and access to the state of the form including the validateForm, resetForm and the responseToMap methods.
How it works #
You need to generate to types of entitys.
-
Field Model
This one contains all the parameters and settings that are available (by now) for the fields of the form. These are:
-
Form Model
This is the base of the plugin and contain just a little variables:
- name: String (mandatory)
- submitButton: String (mandatory)
- resetButton: String
- fields: List of entitys of Field Model
Return Statement #
At the submit of the form you will get a return like this:
{
"form": "<name of the form submitted>",
"values": {
"<field label>": "<value obtained>"
}
}