ArcticZeroo / flutter-search-bar

(mostly) Automatic search-enabled appBar for flutter
BSD 3-Clause "New" or "Revised" License
266 stars 69 forks source link

Add support for OnChange events to support autocomplete features #17

Closed jiachen247 closed 6 years ago

andreagr commented 6 years ago

This would be great

ArcticZeroo commented 6 years ago

What would be the ideal implementation here? Would you just like an onChange event so that you can supply the autocomplete yourself, or would you like to supply a list of things to autocomplete from which populates somehow below the search bar while the user types?

If you're looking for the former, I would recommend using a TextEditingController when initializing the SearchBar and listen to the value changed from there (which is, as far as I know, the recommended way in flutter), but I suppose it wouldn't be difficult to add a default onChanged handler which uses an internal TextEditingController.

If you're looking for the latter, what would be the ideal implementation of it for your use? Would this autocomplete list ever change after the SearchBar is initialized? If so, the issue becomes a decent bit more complex

I'm definitely open to adding this, just want to make sure we're all on the same page here

p.s. I usually find/respond to issues faster, somehow these notifications slipped by

ArcticZeroo commented 6 years ago

It looks like there are a significant amount of forks using onChanged, so I'll add it to the main repo

ArcticZeroo commented 6 years ago

Done in https://github.com/ArcticZeroo/flutter-search-bar/commit/1f6507fb138d57922f7a1faf8401689b7589c4f6