Skip to content

Commit 2c94ff7

Browse files
committed
sticky_header [nfc]: Add comments on _headerEndBound conditions
1 parent 3968346 commit 2c94ff7

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
@@ -562,6 +562,11 @@ class _RenderSliverStickyHeaderList extends RenderSliver with RenderSliverHelper
562562
final headerExtent = header!.size.onAxis(constraints.axis);
563563
final double headerOffset;
564564
if (_headerEndBound == null) {
565+
// The header's item has [StickyHeaderItem.allowOverflow] true.
566+
// Show the header in full, with one edge at the edge of the viewport,
567+
// even if the (visible part of the) item is smaller than the header,
568+
// and even if the whole child is smaller than the header.
569+
565570
final paintedHeaderSize = calculatePaintOffset(constraints, from: 0, to: headerExtent);
566571
final cacheExtent = calculateCacheOffset(constraints, from: 0, to: headerExtent);
567572

@@ -582,6 +587,10 @@ class _RenderSliverStickyHeaderList extends RenderSliver with RenderSliverHelper
582587
? geometry.layoutExtent - headerExtent
583588
: 0.0;
584589
} else {
590+
// The header's item has [StickyHeaderItem.allowOverflow] false.
591+
// Keep the header within the item, pushing the header partly out of
592+
// the viewport if the item's visible part is smaller than the header.
593+
585594
// The limiting edge of the header's item,
586595
// in the outer, non-scrolling coordinates.
587596
final endBoundAbsolute = axisDirectionIsReversed(constraints.growthAxisDirection)

0 commit comments

Comments
 (0)