'Flutter create custom search UI extends SearchDelegate

I have a fully tested Search class which extends SearchDelegate, it always shows the Searchbar within the appbar as material design.

main Search delegate UI

But I want it to be like this one below

enter image description here

How can I change the UI of the Searchbar? without leaving the SearchDelegate methods like

-buildActions

-buildLeading

-buildResults ... etc



Solution 1:[1]

showSearch function is always displayed on the AppBar. You can use CupertinoSearchTextField widget from the cupertino library to have an iOS-oriented search TextField similar to the screenshot you've shared. Another workaround for the feature that you're looking for is by using AutoComplete Widget

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Omatt