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
7a73ddf5
Commit
7a73ddf5
authored
Oct 04, 2017
by
Michael Goderbauer
Committed by
GitHub
Oct 04, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make TabBarView/PageView accessible (#12386)
* Make TabBarView/PageView accessible * review fedback
parent
517315de
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
10 deletions
+51
-10
sliver_multi_box_adaptor.dart
...s/flutter/lib/src/rendering/sliver_multi_box_adaptor.dart
+10
-10
page_view_test.dart
packages/flutter/test/widgets/page_view_test.dart
+41
-0
No files found.
packages/flutter/lib/src/rendering/sliver_multi_box_adaptor.dart
View file @
7a73ddf5
...
...
@@ -290,25 +290,25 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
switch
(
constraints
.
normalizedGrowthDirection
)
{
case
GrowthDirection
.
forward
:
super
.
visitChildrenForSemantics
((
RenderObject
child
)
{
// The sliver is overlapped at the leading edge.
final
Offset
bottom
Lef
tInViewport
=
MatrixUtils
.
transformPoint
(
child
.
getTransformTo
(
parent
),
child
.
semanticBounds
.
bottom
Lef
t
// The sliver is overlapped at the leading edge
; check if trailing edge is visible
.
final
Offset
bottom
Righ
tInViewport
=
MatrixUtils
.
transformPoint
(
child
.
getTransformTo
(
parent
),
child
.
semanticBounds
.
bottom
Righ
t
);
final
double
endOverlap
=
constraints
.
overlap
;
if
((
constraints
.
axis
==
Axis
.
vertical
&&
bottom
Lef
tInViewport
.
dy
>
endOverlap
)
||
(
constraints
.
axis
==
Axis
.
horizontal
&&
bottom
Lef
tInViewport
.
dx
>
endOverlap
))
if
((
constraints
.
axis
==
Axis
.
vertical
&&
bottom
Righ
tInViewport
.
dy
>
endOverlap
)
||
(
constraints
.
axis
==
Axis
.
horizontal
&&
bottom
Righ
tInViewport
.
dx
>
endOverlap
))
visitor
(
child
);
});
break
;
case
GrowthDirection
.
reverse
:
super
.
visitChildrenForSemantics
((
RenderObject
child
)
{
// The sliver is overlapped at the trailing edge.
final
Offset
top
Righ
tInViewport
=
MatrixUtils
.
transformPoint
(
child
.
getTransformTo
(
parent
),
child
.
semanticBounds
.
top
Righ
t
// The sliver is overlapped at the trailing edge
; check if leading edge is visible
.
final
Offset
top
Lef
tInViewport
=
MatrixUtils
.
transformPoint
(
child
.
getTransformTo
(
parent
),
child
.
semanticBounds
.
top
Lef
t
);
final
double
startOverlap
=
constraints
.
remainingPaintExtent
-
constraints
.
overlap
;
if
((
constraints
.
axis
==
Axis
.
vertical
&&
top
Righ
tInViewport
.
dy
<
startOverlap
)
||
(
constraints
.
axis
==
Axis
.
horizontal
&&
top
Righ
tInViewport
.
dx
<
startOverlap
))
if
((
constraints
.
axis
==
Axis
.
vertical
&&
top
Lef
tInViewport
.
dy
<
startOverlap
)
||
(
constraints
.
axis
==
Axis
.
horizontal
&&
top
Lef
tInViewport
.
dx
<
startOverlap
))
visitor
(
child
);
});
break
;
...
...
packages/flutter/test/widgets/page_view_test.dart
View file @
7a73ddf5
...
...
@@ -4,8 +4,10 @@
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/widgets.dart'
;
import
'semantics_tester.dart'
;
import
'states.dart'
;
const
Duration
_frameDuration
=
const
Duration
(
milliseconds:
100
);
...
...
@@ -505,4 +507,43 @@ void main() {
));
expect
(
controller2
.
page
,
0
);
});
testWidgets
(
'PageView exposes semantics of children'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
new
SemanticsTester
(
tester
);
final
PageController
controller
=
new
PageController
();
await
tester
.
pumpWidget
(
new
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
new
PageView
(
controller:
controller
,
children:
new
List
<
Widget
>.
generate
(
3
,
(
int
i
)
{
return
new
Semantics
(
child:
new
Text
(
'Page #
$i
'
),
container:
true
,
);
})
),
));
expect
(
controller
.
page
,
0
);
expect
(
semantics
,
includesNodeWith
(
label:
'Page #0'
));
expect
(
semantics
,
isNot
(
includesNodeWith
(
label:
'Page #1'
)));
expect
(
semantics
,
isNot
(
includesNodeWith
(
label:
'Page #2'
)));
controller
.
jumpToPage
(
1
);
await
tester
.
pumpAndSettle
();
expect
(
semantics
,
isNot
(
includesNodeWith
(
label:
'Page #0'
)));
expect
(
semantics
,
includesNodeWith
(
label:
'Page #1'
));
expect
(
semantics
,
isNot
(
includesNodeWith
(
label:
'Page #2'
)));
controller
.
jumpToPage
(
2
);
await
tester
.
pumpAndSettle
();
expect
(
semantics
,
isNot
(
includesNodeWith
(
label:
'Page #0'
)));
expect
(
semantics
,
isNot
(
includesNodeWith
(
label:
'Page #1'
)));
expect
(
semantics
,
includesNodeWith
(
label:
'Page #2'
));
semantics
.
dispose
();
});
}
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