fluttercommunity / flutter_sticky_headers

Flutter Sticky Headers - Lets you place "sticky headers" into any scrollable content in your Flutter app. No special wrappers or magic required. Maintainer: @slightfoot
https://pub.dev/packages/sticky_headers
MIT License
1.1k stars 129 forks source link

Sparse header setup not working currently #9

Open ened opened 6 years ago

ened commented 6 years ago

Given code like this:

ListView.builder(
  itemCount: 35,
  itemBuilder: (context, i) {
    final tile = ListTile(title: Text("My Tile"));

    if (i % 5 == 0) {
      return StickyHeader(
        content: tile,
        header: Container(
          padding: EdgeInsets.symmetric(
            horizontal: 16.0,
            vertical: 8.0,
          ),
          alignment: Alignment.centerLeft,
          decoration: BoxDecoration(color: Colors.lightGreen),
          child: Text("Section"),
        ),
      );
    }

    return tile;
  }
);

Then I would expect the header stay on top of the list until the next header replaces it. Currently, it will only stay for as long as the current item stays on screen.

tamoyal commented 5 years ago

+1 to this as a big use case for sticky headers is sticky section headers