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.07k stars 130 forks source link

[BUG] StickyHeader not working inside a CustomScrollView #65

Closed Areopagitics closed 2 years ago

Areopagitics commented 2 years ago

I get the following error when trying to use a StickyHeader inside a CustomScrollView:

A RenderViewport expected a child of type RenderSliver but received a child of type RenderStickyHeader

It seems to be misleading that the top of the README for the package states:

You can place a StickyHeader or StickyHeaderBuilder inside any scrollable content, such as: ListView, GridView, CustomScrollView, SingleChildScrollView or similar.

13protons commented 2 years ago

FWIW, this works fine for me when the StickyHeader is inside a SliverList's delegate. The sticky header returns a BoxWidget, so can't be a direct child of CustomScrollView.

Areopagitics commented 2 years ago

Good to know! Thanks!

Pranoy1c commented 2 years ago

@13protons Can you give an example of that?

My SliverList's delegate returns SliverChildBuilderDelegate. Where would I put the StickyHeader?