Skip to main content
Screenshot of a search interface with 'shirt' entered, showing recent searches 'jacket' and 'polo,' and popular searches like 'shirts polo a designer brand white' and 'shirts yellow.'

Code summary

The Autocomplete component is used on the Ecommerce UI demo app search page when you tap the search box in the main page. It consists of two sections: one presenting the search history and the second one presenting the query suggestions. The AppBar includes a SearchHeaderView widget representing the search box on the autocomplete screen.
Usage
Each section consists of couple of SliverAppBar and SliverList components representing the section header and section body respectively.
Usage

Search history section

All the submitted search queries are stored in the Autocomplete screen state. Users can delete each history item or remove them all by tapping the corresponding button in the section header. Screenshot of the search history section showing 'jacket' and 'polo' with a 'Clear' button and popular searches like 'shirts polo a designer brand white'. Each history row is represented by a HistoryRowView:
Usage

Query Suggestions section

By default it shows the list of popular searches. When user starts typing a search query the list is refreshing automatically and presents the highlighted search completions. Screenshot of a search interface with 'shirt' in the search box, showing 'Your searches' for 'jacket' and 'polo,' and a 'Popular searches' list. Each suggestion row is represented by a SuggestionRowView:
Usage
The highlighting of the suggestion row is possible through HighlightedString.toInlineSpans() from Flutter helpers. The entire autocomplete logic can be found in the autocomplete_screen file. You can customize Autocomplete in:
Last modified on May 19, 2026