title: Flutter. How to manage state with SliverPersistentHeaderDelegate in Sliver?
body: <p>I use CustomScrollView with Slivers. In header I have some text field with autocomplete (search data in database) and when input text equal some value I need do something. I try to use SliverPersistentHeader. But it can't set state. How to set state?</p>
  
  <pre><code>The declaration setState() isn't referenced
  </code></pre>
  
  <p>What's wrong?</p>
  
  <pre><code>class MySliverAppBar extends SliverPersistentHeaderDelegate {
    final double expandedHeight;
    MySliverAppBar({@required this.expandedHeight});
  
    @override
    Widget build(
        BuildContext context, double shrinkOffset, bool overlapsContent) {
      return
        StatefulBuilder(
          builder:(BuildContext context, StateSetter setState) {
            return Stack(
              overflow: Overflow.visible,
              children: [
                SizedBox(
                  height: 200,
                  child: AppBar(
                    backgroundColor: Colors.green,
                    leading: IconButton(
                      icon: Icon(Icons.menu),
                      onPressed: () {},
                    ),
                    elevation: 0.0,
                  ),
                ),
                RaisedButton(
                  child: Text("Press"),
                  color: Colors.yellow,
                  onPressed: (){
                    setState(){
                      // The declaration setState() isn't referenced
  
                    }
                  },),
              ],
            );
          }
        );
    }
  
    @override
    double get maxExtent =&gt; expandedHeight;
  
    @override
    double get minExtent =&gt; kToolbarHeight;
  
    @override
    bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) =&gt; true;
  }
  </code></pre>