maheshj01 / searchfield

A highly customizable simple and easy to use flutter Widget to add a searchfield to your Flutter Application.This Widget allows you to search and select from list of suggestions.
MIT License
84 stars 63 forks source link

Using aliases in search result #109

Closed igbokwenu closed 9 months ago

igbokwenu commented 9 months ago

A feature that allows you to search using aliases. For example typing and clicking chicken, beef, beans, will return the result protein.

I'm currently about to use a map to achieve this but thought it'd be a nice inbuilt feature to have.

maheshj01 commented 9 months ago

Hi @igbokwenu, Thanks for filing the issue. I am wondering why not just add protein to the list. or alternatively, I think you should be able to achieve that with the current API using the searchController

something like

            SearchField(
              suggestions:
                  _suggestions.map((e) => SearchFieldListItem(e)).toList(),
              controller: _searchController,
              hint: 'SearchField Example 1',
              maxSuggestionsInViewPort: 3,
              itemHeight: 45,
              onSuggestionTap: (x) {
              /// called when a suggestion is tapped
                _searchController.text = 'Your Value'
              },
            ),

I have never really seen this kind of use case before so I may not be understanding it right. If you have any sample apps for me to take a look feel free to leave a link, It will help me understand better.

igbokwenu commented 9 months ago

I appreciate your response and do agree that it's a bit of an edge use case. It's basically trying to implement a mini search engine.

maheshj01 commented 9 months ago

@igbokwenu considering your use case is more specific to your app and not a standard requirement seen in other apps. I am closing this issue as invalid. If you have any improvements to suggest in this package or see a bug, Please feel free to reach out.