Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
4e604588
Unverified
Commit
4e604588
authored
May 02, 2018
by
xster
Committed by
GitHub
May 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix front layer can be tapped through bug on gallery (#17181)
parent
dba7855d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
34 deletions
+65
-34
backdrop.dart
examples/flutter_gallery/lib/gallery/backdrop.dart
+31
-33
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+3
-1
absorb_pointer_test.dart
packages/flutter/test/widgets/absorb_pointer_test.dart
+31
-0
No files found.
examples/flutter_gallery/lib/gallery/backdrop.dart
View file @
4e604588
...
...
@@ -24,8 +24,8 @@ final Tween<BorderRadius> _kFrontHeadingBevelRadius = new BorderRadiusTween(
),
);
class
_
IgnorePointerWhileStatusIsNot
extends
StatefulWidget
{
const
_
IgnorePointerWhileStatusIsNot
(
this
.
status
,
{
class
_
TappableWhileStatusIs
extends
StatefulWidget
{
const
_
TappableWhileStatusIs
(
this
.
status
,
{
Key
key
,
this
.
controller
,
this
.
child
,
...
...
@@ -36,17 +36,17 @@ class _IgnorePointerWhileStatusIsNot extends StatefulWidget {
final
Widget
child
;
@override
_
IgnorePointerWhileStatusIsNotState
createState
()
=>
new
_IgnorePointerWhileStatusIsNot
State
();
_
TappableWhileStatusIsState
createState
()
=>
new
_TappableWhileStatusIs
State
();
}
class
_
IgnorePointerWhileStatusIsNotState
extends
State
<
_IgnorePointerWhileStatusIsNot
>
{
bool
_
ignoring
;
class
_
TappableWhileStatusIsState
extends
State
<
_TappableWhileStatusIs
>
{
bool
_
active
;
@override
void
initState
()
{
super
.
initState
();
widget
.
controller
.
addStatusListener
(
_handleStatusChange
);
_
ignoring
=
widget
.
controller
.
status
!
=
widget
.
status
;
_
active
=
widget
.
controller
.
status
=
=
widget
.
status
;
}
@override
...
...
@@ -55,20 +55,24 @@ class _IgnorePointerWhileStatusIsNotState extends State<_IgnorePointerWhileStatu
super
.
dispose
();
}
void
_handleStatusChange
(
AnimationStatus
_
)
{
final
bool
value
=
widget
.
controller
.
status
!
=
widget
.
status
;
if
(
_
ignoring
!=
value
)
{
void
_handleStatusChange
(
AnimationStatus
status
)
{
final
bool
value
=
widget
.
controller
.
status
=
=
widget
.
status
;
if
(
_
active
!=
value
)
{
setState
(()
{
_
ignoring
=
value
;
_
active
=
value
;
});
}
}
@override
Widget
build
(
BuildContext
context
)
{
return
new
IgnorePointer
(
ignoring:
_ignoring
,
child:
widget
.
child
,
return
new
AbsorbPointer
(
absorbing:
!
_active
,
// Redundant. TODO(xster): remove after https://github.com/flutter/flutter/issues/17179.
child:
new
IgnorePointer
(
ignoring:
!
_active
,
child:
widget
.
child
),
);
}
}
...
...
@@ -103,26 +107,20 @@ class _CrossFadeTransition extends AnimatedWidget {
return
new
Stack
(
alignment:
alignment
,
children:
<
Widget
>[
new
IgnorePointer
(
ignoring:
opacity1
<
1.0
,
child:
new
Opacity
(
opacity:
opacity1
,
child:
new
Semantics
(
scopesRoute:
true
,
explicitChildNodes:
true
,
child:
child1
,
),
new
Opacity
(
opacity:
opacity1
,
child:
new
Semantics
(
scopesRoute:
true
,
explicitChildNodes:
true
,
child:
child1
,
),
),
new
IgnorePointer
(
ignoring:
opacity2
<
1.0
,
child:
new
Opacity
(
opacity:
opacity2
,
child:
new
Semantics
(
scopesRoute:
true
,
explicitChildNodes:
true
,
child:
child0
,
),
new
Opacity
(
opacity:
opacity2
,
child:
new
Semantics
(
scopesRoute:
true
,
explicitChildNodes:
true
,
child:
child0
,
),
),
],
...
...
@@ -291,7 +289,7 @@ class _BackdropState extends State<Backdrop> with SingleTickerProviderStateMixin
),
),
new
Expanded
(
child:
new
_
IgnorePointerWhileStatusIsNot
(
child:
new
_
TappableWhileStatusIs
(
AnimationStatus
.
dismissed
,
controller:
_controller
,
child:
widget
.
backLayer
,
...
...
@@ -316,7 +314,7 @@ class _BackdropState extends State<Backdrop> with SingleTickerProviderStateMixin
child:
child
,
);
},
child:
new
_
IgnorePointerWhileStatusIsNot
(
child:
new
_
TappableWhileStatusIs
(
AnimationStatus
.
completed
,
controller:
_controller
,
child:
new
FadeTransition
(
...
...
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
4e604588
...
...
@@ -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
...
...
packages/flutter/test/widgets/absorb_pointer_test.dart
0 → 100644
View file @
4e604588
// 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
);
});
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment