title: Flutter - Show a floating widget when list scrolls down
body: <p>Is there a way to show a floating widget in top of the screen when list is scrolled up?</p>
  
  <p>I have a widget (inside a scrollable widget) in my screen, when I scroll up, I want to convert this widget to a sticky header. and put it back when I scroll down.</p>
  
  <p>I have tried using Slivers and SliverAppBar (if floating is set to true), but it works the other way around, it shows up when scrolling down and hides when scrolling otherwise.</p>
  
  <p>Any idea where to look? or any example?</p>
  
  <p>Here is what I tried.</p>
  
  <pre><code>CustomScrollView(
    slivers: &lt;Widget&gt;[
      SliverToBoxAdapter(
        child: Container(
          color: Colors.green,
          height: 100,
        ),
      ),
  
      // I wan to stick this widget in the top, when I scroll up, initially it should be gone. 
      SliverAppBar(
        backgroundColor: Colors.blueAccent,
        floating: true,
        expandedHeight: 70,
        flexibleSpace: LayoutBuilder(
          builder: (context, constraints) {
            return FlexibleSpaceBar(
              title: Text("Sticky Header"),
            );
          },
        ),
      ),
      SliverList(
        delegate: SliverChildBuilderDelegate((context, index) {
          return Text("Text $index");
        }, childCount: 50),
      ),
    ],
  );
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/kVcWq.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kVcWq.gif" alt="here is what I&#39;m trying to do."></a></p>