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(final BuildContext context) => [
IconButton(
icon: const Icon(Icons.exit_to_app_rounded),
onPressed: () {
if (query.isEmpty) {
close(context, null);
} else {
query = '';
onSearch(query);
}
},
),
];