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
0e9665e4
Unverified
Commit
0e9665e4
authored
Aug 25, 2021
by
chunhtai
Committed by
GitHub
Aug 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes listview shrinkwrap and hidden semantics node gets updated incorrectly. (#88814)
parent
38186c89
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
3 deletions
+69
-3
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+0
-1
viewport.dart
packages/flutter/lib/src/rendering/viewport.dart
+10
-2
list_view_test.dart
packages/flutter/test/widgets/list_view_test.dart
+59
-0
No files found.
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
0e9665e4
...
...
@@ -5056,7 +5056,6 @@ class RenderIndexedSemantics extends RenderProxyBox {
@override
void
describeSemanticsConfiguration
(
SemanticsConfiguration
config
)
{
super
.
describeSemanticsConfiguration
(
config
);
config
.
isSemanticBoundary
=
true
;
config
.
indexInParent
=
index
;
}
...
...
packages/flutter/lib/src/rendering/viewport.dart
View file @
0e9665e4
...
...
@@ -1920,6 +1920,14 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta
_maxScrollExtent
=
0.0
;
_shrinkWrapExtent
=
0.0
;
_hasVisualOverflow
=
false
;
switch
(
cacheExtentStyle
)
{
case
CacheExtentStyle
.
pixel
:
_calculatedCacheExtent
=
cacheExtent
;
break
;
case
CacheExtentStyle
.
viewport
:
_calculatedCacheExtent
=
mainAxisExtent
*
_cacheExtent
;
break
;
}
return
layoutChildSequence
(
child:
firstChild
,
scrollOffset:
math
.
max
(
0.0
,
correctedOffset
),
...
...
@@ -1930,8 +1938,8 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta
crossAxisExtent:
crossAxisExtent
,
growthDirection:
GrowthDirection
.
forward
,
advance:
childAfter
,
remainingCacheExtent:
mainAxisExtent
+
2
*
_ca
cheExtent
,
cacheOrigin:
-
_ca
cheExtent
,
remainingCacheExtent:
mainAxisExtent
+
2
*
_ca
lculatedCacheExtent
!
,
cacheOrigin:
-
_ca
lculatedCacheExtent
!
,
);
}
...
...
packages/flutter/test/widgets/list_view_test.dart
View file @
0e9665e4
...
...
@@ -310,6 +310,65 @@ void main() {
expect
(
find
.
text
(
'19'
),
findsOneWidget
);
});
testWidgets
(
'ListView with shrink wrap in bounded context correctly uses cache extent'
,
(
WidgetTester
tester
)
async
{
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
SizedBox
(
height:
400
,
child:
ListView
(
itemExtent:
100.0
,
shrinkWrap:
true
,
children:
List
<
Widget
>.
generate
(
20
,
(
int
i
)
{
return
Text
(
'Text
$i
'
);
}),
),
),
),
);
expect
(
tester
.
getSemantics
(
find
.
text
(
'Text 5'
)),
matchesSemantics
(
isHidden:
false
));
expect
(
tester
.
getSemantics
(
find
.
text
(
'Text 6'
,
skipOffstage:
false
)),
matchesSemantics
(
isHidden:
true
));
expect
(
tester
.
getSemantics
(
find
.
text
(
'Text 7'
,
skipOffstage:
false
)),
matchesSemantics
(
isHidden:
true
));
expect
(
tester
.
getSemantics
(
find
.
text
(
'Text 8'
,
skipOffstage:
false
)),
matchesSemantics
(
isHidden:
true
));
handle
.
dispose
();
});
testWidgets
(
'ListView hidden items should stay hidden if their semantics are updated'
,
(
WidgetTester
tester
)
async
{
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
SizedBox
(
height:
400
,
child:
ListView
(
itemExtent:
100.0
,
shrinkWrap:
true
,
children:
List
<
Widget
>.
generate
(
20
,
(
int
i
)
{
return
Text
(
'Text
$i
'
);
}),
),
),
),
);
// Scrollable maybe be marked dirty after layout.
await
tester
.
pumpAndSettle
();
expect
(
tester
.
getSemantics
(
find
.
text
(
'Text 5'
)),
matchesSemantics
(
isHidden:
false
));
expect
(
tester
.
getSemantics
(
find
.
text
(
'Text 6'
,
skipOffstage:
false
)),
matchesSemantics
(
isHidden:
true
));
expect
(
tester
.
getSemantics
(
find
.
text
(
'Text 7'
,
skipOffstage:
false
)),
matchesSemantics
(
isHidden:
true
));
expect
(
tester
.
getSemantics
(
find
.
text
(
'Text 8'
,
skipOffstage:
false
)),
matchesSemantics
(
isHidden:
true
));
// Marks Text 6 semantics as dirty.
final
RenderObject
text6
=
tester
.
renderObject
(
find
.
text
(
'Text 6'
,
skipOffstage:
false
));
text6
.
markNeedsSemanticsUpdate
();
// Verify the semantics is still hidden.
await
tester
.
pump
();
expect
(
tester
.
getSemantics
(
find
.
text
(
'Text 6'
,
skipOffstage:
false
)),
matchesSemantics
(
isHidden:
true
));
handle
.
dispose
();
});
testWidgets
(
'didFinishLayout has correct indices'
,
(
WidgetTester
tester
)
async
{
final
TestSliverChildListDelegate
delegate
=
TestSliverChildListDelegate
(
List
<
Widget
>.
generate
(
...
...
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