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
aeb12144
Commit
aeb12144
authored
Jan 16, 2020
by
Anthony
Committed by
Flutter GitHub Bot
Jan 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a separately focusable semantics node for the chip delete icon (#48740)
parent
b04dc46a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
11 deletions
+59
-11
chip.dart
packages/flutter/lib/src/material/chip.dart
+15
-11
chip_test.dart
packages/flutter/test/material/chip_test.dart
+44
-0
No files found.
packages/flutter/lib/src/material/chip.dart
View file @
aeb12144
...
...
@@ -1784,23 +1784,27 @@ class _RawChipState extends State<RawChip> with TickerProviderStateMixin<RawChip
if
(!
hasDeleteButton
)
{
return
null
;
}
return
_wrapWithTooltip
(
widget
.
deleteButtonTooltipMessage
??
MaterialLocalizations
.
of
(
context
)?.
deleteButtonTooltip
,
widget
.
onDeleted
,
GestureDetector
(
key:
deleteIconKey
,
behavior:
HitTestBehavior
.
opaque
,
onTap:
widget
.
isEnabled
return
Semantics
(
container:
true
,
button:
true
,
child:
_wrapWithTooltip
(
widget
.
deleteButtonTooltipMessage
??
MaterialLocalizations
.
of
(
context
)?.
deleteButtonTooltip
,
widget
.
onDeleted
,
GestureDetector
(
key:
deleteIconKey
,
behavior:
HitTestBehavior
.
opaque
,
onTap:
widget
.
isEnabled
?
()
{
Feedback
.
forTap
(
context
);
widget
.
onDeleted
();
}
:
null
,
child:
IconTheme
(
data:
theme
.
iconTheme
.
copyWith
(
color:
widget
.
deleteIconColor
??
chipTheme
.
deleteIconColor
,
child:
IconTheme
(
data:
theme
.
iconTheme
.
copyWith
(
color:
widget
.
deleteIconColor
??
chipTheme
.
deleteIconColor
,
),
child:
widget
.
deleteIcon
,
),
child:
widget
.
deleteIcon
,
),
),
);
...
...
packages/flutter/test/material/chip_test.dart
View file @
aeb12144
...
...
@@ -1630,6 +1630,50 @@ void main() {
semanticsTester
.
dispose
();
});
testWidgets
(
'delete'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semanticsTester
=
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Material
(
child:
RawChip
(
label:
const
Text
(
'test'
),
onDeleted:
()
{
},
),
),
));
expect
(
semanticsTester
,
hasSemantics
(
TestSemantics
.
root
(
children:
<
TestSemantics
>[
TestSemantics
(
textDirection:
TextDirection
.
ltr
,
children:
<
TestSemantics
>[
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
scopesRoute
],
children:
<
TestSemantics
>[
TestSemantics
(
label:
'test'
,
textDirection:
TextDirection
.
ltr
,
children:
<
TestSemantics
>[
TestSemantics
(
label:
'Delete'
,
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
textDirection:
TextDirection
.
ltr
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isButton
,
],
),
],
),
],
),
],
),
],
),
ignoreTransform:
true
,
ignoreId:
true
,
ignoreRect:
true
));
semanticsTester
.
dispose
();
});
testWidgets
(
'with onPressed'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semanticsTester
=
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