Fix result propagation in RenderSliverEdgeInsetsPadding.hitTestChildren (#149825)

Fixes https://github.com/flutter/flutter/issues/149824
This commit is contained in:
Matej Knopp 2024-07-03 01:21:22 +02:00 committed by GitHub
parent cfa7777f7a
commit 348fdeebb3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -181,7 +181,7 @@ abstract class RenderSliverEdgeInsetsPadding extends RenderSliver with RenderObj
bool hitTestChildren(SliverHitTestResult result, { required double mainAxisPosition, required double crossAxisPosition }) { bool hitTestChildren(SliverHitTestResult result, { required double mainAxisPosition, required double crossAxisPosition }) {
if (child != null && child!.geometry!.hitTestExtent > 0.0) { if (child != null && child!.geometry!.hitTestExtent > 0.0) {
final SliverPhysicalParentData childParentData = child!.parentData! as SliverPhysicalParentData; final SliverPhysicalParentData childParentData = child!.parentData! as SliverPhysicalParentData;
result.addWithAxisOffset( return result.addWithAxisOffset(
mainAxisPosition: mainAxisPosition, mainAxisPosition: mainAxisPosition,
crossAxisPosition: crossAxisPosition, crossAxisPosition: crossAxisPosition,
mainAxisOffset: childMainAxisPosition(child!), mainAxisOffset: childMainAxisPosition(child!),

View File

@ -185,6 +185,7 @@ void main() {
expect(result.path.first.target, isA<RenderView>()); expect(result.path.first.target, isA<RenderView>());
result = tester.hitTestOnBinding(const Offset(100.0, 100.0)); result = tester.hitTestOnBinding(const Offset(100.0, 100.0));
hitsText(result, 'padded'); hitsText(result, 'padded');
expect(result.path.any((HitTestEntry entry) => entry.target is RenderSliverPadding), isTrue);
result = tester.hitTestOnBinding(const Offset(100.0, 490.0)); result = tester.hitTestOnBinding(const Offset(100.0, 490.0));
expect(result.path.first.target, isA<RenderView>()); expect(result.path.first.target, isA<RenderView>());
result = tester.hitTestOnBinding(const Offset(10.0, 520.0)); result = tester.hitTestOnBinding(const Offset(10.0, 520.0));