buildActions method

  1. @override
List<Widget> buildActions(
  1. 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 <Widget>[
    IconButton(
      icon: Icon(Icons.close),
      onPressed: () {
        query = "";
      },
    ),
  ];
}