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
b2c73754
Unverified
Commit
b2c73754
authored
Jul 28, 2020
by
chunhtai
Committed by
GitHub
Jul 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
makes PopupMenuitem merge the semantics of its child (#62062)
parent
fe88a88a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
95 additions
and
9 deletions
+95
-9
popup_menu.dart
packages/flutter/lib/src/material/popup_menu.dart
+11
-9
popup_menu_test.dart
packages/flutter/test/material/popup_menu_test.dart
+84
-0
No files found.
packages/flutter/lib/src/material/popup_menu.dart
View file @
b2c73754
...
...
@@ -342,7 +342,8 @@ class PopupMenuItemState<T, W extends PopupMenuItem<T>> extends State<W> {
},
);
return
Semantics
(
return
MergeSemantics
(
child:
Semantics
(
enabled:
widget
.
enabled
,
button:
true
,
child:
InkWell
(
...
...
@@ -351,6 +352,7 @@ class PopupMenuItemState<T, W extends PopupMenuItem<T>> extends State<W> {
mouseCursor:
effectiveMouseCursor
,
child:
item
,
),
)
);
}
}
...
...
packages/flutter/test/material/popup_menu_test.dart
View file @
b2c73754
...
...
@@ -836,6 +836,90 @@ void main() {
semantics
.
dispose
();
});
testWidgets
(
'PopupMenuItem merges the semantics of its descendants'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Material
(
child:
PopupMenuButton
<
int
>(
itemBuilder:
(
BuildContext
context
)
{
return
<
PopupMenuItem
<
int
>>[
PopupMenuItem
<
int
>(
value:
1
,
child:
Row
(
children:
<
Widget
>[
Semantics
(
child:
const
Text
(
'test1'
),
),
Semantics
(
child:
const
Text
(
'test2'
),
),
],
),
),
];
},
child:
const
SizedBox
(
height:
100.0
,
width:
100.0
,
child:
Text
(
'XXX'
),
),
),
),
),
);
await
tester
.
tap
(
find
.
text
(
'XXX'
));
await
tester
.
pumpAndSettle
();
expect
(
semantics
,
hasSemantics
(
TestSemantics
.
root
(
children:
<
TestSemantics
>[
TestSemantics
(
textDirection:
TextDirection
.
ltr
,
children:
<
TestSemantics
>[
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
scopesRoute
,
SemanticsFlag
.
namesRoute
,
],
label:
'Popup menu'
,
textDirection:
TextDirection
.
ltr
,
children:
<
TestSemantics
>[
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasImplicitScrolling
,
],
children:
<
TestSemantics
>[
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isButton
,
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isEnabled
,
SemanticsFlag
.
isFocusable
,
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
'test1
\n
test2'
,
textDirection:
TextDirection
.
ltr
,
),
],
),
],
),
],
),
TestSemantics
(),
],
),
],
),
ignoreId:
true
,
ignoreTransform:
true
,
ignoreRect:
true
,
));
semantics
.
dispose
();
});
testWidgets
(
'disabled PopupMenuItem has correct semantics'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/45044.
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
...
...
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