flutter_sticky_header
0.11.0, released 2 weeks ago by romainrastel.com
Flutter sliver implementation of sticky headers for CustomScrollView.
What it does
Provides SliverStickyHeader and SliverStickyHeader.builder widgets that allow you to place sticky headers inside a CustomScrollView. The header can stay pinned to the viewport, overlap its content, or stick to the end of its sliver.
AI-written summary of version 0.11.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need a header that overlaps its content (like sticky side headers).
- You want to build a header based on its current scroll state using a builder.
- You need a sticky footer or a header that sticks to the end in a reversed list.
Skip it when
- You are using Flutter 3.13 or newer and only need simple pinned headers that work natively with SliverMainAxisGroup.
Strengths
- Supports header overlap and sticky footers via stickToEnd.
- Provides scroll state notifications and builder pattern for dynamic layout changes.
- Works with both reversed and standard CustomScrollViews.
Weaknesses
- Some basic sticky header use cases can now be implemented directly via Flutter's core framework without extra packages.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
not documented
CustomScrollView(
slivers: [
SliverStickyHeader(
header: Container(
height: 60.0,
color: Colors.lightBlue,
padding: EdgeInsets.symmetric(horizontal: 16.0),
alignment: Alignment.centerLeft,
child: Text('Header #0', style: TextStyle(color: Colors.white)),
),
sliver: SliverList(
delegate: SliverChildBuilderDelegate(
(context, i) => ListTile(title: Text('List tile #$i')),
childCount: 4,
),
),
),
],
)Alternatives
Packages that do the same job and could replace flutter_sticky_header.
- data_table_2
In-place substitute for Flutter's DataTable and PaginatedDataTable with sticky headers.
83Compare - sliver_sticky_collapsable_panel
A Sliver implementation of a sticky collapsible panel with a box header and sliver child.
57Compare - sticky_and_expandable_list
Grouped list with sticky headers and expandable sections for CustomScrollView
50Compare - sticky_infinite_list
Infinite scroll list with sticky headers supporting multiple directions.
69Compare
Works with
Packages commonly used together with flutter_sticky_header: ones it builds on, ones built on it, and its own family.
- value_layout_builderflutter_sticky_header depends on itA LayoutBuilder that passes a custom value to its builder during layout.
- overflow_viewSame familyDisplays children in a line with an overflow indicator at the end if space is insufficient.
- alphabet_list_viewBuilt on flutter_sticky_headerA ListView with sticky headers and an iOS-like clickable sidebar.
- infinite_grouped_listBuilt on flutter_sticky_headerDynamic scrolling list that efficiently groups items and loads more data as the user scrolls.