buildActions method
- BuildContext context
override
Widgets to display after the search query in the AppBar.
If the query is not empty, this should typically contain a button to clear the query and show the suggestions again (via showSuggestions) if the results are currently shown.
Returns null if no widget should be shown.
See also:
- AppBar.actions, the intended use for the return value of this method.
Implementation
@override
List<Widget> buildActions(BuildContext context) {
return [
if (query.isNotEmpty)
IconButton(
icon: const Icon(Icons.clear),
tooltip: SearchLocalizations.of(context).clearSearch,
onPressed: () {
query = '';
showSuggestions(context);
},
),
];
}