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.
This commit is contained in:
parent
1cf3925d4d
commit
a5b06f15a0
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user