Closed MohamedEL-Torky closed 4 years ago
Hi, thanks for reaching out.
First, you will need to add this line to your pubspec.yaml
flappy_search_bar: git: url: https://github.com/MohamedEL-Torky/flappy_search_bar
and remove flappy_search_bar from it, because it will conflict with my edited package. You can switch back to the flappy_search_bar package once he accepted my pull request.
Secondly, you will need to declare searchBarController inside your widget class.
SearchBarController
searchBarController = new SearchBarController();
Then add it to the SearchBar widget like that
SearchBar
( ..... searchBarController: searchBarController, ....
),
Finally, you will now be able to use the searchBarController injectSearch method like that
searchBarController.injectSearch(searchString, searchFunction);
The search string parameter is what the search function will search for. The search function is just like the function you feed to SearchBar widget or you can customize another one in case you need to apply another search method for that case.
On Fri, Mar 20, 2020 at 10:36 PM João Vitor R notifications@github.com wrote:
I really need this feature in my project, how can I add it?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/smartnsoft/flappy_search_bar/pull/10#issuecomment-601899519, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGI2XXOTIEM2YHVBLWI47ZTRIPHTJANCNFSM4KUUNPPQ .
Hey @ThomasEcalle. No need to be sorry I understand the current situation. The most important thing is that you're fine. I would like to thank you for your efforts making this package which is was really great help for me and many other developers out there, and don't try to push yourself too hard we are here for you to help make this package even better that's the power of open source.
Remeber stay safe and work from home <3
Hi @MohamedEL-Torky
Has this fix been released as a package ? I don't see this in the latest version.
Hey @rohan3usturge sorry for the late reply. I have checked the package on pub dev but unfortunately, it seems quite outdated. If you're still looking for using this feature I welcome you to use my fork by writing the following on your pubspec.yaml file.
flappy_search_bar:
git:
url: https://github.com/MohamedEL-Torky/flappy_search_bar
Anyone can now inject search text into the search bar using the SearchBarController you provided by adding new method injectSearch that accepts a search text and a search Function for greater modifiability.
Use Cases:
Devs now can add buttons into the placeholder screen for search shortcuts or even add a QR / Barcode reader buttons that obviously read QR / Bar codes and inject the scanned values into the search field to automatically search after the user acquire the data from the reader.