flutter-autocomplete-textfield icon indicating copy to clipboard operation
flutter-autocomplete-textfield copied to clipboard

How do I create a validator for the AutoCompleteTextField?

Open mdmota opened this issue 3 years ago • 9 comments

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

mdmota avatar Oct 18 '20 20:10 mdmota

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

conleec avatar Oct 19 '20 22:10 conleec

I'm having the same issue..

gfb-47 avatar Oct 23 '20 00:10 gfb-47

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.

Molkars avatar Oct 27 '20 00:10 Molkars

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

marcio-ota avatar Oct 28 '20 11:10 marcio-ota

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));

mdmota avatar Oct 28 '20 12:10 mdmota

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?

shabeenabarde avatar Dec 20 '20 20:12 shabeenabarde

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.

Molkars avatar Dec 20 '20 20:12 Molkars

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

felixmccuaig avatar Jun 11 '22 10:06 felixmccuaig

@felixmccuaig Any update on providing validator ?

PraveenGangula1392 avatar Oct 29 '22 07:10 PraveenGangula1392