Fix front layer can be tapped through bug on gallery (#17181)

This commit is contained in:
xster
2018-05-02 14:31:59 -07:00
committed by GitHub
parent dba7855de8
commit 4e6045883c
3 changed files with 65 additions and 34 deletions

View File

@@ -2848,7 +2848,9 @@ class RenderAbsorbPointer extends RenderProxyBox {
@override
bool hitTest(HitTestResult result, { Offset position }) {
return absorbing ? true : super.hitTest(result, position: position);
return absorbing
? size.contains(position)
: super.hitTest(result, position: position);
}
@override

View File

@@ -0,0 +1,31 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/widgets.dart';
void main() {
testWidgets('AbsorbPointers do not block siblings', (WidgetTester tester) async {
bool tapped = false;
await tester.pumpWidget(
new Column(
children: <Widget>[
new Expanded(
child: new GestureDetector(
onTap: () => tapped = true,
),
),
const Expanded(
child: const AbsorbPointer(
absorbing: true,
),
),
],
),
);
await tester.tap(find.byType(GestureDetector));
expect(tapped, true);
});
}