felixmccuaig / flutter-autocomplete-textfield

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

Add Validator and keyboardAppearance properties #29

Open Geriko420 opened 5 years ago

Geriko420 commented 5 years ago

Like in TextFormFields, it could be great if we can add the Validator property and the keyboardAppearance property.

Example for the Validator property :

TextFormField(
  // The validator receives the text the user has typed in
  validator: (value) {
    if (value.isEmpty) {
      return 'Please enter some text';
    }
  },
);

And for instance the keyboardAppearance property :

TextFormField(
// Here to apply a white keyboard 
    keyboardAppearance: Brightness.light,
),
hbdejesus commented 5 years ago

Form the meantime you can try making your own widget that extends the FormField class just like the TextFormField then just return the AutoCompleteTextField on the build parameter.

Edit: Here's a link to a tutorial on how to make your own FormField widget. https://medium.com/saugo360/creating-custom-form-fields-in-flutter-85a8f46c2f41

Geriko420 commented 5 years ago

Thanks for the quick answer and the tutorial. I will try to do that way.

I will let you know :)

Best regards, Simon

lucasriondel commented 5 years ago

+1