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
19f8fb1c
Unverified
Commit
19f8fb1c
authored
Jul 31, 2020
by
Nolan Scobie
Committed by
GitHub
Jul 31, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix SemanticsNode.rect position for nested scrollables with useTwoPaneSemantics (#62359)
parent
8d58c99e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
1 deletion
+56
-1
scrollable.dart
packages/flutter/lib/src/widgets/scrollable.dart
+1
-1
scrollable_semantics_test.dart
packages/flutter/test/widgets/scrollable_semantics_test.dart
+55
-0
No files found.
packages/flutter/lib/src/widgets/scrollable.dart
View file @
19f8fb1c
...
...
@@ -784,7 +784,7 @@ class _RenderScrollSemantics extends RenderProxyBox {
_innerNode
??=
SemanticsNode
(
showOnScreen:
showOnScreen
);
_innerNode
..
isMergedIntoParent
=
node
.
isPartOfNodeMerging
..
rect
=
Offset
.
zero
&
node
.
rect
.
size
;
..
rect
=
node
.
rect
;
int
firstVisibleIndex
;
final
List
<
SemanticsNode
>
excluded
=
<
SemanticsNode
>[
_innerNode
];
...
...
packages/flutter/test/widgets/scrollable_semantics_test.dart
View file @
19f8fb1c
...
...
@@ -593,7 +593,52 @@ void main() {
});
testWidgets
(
'transform of inner node from useTwoPaneSemantics scrolls correctly with nested scrollables'
,
(
WidgetTester
tester
)
async
{
semantics
=
SemanticsTester
(
tester
);
// enables semantics tree generation
// Context: https://github.com/flutter/flutter/issues/61631
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
SingleChildScrollView
(
child:
ListView
(
shrinkWrap:
true
,
children:
<
Widget
>[
for
(
int
i
=
0
;
i
<
50
;
++
i
)
Text
(
'
$i
'
),
],
),
),
),
);
final
SemanticsNode
rootScrollNode
=
semantics
.
nodesWith
(
actions:
<
SemanticsAction
>[
SemanticsAction
.
scrollUp
]).
single
;
final
SemanticsNode
innerListPane
=
semantics
.
nodesWith
(
ancestor:
rootScrollNode
,
scrollExtentMax:
0
).
single
;
final
SemanticsNode
outerListPane
=
innerListPane
.
parent
;
final
List
<
SemanticsNode
>
hiddenNodes
=
semantics
.
nodesWith
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isHidden
]).
toList
();
// This test is only valid if some children are offscreen.
// Increase the number of Text children if this assert fails.
assert
(
hiddenNodes
.
length
>=
3
);
// Scroll to end -> beginning -> middle to test both directions.
final
List
<
SemanticsNode
>
targetNodes
=
<
SemanticsNode
>[
hiddenNodes
.
last
,
hiddenNodes
.
first
,
hiddenNodes
[
hiddenNodes
.
length
~/
2
],
];
expect
(
nodeGlobalRect
(
innerListPane
),
nodeGlobalRect
(
outerListPane
));
for
(
final
SemanticsNode
node
in
targetNodes
)
{
tester
.
binding
.
pipelineOwner
.
semanticsOwner
.
performAction
(
node
.
id
,
SemanticsAction
.
showOnScreen
);
await
tester
.
pumpAndSettle
();
expect
(
nodeGlobalRect
(
innerListPane
),
nodeGlobalRect
(
outerListPane
));
}
semantics
.
dispose
();
});
}
Future
<
void
>
flingUp
(
WidgetTester
tester
,
{
int
repetitions
=
1
})
=>
fling
(
tester
,
const
Offset
(
0.0
,
-
200.0
),
repetitions
);
...
...
@@ -611,3 +656,13 @@ Future<void> fling(WidgetTester tester, Offset offset, int repetitions) async {
await
tester
.
pump
(
const
Duration
(
seconds:
5
));
}
}
Rect
nodeGlobalRect
(
SemanticsNode
node
)
{
Matrix4
globalTransform
=
node
.
transform
??
Matrix4
.
identity
();
for
(
SemanticsNode
parent
=
node
.
parent
;
parent
!=
null
;
parent
=
parent
.
parent
)
{
if
(
parent
.
transform
!=
null
)
{
globalTransform
=
parent
.
transform
.
multiplied
(
globalTransform
);
}
}
return
MatrixUtils
.
transformRect
(
globalTransform
,
node
.
rect
);
}
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