Skip to content

Commit a143ab0

Browse files
committed
sticky_header [nfc]: Document SliverStickyHeaderList
This is the class we actually use at this point -- not StickyHeaderListView -- so it's good for it to have some docs too.
1 parent 0f11272 commit a143ab0

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

lib/widgets/sticky_header.dart

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,18 @@ class RenderStickyHeaderItem extends RenderProxyBox {
9999
/// or if [scrollDirection] is horizontal then to the start in the
100100
/// reading direction of the ambient [Directionality].
101101
/// It can be controlled with [reverseHeader].
102+
///
103+
/// Much like [ListView], a [StickyHeaderListView] is basically
104+
/// a [CustomScrollView] with a single sliver in its [CustomScrollView.slivers]
105+
/// property.
106+
/// For a [StickyHeaderListView], that sliver is a [SliverStickyHeaderList].
107+
///
108+
/// If more than one sliver is needed, any code using [StickyHeaderListView]
109+
/// can be ported to use [CustomScrollView] directly, in much the same way
110+
/// as for code using [ListView]. See [ListView] for details.
111+
///
112+
/// See also:
113+
/// * [SliverStickyHeaderList], which provides the sticky-header behavior.
102114
class StickyHeaderListView extends BoxScrollView {
103115
// Like ListView, but with sticky headers.
104116
StickyHeaderListView({
@@ -296,6 +308,10 @@ enum _HeaderGrowthPlacement {
296308
growthEnd
297309
}
298310

311+
/// A list sliver with sticky headers.
312+
///
313+
/// This widget takes most of its behavior from [SliverList],
314+
/// but adds sticky headers as described at [StickyHeaderListView].
299315
class SliverStickyHeaderList extends RenderObjectWidget {
300316
SliverStickyHeaderList({
301317
super.key,
@@ -306,7 +322,16 @@ class SliverStickyHeaderList extends RenderObjectWidget {
306322
delegate: delegate,
307323
);
308324

325+
/// Whether the sticky header appears at the start or the end
326+
/// in the scrolling direction.
327+
///
328+
/// For example, if the enclosing [Viewport] has [Viewport.axisDirection]
329+
/// of [AxisDirection.down], then
330+
/// [HeaderPlacement.scrollingStart] means the header appears at
331+
/// the top of the viewport, and
332+
/// [HeaderPlacement.scrollingEnd] means it appears at the bottom.
309333
final HeaderPlacement headerPlacement;
334+
310335
final _SliverStickyHeaderListInner _child;
311336

312337
@override

0 commit comments

Comments
 (0)