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
e9c8e36b
Unverified
Commit
e9c8e36b
authored
Jul 31, 2018
by
Jonah Williams
Committed by
GitHub
Jul 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When dispatching a semantic event, check if the node has been merged with parent (#20020)
parent
63098f2b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
1 deletion
+51
-1
object.dart
packages/flutter/lib/src/rendering/object.dart
+1
-1
switch_test.dart
packages/flutter/test/material/switch_test.dart
+50
-0
No files found.
packages/flutter/lib/src/rendering/object.dart
View file @
e9c8e36b
...
...
@@ -2206,7 +2206,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
void
sendSemanticsEvent
(
SemanticsEvent
semanticsEvent
)
{
if
(
owner
.
semanticsOwner
==
null
)
return
;
if
(
_semantics
!=
null
)
{
if
(
_semantics
!=
null
&&
!
_semantics
.
isMergedIntoParent
)
{
_semantics
.
sendEvent
(
semanticsEvent
);
}
else
if
(
parent
!=
null
)
{
final
RenderObject
renderParent
=
parent
;
...
...
packages/flutter/test/material/switch_test.dart
View file @
e9c8e36b
...
...
@@ -314,4 +314,54 @@ void main() {
semanticsTester
.
dispose
();
SystemChannels
.
accessibility
.
setMockMessageHandler
(
null
);
});
testWidgets
(
'switch sends semantic events from parent if fully merged'
,
(
WidgetTester
tester
)
async
{
dynamic
semanticEvent
;
bool
value
=
false
;
SystemChannels
.
accessibility
.
setMockMessageHandler
((
dynamic
message
)
{
semanticEvent
=
message
;
});
final
SemanticsTester
semanticsTester
=
new
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
new
MaterialApp
(
home:
new
StatefulBuilder
(
builder:
(
BuildContext
context
,
StateSetter
setState
)
{
void
onChanged
(
bool
newValue
)
{
setState
(()
{
value
=
newValue
;
});
}
return
new
Material
(
child:
new
MergeSemantics
(
child:
new
ListTile
(
leading:
const
Text
(
'test'
),
onTap:
()
{
onChanged
(!
value
);
},
trailing:
new
Switch
(
value:
value
,
onChanged:
onChanged
,
),
),
),
);
},
),
),
);
await
tester
.
tap
(
find
.
byType
(
MergeSemantics
));
final
RenderObject
object
=
tester
.
firstRenderObject
(
find
.
byType
(
MergeSemantics
));
expect
(
value
,
true
);
expect
(
semanticEvent
,
<
String
,
dynamic
>{
'type'
:
'tap'
,
'nodeId'
:
object
.
debugSemantics
.
id
,
'data'
:
<
String
,
dynamic
>{},
});
expect
(
object
.
debugSemantics
.
getSemanticsData
().
hasAction
(
SemanticsAction
.
tap
),
true
);
semanticsTester
.
dispose
();
SystemChannels
.
accessibility
.
setMockMessageHandler
(
null
);
});
}
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