Skip to content

Commit 40bc4bc

Browse files
committed
sticky_header [nfc]: Add comments on _headerEndBound conditions
1 parent b39f6a9 commit 40bc4bc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/widgets/sticky_header.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,11 @@ class _RenderSliverStickyHeaderList extends RenderSliver with RenderSliverHelper
570570
final headerExtent = header!.size.onAxis(constraints.axis);
571571
final double headerOffset;
572572
if (_headerEndBound == null) {
573+
// The header's item has [StickyHeaderItem.allowOverflow] true.
574+
// Show the header in full, with one edge at the edge of the viewport,
575+
// even if the (visible part of the) item is smaller than the header,
576+
// and even if the whole child sliver is smaller than the header.
577+
573578
final paintedHeaderSize = calculatePaintOffset(constraints, from: 0, to: headerExtent);
574579
final cacheExtent = calculateCacheOffset(constraints, from: 0, to: headerExtent);
575580

@@ -590,6 +595,10 @@ class _RenderSliverStickyHeaderList extends RenderSliver with RenderSliverHelper
590595
? geometry.layoutExtent - headerExtent
591596
: 0.0;
592597
} else {
598+
// The header's item has [StickyHeaderItem.allowOverflow] false.
599+
// Keep the header within the item, pushing the header partly out of
600+
// the viewport if the item's visible part is smaller than the header.
601+
593602
// The limiting edge of the header's item,
594603
// in the outer, non-scrolling coordinates.
595604
final endBoundAbsolute = axisDirectionIsReversed(constraints.growthAxisDirection)

0 commit comments

Comments
 (0)