Ahmadre / FlutterIconPicker

An adaptive comprehensive IconPicker for Flutter
MIT License
112 stars 76 forks source link

Expose search logic #61

Closed xunafay closed 6 months ago

xunafay commented 9 months ago

I think it would be nice if the search logic were to be exposed for overwriting. https://github.com/Ahmadre/FlutterIconPicker/blob/9db0280c1a432c37ace0ab6e277b8b2c85831d99/lib/IconPicker/searchBar.dart#L43

e.g.

// signature
bool Function(String search, String icon)

FlutterIconPicker.showIconPicker(
 ...
 searchCompare: (search, icon) => search.toLowerCase().contains(icon.replaceAll('_', ' ').toLowerCase())
 ...
);

Here I simply added a string replace but I'd like to use a fuzzy search library like fuzzywuzzy

Ahmadre commented 6 months ago

Interesting 🤔 thanks for mentioning. I will open a PR and tag you for review, if it fits your needs. I think this would be a neat feature (And sorry for the late response).

Ahmadre commented 6 months ago

@xunafay Finished:

Example:

Bildschirmfoto 2024-02-08 um 21 04 57

Preview:

Bildschirmfoto 2024-02-08 um 21 04 52

I will merge it after I've updated the docs :)