dynamic_form_state 1.0.0+1 copy "dynamic_form_state: ^1.0.0+1" to clipboard
dynamic_form_state: ^1.0.0+1 copied to clipboard

dynamic_form_state makes it easy to manage a changing widget state with many different types of values, for example a large input for. Initalize dynamic_form_state with any number of dynamic values wi [...]

Dart dynamic_form_state #

Pub Version

dynamic_form_state makes it easy to manage a changing widget state with many different types of values, for example a large input form. Initalize dynamic_form_state with any number of dynamic values with default values and access both its setState and values with ease.

Install #

To get this plugin, add dynamic_form_state as a dependency in your pubspec.yaml file. For example:

dependencies:
  dynamic_form_state: ^1.0.0

Usage #

Initialize your dynamic_form_state in your stateful widget's initState, passing in desired default values.

  @override
  void initState() {
    super.initState();
    formState = DynamicFormState([
      DynamicValue("value", false),
      DynamicValue("text", TextEditingController()),
      DynamicValue("custom", {"key1": "value1", "key2": "value2"})
    ])
      ..initialize(setState);

Pass in a stateful value and default onChange function into various components using dynamic_form_states getters. For more complex use cases you can use the onChange function inside of your own functions. See CustomWidget in the example.

Radio(
    value: formState.get("value"),
    groupValue: formState.get("value"),
    onChanged: formState.getOnChange("value")
)

TextField(controller: formState.get("text"))

CustomWidget(formState.get("custom"), (key, value) {
  Map<String, bool> items = formState.get("custom");
  items[key] = value;
  var onChange = formState.getOnChange("custom");
  onChange(items);
})

Issues #

Please file any issues, bugs or feature requests as an issue on our GitHub page.

Want to Contribute #

If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature) submit a pull request.

Want to Support #

Buy Me A Coffee

0
likes
30
pub points
0%
popularity

Publisher

unverified uploader

dynamic_form_state makes it easy to manage a changing widget state with many different types of values, for example a large input for. Initalize dynamic_form_state with any number of dynamic values with default values and access both its setState and values with ease.

Repository (GitHub)
View/report issues

License

Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on dynamic_form_state