felixmccuaig / flutter-autocomplete-textfield

An autocomplete Textfield for flutter
MIT License
181 stars 131 forks source link

How do I create a validator for the AutoCompleteTextField? #96

Open mdmota opened 3 years ago

mdmota commented 3 years ago

validator: (value) { if (value.isEmpty) { return "msg ...."; } return null; },

conleec commented 3 years ago

Same question. Would like to apply my basic email validator to this list.

gfb-47 commented 3 years ago

I'm having the same issue..

Molkars commented 3 years ago

I'm in the process of rewriting the library for the current version of text field in flutter. I'll add an AutoCompleteTextFormField while I am at it. I'm unsure if my pull request will be reviewed given the 6 open ones from 14 months ago.

marcio-ota commented 3 years ago

I'm in the process of rewriting the library for the current version of text field in flutter. I'll add an AutoCompleteTextFormField while I am at it. I'm unsure if my pull request will be reviewed given the 6 open ones from 14 months ago.

check this fork: by marcelser

mdmota commented 3 years ago

We will wait for the implementation. For now I decided like this:

autocompleteField.updateDecoration(decoration: autocompleteField.decoration.copyWith(errorText: "msg error"));

to clean: autocompleteField.updateDecoration(decoration: autocompleteField.decoration.copyWith(errorText: null));

shabeenabarde commented 3 years ago

Can anyone please elaborate more on this? How can I use this so that i can validate the field like how we do in Flutter forms?

Molkars commented 3 years ago

As of right now, built in validation is not supported. You can the alternative method that @mdmota provided. I implemented support for flutter's validation in my latest pull request #103, but as far as I can tell this project is abandoned by the original author. I would suggest Flutter Typeahed, my fork, or Marcelser's Fork.

felixmccuaig commented 2 years ago

I've requested @marcelser make a PR to get this in. :)

PraveenGangula1392 commented 1 year ago

@felixmccuaig Any update on providing validator ?