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
d61b4fae
Unverified
Commit
d61b4fae
authored
Jul 23, 2018
by
Jonah Williams
Committed by
GitHub
Jul 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ignoringSemantics argument to AbsorbPointer (#19651)
parent
b4d3808a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
110 additions
and
6 deletions
+110
-6
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+44
-2
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+26
-3
absorb_pointer_test.dart
packages/flutter/test/widgets/absorb_pointer_test.dart
+40
-1
No files found.
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
d61b4fae
...
...
@@ -2881,8 +2881,11 @@ class RenderAbsorbPointer extends RenderProxyBox {
/// The [absorbing] argument must not be null.
RenderAbsorbPointer
({
RenderBox
child
,
this
.
absorbing
=
true
bool
absorbing
=
true
,
bool
ignoringSemantics
,
})
:
assert
(
absorbing
!=
null
),
_absorbing
=
absorbing
,
_ignoringSemantics
=
ignoringSemantics
,
super
(
child
);
/// Whether this render object absorbs pointers during hit testing.
...
...
@@ -2890,7 +2893,33 @@ class RenderAbsorbPointer extends RenderProxyBox {
/// Regardless of whether this render object absorbs pointers during hit
/// testing, it will still consume space during layout and be visible during
/// painting.
bool
absorbing
;
bool
get
absorbing
=>
_absorbing
;
bool
_absorbing
;
set
absorbing
(
bool
value
)
{
if
(
_absorbing
==
value
)
return
;
_absorbing
=
value
;
if
(
ignoringSemantics
==
null
)
markNeedsSemanticsUpdate
();
}
/// Whether the semantics of this render object is ignored when compiling the semantics tree.
///
/// If null, defaults to value of [absorbing].
///
/// See [SemanticsNode] for additional information about the semantics tree.
bool
get
ignoringSemantics
=>
_ignoringSemantics
;
bool
_ignoringSemantics
;
set
ignoringSemantics
(
bool
value
)
{
if
(
value
==
_ignoringSemantics
)
return
;
final
bool
oldEffectiveValue
=
_effectiveIgnoringSemantics
;
_ignoringSemantics
=
value
;
if
(
oldEffectiveValue
!=
_effectiveIgnoringSemantics
)
markNeedsSemanticsUpdate
();
}
bool
get
_effectiveIgnoringSemantics
=>
ignoringSemantics
==
null
?
absorbing
:
ignoringSemantics
;
@override
bool
hitTest
(
HitTestResult
result
,
{
Offset
position
})
{
...
...
@@ -2899,10 +2928,23 @@ class RenderAbsorbPointer extends RenderProxyBox {
:
super
.
hitTest
(
result
,
position:
position
);
}
@override
void
visitChildrenForSemantics
(
RenderObjectVisitor
visitor
)
{
if
(
child
!=
null
&&
!
_effectiveIgnoringSemantics
)
visitor
(
child
);
}
@override
void
debugFillProperties
(
DiagnosticPropertiesBuilder
properties
)
{
super
.
debugFillProperties
(
properties
);
properties
.
add
(
new
DiagnosticsProperty
<
bool
>(
'absorbing'
,
absorbing
));
properties
.
add
(
new
DiagnosticsProperty
<
bool
>(
'ignoringSemantics'
,
_effectiveIgnoringSemantics
,
description:
ignoringSemantics
==
null
?
'implicitly
$_effectiveIgnoringSemantics
'
:
null
,
),
);
}
}
...
...
packages/flutter/lib/src/widgets/basic.dart
View file @
d61b4fae
...
...
@@ -4949,7 +4949,8 @@ class AbsorbPointer extends SingleChildRenderObjectWidget {
const
AbsorbPointer
({
Key
key
,
this
.
absorbing
=
true
,
Widget
child
Widget
child
,
this
.
ignoringSemantics
,
})
:
assert
(
absorbing
!=
null
),
super
(
key:
key
,
child:
child
);
...
...
@@ -4960,12 +4961,34 @@ class AbsorbPointer extends SingleChildRenderObjectWidget {
/// painting.
final
bool
absorbing
;
/// Whether the semantics of this render object is ignored when compiling the
/// semantics tree.
///
/// If null, defaults to the value of [absorbing].
///
/// See [SemanticsNode] for additional information about the semantics tree.
final
bool
ignoringSemantics
;
@override
RenderAbsorbPointer
createRenderObject
(
BuildContext
context
)
=>
new
RenderAbsorbPointer
(
absorbing:
absorbing
);
RenderAbsorbPointer
createRenderObject
(
BuildContext
context
)
{
return
new
RenderAbsorbPointer
(
absorbing:
absorbing
,
ignoringSemantics:
ignoringSemantics
,
);
}
@override
void
updateRenderObject
(
BuildContext
context
,
RenderAbsorbPointer
renderObject
)
{
renderObject
.
absorbing
=
absorbing
;
renderObject
..
absorbing
=
absorbing
..
ignoringSemantics
=
ignoringSemantics
;
}
@override
void
debugFillProperties
(
DiagnosticPropertiesBuilder
properties
)
{
super
.
debugFillProperties
(
properties
);
properties
.
add
(
new
DiagnosticsProperty
<
bool
>(
'absorbing'
,
absorbing
));
properties
.
add
(
new
DiagnosticsProperty
<
bool
>(
'ignoringSemantics'
,
ignoringSemantics
,
defaultValue:
null
));
}
}
...
...
packages/flutter/test/widgets/absorb_pointer_test.dart
View file @
d61b4fae
...
...
@@ -5,6 +5,8 @@
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/widgets.dart'
;
import
'semantics_tester.dart'
;
void
main
(
)
{
testWidgets
(
'AbsorbPointers do not block siblings'
,
(
WidgetTester
tester
)
async
{
bool
tapped
=
false
;
...
...
@@ -28,4 +30,41 @@ void main() {
await
tester
.
tap
(
find
.
byType
(
GestureDetector
));
expect
(
tapped
,
true
);
});
}
\ No newline at end of file
testWidgets
(
'AbsorbPointers semantics'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
new
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
new
AbsorbPointer
(
absorbing:
true
,
child:
new
Semantics
(
label:
'test'
,
textDirection:
TextDirection
.
ltr
,
),
),
);
expect
(
semantics
,
hasSemantics
(
new
TestSemantics
.
root
(),
ignoreId:
true
,
ignoreRect:
true
,
ignoreTransform:
true
));
await
tester
.
pumpWidget
(
new
AbsorbPointer
(
absorbing:
false
,
child:
new
Semantics
(
label:
'test'
,
textDirection:
TextDirection
.
ltr
,
),
),
);
expect
(
semantics
,
hasSemantics
(
new
TestSemantics
.
root
(
children:
<
TestSemantics
>[
new
TestSemantics
.
rootChild
(
label:
'test'
,
textDirection:
TextDirection
.
ltr
,
),
],
),
ignoreId:
true
,
ignoreRect:
true
,
ignoreTransform:
true
));
semantics
.
dispose
();
});
}
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