-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
c: API breakBackwards-incompatible API changesBackwards-incompatible API changesframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
Milestone
Description
The Form/Input API is confusing. I think it needs a redesign.
In general, FormField provides a second, slightly easier way of doing things that Input does. This is nice to have but it also causes a lot of confusion. Ideally there's a way to combine FormField's ease of use with Input's flexibility.
Problems:
- You can provide a
formField, which causes the Input to manage the InputValue for you - but only when a descendant of aForm. This is a strange restriction that we should remove. - If you provide a
formField, thevalueargument acts as an initial value, not the current value. Changes tovalueare ignored in future widget re-builds. - FormField's
settercallback and Input'sonChangedcallback fight each other. We should have one or the other. - FormField's
validatorcallback and Input'serrorTextargument fight each other. We should have one or the other. - Form's onSubmitted callback is not useful. It doesn't inform you which Input was submitted, and whole forms are generally not submitted when the "accept" key is tapped anyway.
- It would be convenient if there was a way for the Form to tell you if any of the fields were invalid (e.g. to disable/enable the "Submit" button). [added by @Hixie]
At the very least, we should remove the Form ancestor. We can store that form state on the Input itself.
Metadata
Metadata
Assignees
Labels
c: API breakBackwards-incompatible API changesBackwards-incompatible API changesframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.