Unverified Commit 64f42c0e authored by Kate Lovett's avatar Kate Lovett Committed by GitHub

Support floating the header slivers of a NestedScrollView (#59187)

parent e96b13c7
......@@ -644,7 +644,7 @@ abstract class RenderSliverFloatingPinnedPersistentHeader extends RenderSliverFl
paintExtent: clampedPaintExtent,
layoutExtent: layoutExtent.clamp(0.0, clampedPaintExtent) as double,
maxPaintExtent: maxExtent + stretchOffset,
maxScrollObstructionExtent: maxExtent,
maxScrollObstructionExtent: minExtent,
hasVisualOverflow: true, // Conservatively say we do have overflow to avoid complexity.
);
return 0.0;
......
......@@ -26,6 +26,24 @@ void main() {
expect(header.geometry.maxScrollObstructionExtent, 0);
});
test('RenderSliverFloatingPinnedPersistentHeader maxScrollObstructionExtent is minExtent', () {
final TestRenderSliverFloatingPinnedPersistentHeader header = TestRenderSliverFloatingPinnedPersistentHeader(
child: RenderSizedBox(const Size(400.0, 100.0)
));
final RenderViewport root = RenderViewport(
axisDirection: AxisDirection.down,
crossAxisDirection: AxisDirection.right,
offset: ViewportOffset.zero(),
cacheExtent: 0,
children: <RenderSliver>[
header,
],
);
layout(root);
expect(header.geometry.maxScrollObstructionExtent, 100.0);
});
}
class TestRenderSliverFloatingPersistentHeader extends RenderSliverFloatingPersistentHeader {
......@@ -39,3 +57,15 @@ class TestRenderSliverFloatingPersistentHeader extends RenderSliverFloatingPersi
@override
double get minExtent => 100;
}
class TestRenderSliverFloatingPinnedPersistentHeader extends RenderSliverFloatingPinnedPersistentHeader {
TestRenderSliverFloatingPinnedPersistentHeader({
RenderBox child,
}) : super(child: child);
@override
double get maxExtent => 200;
@override
double get minExtent => 100;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment