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
Dynamic data #77
Comments
I'm having the same problem. Any suggestions? |
still figuring this ... |
I got it. You should update the Widget and call the setState. Like: I put this in the textChanged listener, after receive the response from back-end. |
what is updateField() for @Arkasher |
updateField is the method that will return a new instance of the autoCompleteTextField. The setState is called after you update the suggestions list. |
@Arkasher if you don't mind showing me a full code example of your suggested implementation for fetching data dynamic from API and using autocomplete, I would really appreciate it! I'm facing this issue now |
Hi there.
I'm fetching a list of Users from API, i have debugged every thing, data is good.
The issue is i'm unable to show suggestions.
Mean while i can able to do that with static data, the suggestions are showing, but with API data filtering is working on that data, but suggestions list not showing.
Any Idea..
AutoCompleteTextField<UserDataModel>( key: key, clearOnSubmit: false, suggestions: usersList, style: TextStyle(color: Colors.white70), decoration: InputDecoration( hintText: 'Search Here', contentPadding: EdgeInsets.only(left: 10.2, top: 15.0), border: InputBorder.none, hintStyle: TextStyle(color: Colors.white70), suffixIcon: IconButton( iconSize: 30.0, color: Colors.white70, icon: Icon(Icons.search), onPressed: () {}, ), ), itemFilter: (item, query) { print(item.name); return item.name .toLowerCase() .contains(query.toLowerCase()); }, itemSorter: (a, b) { return a.name.compareTo(b.name); }, itemSubmitted: (item) { setState(() { searchTextField.textField.controller.text = item.name; }); }, itemBuilder: (context, item) { return row(item); }, ),
The text was updated successfully, but these errors were encountered: