-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onSaved and validator error #2
Comments
Same issue here. Did you find any workaround? |
Okey, just solved it. Just edit the component file, and include the initial value in the widget properties. Then, pass that onto the class DropDownFormField extends FormField<dynamic> {
final String titleText;
final String hintText;
final bool required;
final String errorText;
final dynamic value;
final dynamic initialValue;
final List dataSource;
final String textField;
final String valueField;
final Function onChanged;
DropDownFormField(
{FormFieldSetter<dynamic> onSaved,
FormFieldValidator<dynamic> validator,
bool autovalidate = false,
this.titleText = 'Title',
this.hintText = 'Select one option',
this.required = false,
this.errorText = 'Please select one option',
this.initialValue,
this.value,
this.dataSource,
this.textField,
this.valueField,
this.onChanged})
: super(
onSaved: onSaved,
validator: validator,
initialValue: initialValue,
autovalidate: autovalidate,
builder: (FormFieldState<dynamic> state) {
return Container(
child: Column(
... And just use that To the contributors: Thanks for the component, its really nice to have this. It seems, however, that this package is abandoned. It would be nice if you could update it with this solution, as it only needs literally 3 new lines, and it solves a great flaw. Cheers! |
kindly use DropDownButtonFormField |
When i set an initial value (because i want the field to be with a initial value) when i validate or save the form i get an error because the value received by the onSaved or validator is null.
This is probably happening because when i set an initial value the onChanged method is not being called and the value is not being updated internally.
Besides this error, this is a great component. Thanks a lot for you effort
The text was updated successfully, but these errors were encountered: