buildActions method
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(
tooltip: 'Reset search',
onPressed: () => query = '',
icon: const Icon(Icons.close_outlined))
];
}