felixmccuaig / flutter-autocomplete-textfield

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

Display selected item in autocomplete textfield #14

Closed DK15 closed 5 years ago

DK15 commented 5 years ago

I want to show the selected / clicked item from suggestion list in textfield. How do I do that ? I know textfield is now exposed in latest version, but I don’t know how to use controller with autocomplete textfield. Please see my detailed question here :

https://stackoverflow.com/questions/53590156/how-to-set-value-in-autocompletetextfield

felixmccuaig commented 5 years ago

Off the top my head, you would use textfield.controller.text = “YOUR TEXT HERE"

On 5 Dec 2018, at 8:02 pm, Darshan Kawar notifications@github.com wrote:

I want to show the selected / clicked item from suggestion list in textfield. How do I do that ? I know textfield is now exposed in latest version, but I don’t how to use controller with autocomplete textfield. Please see my detailed question here :

https://stackoverflow.com/questions/53590156/how-to-set-value-in-autocompletetextfield https://stackoverflow.com/questions/53590156/how-to-set-value-in-autocompletetextfield — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/felixlucien/flutter-autocomplete-textfield/issues/14, or mute the thread https://github.com/notifications/unsubscribe-auth/AR4NDFRg4vTZLoxWUypHgRtgp-IBcwwRks5u14uvgaJpZM4ZCR9v.

felixmccuaig commented 5 years ago

So as in

itemSubmitted: (item) { setState(() => autocompletetextfield.textfield.controller.text = item. autocompleteterm); }

On 5 Dec 2018, at 8:04 pm, Felix Lucien felixmccuaig@gmail.com wrote:

Off the top my head, you would use textfield.controller.text = “YOUR TEXT HERE"

On 5 Dec 2018, at 8:02 pm, Darshan Kawar <notifications@github.com mailto:notifications@github.com> wrote:

I want to show the selected / clicked item from suggestion list in textfield. How do I do that ? I know textfield is now exposed in latest version, but I don’t how to use controller with autocomplete textfield. Please see my detailed question here :

https://stackoverflow.com/questions/53590156/how-to-set-value-in-autocompletetextfield https://stackoverflow.com/questions/53590156/how-to-set-value-in-autocompletetextfield — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/felixlucien/flutter-autocomplete-textfield/issues/14, or mute the thread https://github.com/notifications/unsubscribe-auth/AR4NDFRg4vTZLoxWUypHgRtgp-IBcwwRks5u14uvgaJpZM4ZCR9v.

DK15 commented 5 years ago

Thanks, I will try that now.

DK15 commented 5 years ago

That worked. I also had to set clearOnSubmit: false to be able to show the value in textfield.