VeryGoodOpenSource / formz

A unified form representation in Dart used at Very Good Ventures 🦄

Home Page:https://pub.dev/packages/formz

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docs: more complex examples/use cases in combination with bloc

WieFel opened this issue · comments

commented

Is your feature request related to a problem? Please describe.
I have a use case of a more complex form, but am not sure how to handle it:
For example, let's say I want to have a form where I can enter the data for a Person (which has a name and age). The name and age are simple FormzInputs. For the simple case where we have just 1 person, we can store the 2 fields inside a Bloc's state, and that's fine.
But now, it should be possible to dynamically add an arbitrary number of entries of Persons to the form (e.g. via a "+" button). How could that be handled? Of course, every single block should be validated. In the end, the information of the complete form should be retrieved.

Describe the solution you'd like
I would like to see a bit more complex examples either in the docs or as an example app (which could be referenced in the docs).

Describe alternatives you've considered
I have tried to look for popular projects that use formz in combination with bloc, but couldn't find any.

Additional context
The UI to better imagine the use case:
Untitled-2022-10-25-1855(2)

+1. I would also like to see some more complex examples.