Unverified Commit a5b06f15 authored by Kate Lovett's avatar Kate Lovett Committed by GitHub

Fix visual overflow for SliverMainAxisGroup (#132989)

Fixes https://github.com/flutter/flutter/issues/132788

The SliverGeometry was not set properly for SliverMainAxisGroup. Omitting hasVisualOverflow affected the Viewport's choice to apply a clip, leading to the sliver being rendered outside of the bounds of the viewport.
parent 1cf3925d
......@@ -288,6 +288,7 @@ class RenderSliverMainAxisGroup extends RenderSliver with ContainerRenderObjectM
scrollExtent: totalScrollExtent,
paintExtent: calculatePaintOffset(constraints, from: 0, to: totalScrollExtent),
maxPaintExtent: maxPaintExtent,
hasVisualOverflow: totalScrollExtent > constraints.remainingPaintExtent || constraints.scrollOffset > 0.0,
);
}
......
......@@ -61,6 +61,7 @@ void main() {
final RenderSliverMainAxisGroup renderGroup =
tester.renderObject<RenderSliverMainAxisGroup>(find.byType(SliverMainAxisGroup));
expect(renderGroup.geometry!.scrollExtent, equals(300 * 20 + 200 * 20));
expect(renderGroup.geometry!.hasVisualOverflow, isTrue);
});
testWidgets('SliverMainAxisGroup is laid out properly when reversed', (WidgetTester tester) async {
......@@ -112,6 +113,7 @@ void main() {
final RenderSliverMainAxisGroup renderGroup =
tester.renderObject<RenderSliverMainAxisGroup>(find.byType(SliverMainAxisGroup));
expect(renderGroup.geometry!.scrollExtent, equals(300 * 20 + 200 * 20));
expect(renderGroup.geometry!.hasVisualOverflow, isTrue);
});
testWidgets('SliverMainAxisGroup is laid out properly when horizontal', (WidgetTester tester) async {
......@@ -168,6 +170,7 @@ void main() {
final RenderSliverMainAxisGroup renderGroup =
tester.renderObject<RenderSliverMainAxisGroup>(find.byType(SliverMainAxisGroup));
expect(renderGroup.geometry!.scrollExtent, equals(300 * 20 + 200 * 20));
expect(renderGroup.geometry!.hasVisualOverflow, isTrue);
});
testWidgets('SliverMainAxisGroup is laid out properly when horizontal, reversed', (WidgetTester tester) async {
......@@ -225,6 +228,7 @@ void main() {
final RenderSliverMainAxisGroup renderGroup =
tester.renderObject<RenderSliverMainAxisGroup>(find.byType(SliverMainAxisGroup));
expect(renderGroup.geometry!.scrollExtent, equals(300 * 20 + 200 * 20));
expect(renderGroup.geometry!.hasVisualOverflow, isTrue);
});
testWidgets('Hit test works properly on various parts of SliverMainAxisGroup', (WidgetTester tester) async {
......
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