title: How to use SliverAppBar in SearchDelegate in Flutter to hide the AppBar on Scroll
body: <p>I'm trying to implement <code>SliverAppBar</code> instead of the default that <code>SearchDelegate</code> use which is a basic <code>AppBar</code>, i could implement using the SliverList and changing the theme of the <code>AppBar</code>. But i couldn't find a way to change it to <code>SliverAppBar</code></p>
  
  <p>I need to use the <code>SliverAppBar</code> so that i can hide the the <code>SearchDelegate</code>'s <code>AppBar</code> on scroll.</p>
  
  <p>Below is my <code>SearchDelegate</code>:</p>
  
  <pre><code>class BirdFinder extends SearchDelegate {
    @override
    List&lt;Widget&gt; buildActions(BuildContext context) {
      return [
        IconButton(
          icon: query.isEmpty
              ? Icon(null)
              : Icon(
                  Icons.close,
                  color: Colors.grey,
                ),
          onPressed: query.isEmpty
              ? () {
                  //not yet implemented
                }
              : () {
                  query = '';
                },
        )
      ];
    }
  
    @override
    ThemeData appBarTheme(BuildContext context) {
      assert(context != null);
      final ThemeData theme = Theme.of(context);
      assert(theme != null);
      return theme.copyWith(
        primaryColor: Colors.grey[50],
      );
    }
  
    @override
    Widget buildLeading(BuildContext context) {
      return IconButton(
        icon: Icon(
          Icons.arrow_back,
          color: Colors.grey,
        ),
        onPressed: () {
          close(context, null);
        },
      );
    }
  
    @override
    Widget buildResults(BuildContext context) {
      return ListView(
        children: &lt;Widget&gt;[
          ListTile(
            title: Text('test'),
          ),
        ],
      );
    }
  
    @override
    Widget buildSuggestions(BuildContext context) {
      final BirdsData searchResults = BirdsData();
      final Iterable&lt;DataArchitecture&gt; suggestion = searchResults.birdsData
          .where((a) =&gt; a.birdSpeech.toLowerCase().contains(query));
  
      return BirdFindingsResults(
          query: this.query, suggestions: suggestion.toList());
    }
  }
  
  class BirdFindingsResults extends StatelessWidget {
    const BirdFindingsResults({this.suggestions, this.query});
  
    final List&lt;DataArchitecture&gt; suggestions;
    final String query;
  
    @override
    Widget build(BuildContext context) {
      final textTheme = Theme.of(context).textTheme.bodyText2;
      return CustomScrollView(
        slivers: &lt;Widget&gt;[
          SliverList(
            delegate: SliverChildBuilderDelegate((context, index) {
              final DataArchitecture suggestion = suggestions[index];
              return Container(
                color: Colors.white24,
                child: Column(
                  children: &lt;Widget&gt;[
                    ListTile(
                      title: SubstringHighlight(
                        text: suggestion.birdSpeech,
                        term: query,
                        textStyle: textTheme,
                        textStyleHighlight:
                            textTheme.copyWith(fontWeight: FontWeight.bold),
                      ),
                    ),
                    Divider(
                      indent: 45,
                      endIndent: 45,
                      color: Colors.black,
                    )
                  ],
                ),
              );
            }, childCount: suggestions.length),
          ),
        ],
      );
    }
  }
  </code></pre>