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
f26fbb6b
Unverified
Commit
f26fbb6b
authored
Oct 19, 2020
by
Xavier Chrétien
Committed by
GitHub
Oct 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set slider semantics flag for sliders (#68019)
parent
804c3ff3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
24 additions
and
5 deletions
+24
-5
slider.dart
packages/flutter/lib/src/cupertino/slider.dart
+1
-0
range_slider.dart
packages/flutter/lib/src/material/range_slider.dart
+1
-0
slider.dart
packages/flutter/lib/src/material/slider.dart
+1
-0
slider_test.dart
packages/flutter/test/cupertino/slider_test.dart
+11
-1
range_slider_test.dart
packages/flutter/test/material/range_slider_test.dart
+2
-0
slider_test.dart
packages/flutter/test/material/slider_test.dart
+6
-4
matchers.dart
packages/flutter_test/lib/src/matchers.dart
+2
-0
No files found.
packages/flutter/lib/src/cupertino/slider.dart
View file @
f26fbb6b
...
...
@@ -548,6 +548,7 @@ class _RenderCupertinoSlider extends RenderConstrainedBox {
super
.
describeSemanticsConfiguration
(
config
);
config
.
isSemanticBoundary
=
isInteractive
;
config
.
isSlider
=
true
;
if
(
isInteractive
)
{
config
.
textDirection
=
textDirection
;
config
.
onIncrease
=
_increaseAction
;
...
...
packages/flutter/lib/src/material/range_slider.dart
View file @
f26fbb6b
...
...
@@ -1529,6 +1529,7 @@ class _RenderRangeSlider extends RenderBox with RelayoutWhenSystemFontsChangeMix
final
SemanticsConfiguration
config
=
SemanticsConfiguration
();
config
.
isEnabled
=
isEnabled
;
config
.
textDirection
=
textDirection
;
config
.
isSlider
=
true
;
if
(
isEnabled
)
{
config
.
onIncrease
=
increaseAction
;
config
.
onDecrease
=
decreaseAction
;
...
...
packages/flutter/lib/src/material/slider.dart
View file @
f26fbb6b
...
...
@@ -707,6 +707,7 @@ class _SliderState extends State<Slider> with TickerProviderStateMixin {
return
Semantics
(
container:
true
,
slider:
true
,
child:
FocusableActionDetector
(
actions:
_actionMap
,
shortcuts:
_shortcutMap
,
...
...
packages/flutter/test/cupertino/slider_test.dart
View file @
f26fbb6b
...
...
@@ -318,6 +318,7 @@ void main() {
increasedValue:
'60%'
,
decreasedValue:
'40%'
,
textDirection:
TextDirection
.
ltr
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isSlider
],
actions:
SemanticsAction
.
decrease
.
index
|
SemanticsAction
.
increase
.
index
,
),
],
...
...
@@ -341,7 +342,14 @@ void main() {
);
expect
(
semantics
,
hasSemantics
(
TestSemantics
.
root
(),
TestSemantics
.
root
(
children:
<
TestSemantics
>[
TestSemantics
(
id:
1
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isSlider
],
)
],
),
ignoreRect:
true
,
ignoreTransform:
true
,
));
...
...
@@ -365,6 +373,7 @@ void main() {
);
expect
(
tester
.
getSemantics
(
find
.
byType
(
CupertinoSlider
)),
matchesSemantics
(
isSlider:
true
,
hasIncreaseAction:
true
,
hasDecreaseAction:
true
,
value:
'50%'
,
...
...
@@ -387,6 +396,7 @@ void main() {
);
expect
(
tester
.
getSemantics
(
find
.
byType
(
CupertinoSlider
)),
matchesSemantics
(
isSlider:
true
,
hasIncreaseAction:
true
,
hasDecreaseAction:
true
,
value:
'60%'
,
...
...
packages/flutter/test/material/range_slider_test.dart
View file @
f26fbb6b
...
...
@@ -1775,6 +1775,7 @@ void main() {
children:
<
Matcher
>[
matchesSemantics
(
isEnabled:
true
,
isSlider:
true
,
hasEnabledState:
true
,
hasIncreaseAction:
true
,
hasDecreaseAction:
true
,
...
...
@@ -1784,6 +1785,7 @@ void main() {
),
matchesSemantics
(
isEnabled:
true
,
isSlider:
true
,
hasEnabledState:
true
,
hasIncreaseAction:
true
,
hasDecreaseAction:
true
,
...
...
packages/flutter/test/material/slider_test.dart
View file @
f26fbb6b
...
...
@@ -1345,7 +1345,7 @@ void main() {
children:
<
TestSemantics
>[
TestSemantics
(
id:
4
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isEnabled
,
SemanticsFlag
.
isFocusable
],
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isEnabled
,
SemanticsFlag
.
isFocusable
,
SemanticsFlag
.
isSlider
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
increase
,
SemanticsAction
.
decrease
],
value:
'50%'
,
increasedValue:
'55%'
,
...
...
@@ -1403,6 +1403,7 @@ void main() {
SemanticsFlag
.
hasEnabledState
,
// isFocusable is delayed by 1 frame.
SemanticsFlag
.
isFocusable
,
SemanticsFlag
.
isSlider
,
],
value:
'50%'
,
increasedValue:
'55%'
,
...
...
@@ -1443,6 +1444,7 @@ void main() {
id:
4
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isSlider
,
],
value:
'50%'
,
increasedValue:
'55%'
,
...
...
@@ -1508,7 +1510,7 @@ void main() {
children:
<
TestSemantics
>[
TestSemantics
(
id:
4
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isEnabled
,
SemanticsFlag
.
isFocusable
],
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isEnabled
,
SemanticsFlag
.
isFocusable
,
SemanticsFlag
.
isSlider
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
increase
,
SemanticsAction
.
decrease
],
value:
'50%'
,
increasedValue:
'60%'
,
...
...
@@ -1562,7 +1564,7 @@ void main() {
children:
<
TestSemantics
>[
TestSemantics
(
id:
5
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasEnabledState
],
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isSlider
],
value:
'50%'
,
increasedValue:
'60%'
,
decreasedValue:
'40%'
,
...
...
@@ -1623,7 +1625,7 @@ void main() {
children:
<
TestSemantics
>[
TestSemantics
(
id:
4
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isEnabled
,
SemanticsFlag
.
isFocusable
],
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isEnabled
,
SemanticsFlag
.
isFocusable
,
SemanticsFlag
.
isSlider
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
increase
,
SemanticsAction
.
decrease
],
value:
'40'
,
increasedValue:
'60'
,
...
...
packages/flutter_test/lib/src/matchers.dart
View file @
f26fbb6b
...
...
@@ -468,6 +468,7 @@ Matcher matchesSemantics({
bool
hasToggledState
=
false
,
bool
isToggled
=
false
,
bool
hasImplicitScrolling
=
false
,
bool
isSlider
=
false
,
// Actions //
bool
hasTapAction
=
false
,
bool
hasLongPressAction
=
false
,
...
...
@@ -519,6 +520,7 @@ Matcher matchesSemantics({
if
(
hasToggledState
)
SemanticsFlag
.
hasToggledState
,
if
(
isToggled
)
SemanticsFlag
.
isToggled
,
if
(
hasImplicitScrolling
)
SemanticsFlag
.
hasImplicitScrolling
,
if
(
isSlider
)
SemanticsFlag
.
isSlider
];
final
List
<
SemanticsAction
>
actions
=
<
SemanticsAction
>[
...
...
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