Flutter – Change search hint text of SearchDelegate
In current implementation of SearchDelegate
, there is no option to change the hint text. When the query is empty, search screen is displaying "Search" in the query field as a hint text.
Hint text is currently defined on line 395 as follows:
final String searchFieldLabel = MaterialLocalizations.of(context).searchFieldLabel;
There is, however, an existing issue to this subject reported.
I wasn't able to come up with any solution for this.
Do you know any workaround for the issue?
Solution to answer:
Currently SearchDelegate has an optional member "searchFieldLabel" to specify the label of the search field. It should look something like this:
@override
String get searchFieldLabel => 'custom label';