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
7b90bdc9
Commit
7b90bdc9
authored
Jul 11, 2017
by
Michael Goderbauer
Committed by
GitHub
Jul 11, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make DropDown accessible (#11149)
parent
792c9875
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
0 deletions
+50
-0
stack.dart
packages/flutter/lib/src/rendering/stack.dart
+6
-0
dropdown_test.dart
packages/flutter/test/material/dropdown_test.dart
+14
-0
stack_test.dart
packages/flutter/test/rendering/stack_test.dart
+30
-0
No files found.
packages/flutter/lib/src/rendering/stack.dart
View file @
7b90bdc9
...
...
@@ -550,6 +550,12 @@ class RenderIndexedStack extends RenderStack {
alignment:
alignment
);
@override
void
visitChildrenForSemantics
(
RenderObjectVisitor
visitor
)
{
if
(
index
!=
null
)
visitor
(
_childAtIndex
());
}
/// The index of the child to show, null if nothing is to be displayed.
int
get
index
=>
_index
;
int
_index
;
...
...
packages/flutter/test/material/dropdown_test.dart
View file @
7b90bdc9
...
...
@@ -8,6 +8,8 @@ import 'dart:ui' show window;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/material.dart'
;
import
'../widgets/semantics_tester.dart'
;
const
List
<
String
>
menuItems
=
const
<
String
>[
'one'
,
'two'
,
'three'
,
'four'
];
final
Type
dropdownButtonType
=
new
DropdownButton
<
String
>(
...
...
@@ -476,4 +478,16 @@ void main() {
expect
(
find
.
byType
(
ListView
,
skipOffstage:
false
),
findsNothing
);
});
testWidgets
(
'Semantics Tree contains only selected element'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
new
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
buildFrame
(
items:
menuItems
));
expect
(
semantics
,
isNot
(
includesNodeWith
(
label:
menuItems
[
0
])));
expect
(
semantics
,
includesNodeWith
(
label:
menuItems
[
1
]));
expect
(
semantics
,
isNot
(
includesNodeWith
(
label:
menuItems
[
2
])));
expect
(
semantics
,
isNot
(
includesNodeWith
(
label:
menuItems
[
3
])));
semantics
.
dispose
();
});
}
packages/flutter/test/rendering/stack_test.dart
View file @
7b90bdc9
...
...
@@ -46,5 +46,35 @@ void main() {
expect
(
green
.
size
.
height
,
equals
(
100.0
));
});
group
(
'RenderIndexedStack'
,
()
{
test
(
'visitChildrenForSemantics only visits displayed child'
,
()
{
final
RenderBox
child1
=
new
RenderConstrainedBox
(
additionalConstraints:
new
BoxConstraints
.
tight
(
const
Size
(
100.0
,
100.0
))
);
final
RenderBox
child2
=
new
RenderConstrainedBox
(
additionalConstraints:
new
BoxConstraints
.
tight
(
const
Size
(
100.0
,
100.0
))
);
final
RenderBox
child3
=
new
RenderConstrainedBox
(
additionalConstraints:
new
BoxConstraints
.
tight
(
const
Size
(
100.0
,
100.0
))
);
final
RenderBox
stack
=
new
RenderIndexedStack
(
children:
<
RenderBox
>[
child1
,
child2
,
child3
],
index:
1
,
);
final
List
<
RenderObject
>
vistedChildren
=
<
RenderObject
>[];
final
RenderObjectVisitor
visitor
=
(
RenderObject
child
)
{
vistedChildren
.
add
(
child
);
};
stack
.
visitChildrenForSemantics
(
visitor
);
expect
(
vistedChildren
,
hasLength
(
1
));
expect
(
vistedChildren
.
first
,
child2
);
});
});
// More tests in ../widgets/stack_test.dart
}
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