Skip to content

Commit 9ec7683

Browse files
committed
sticky_header [nfc]: Doc overflow behavior and paint-order constraints
1 parent 016fb86 commit 9ec7683

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

lib/widgets/sticky_header.dart

+23
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,29 @@ enum _HeaderGrowthPlacement {
312312
///
313313
/// This widget takes most of its behavior from [SliverList],
314314
/// but adds sticky headers as described at [StickyHeaderListView].
315+
///
316+
/// ## Overflow across slivers
317+
///
318+
/// When the list item that controls the sticky header has
319+
/// [StickyHeaderItem.allowOverflow] true, the header will be permitted
320+
/// to overflow not only the item but this whole sliver.
321+
///
322+
/// The caller is responsible for arranging the paint order between slivers
323+
/// so that this works correctly: a sliver that might overflow must be painted
324+
/// after any sliver it might overflow onto.
325+
/// For example if [headerPlacement] puts headers at the left of the viewport
326+
/// (and any items with [StickyHeaderItem.allowOverflow] true are present),
327+
/// then this [SliverStickyHeaderList] must paint after any slivers that appear
328+
/// to the right of this sliver.
329+
///
330+
/// At present the only off-the-shelf way to accomplish that is to
331+
/// have every [SliverStickyHeaderList] grow away from the header edge:
332+
/// so if [headerPlacement] is [HeaderPlacement.scrollingEnd],
333+
/// then [CustomScrollView.center] must point to a sliver
334+
/// after every [SliverStickyHeaderList] in [CustomScrollView.slivers],
335+
/// and if [HeaderPlacement.scrollingStart] then
336+
/// [CustomScrollView.center] must not point to any sliver
337+
/// after the first [SliverStickyHeaderList].
315338
class SliverStickyHeaderList extends RenderObjectWidget {
316339
SliverStickyHeaderList({
317340
super.key,

0 commit comments

Comments
 (0)