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
3f173357
Unverified
Commit
3f173357
authored
Jul 08, 2022
by
Dan Field
Committed by
GitHub
Jul 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reland"Make RenderSliverGrid more accurately report overflow" (#107329)
parent
f614c597
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
5 deletions
+54
-5
sliver_grid.dart
packages/flutter/lib/src/rendering/sliver_grid.dart
+1
-3
grid_view_test.dart
packages/flutter/test/widgets/grid_view_test.dart
+53
-2
No files found.
packages/flutter/lib/src/rendering/sliver_grid.dart
View file @
3f173357
...
...
@@ -658,7 +658,6 @@ class RenderSliverGrid extends RenderSliverMultiBoxAdaptor {
leadingScrollOffset:
leadingScrollOffset
,
trailingScrollOffset:
trailingScrollOffset
,
);
final
double
paintExtent
=
calculatePaintOffset
(
constraints
,
from:
math
.
min
(
constraints
.
scrollOffset
,
leadingScrollOffset
),
...
...
@@ -675,8 +674,7 @@ class RenderSliverGrid extends RenderSliverMultiBoxAdaptor {
paintExtent:
paintExtent
,
maxPaintExtent:
estimatedTotalExtent
,
cacheExtent:
cacheExtent
,
// Conservative to avoid complexity.
hasVisualOverflow:
true
,
hasVisualOverflow:
estimatedTotalExtent
>
paintExtent
||
constraints
.
scrollOffset
>
0.0
||
constraints
.
overlap
!=
0.0
,
);
// We may have started the layout while scrolled to the end, which
...
...
packages/flutter/test/widgets/grid_view_test.dart
View file @
3f173357
...
...
@@ -645,13 +645,50 @@ void main() {
expect
(
counters
[
4
],
2
);
});
testWidgets
(
'GridView does not report visual overflow unnecessarily'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
GridView
(
gridDelegate:
const
SliverGridDelegateWithFixedCrossAxisCount
(
crossAxisCount:
3
),
children:
<
Widget
>[
Container
(
height:
200.0
),
],
),
),
);
// 1st, check that the render object has received the default clip behavior.
final
RenderViewport
renderObject
=
tester
.
allRenderObjects
.
whereType
<
RenderViewport
>().
first
;
expect
(
renderObject
.
clipBehavior
,
equals
(
Clip
.
hardEdge
));
// The context will get Clip.none because there is no actual visual overflow.
final
TestClipPaintingContext
context
=
TestClipPaintingContext
();
renderObject
.
paint
(
context
,
Offset
.
zero
);
expect
(
context
.
clipBehavior
,
equals
(
Clip
.
none
));
});
testWidgets
(
'GridView respects clipBehavior'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
GridView
(
gridDelegate:
const
SliverGridDelegateWithFixedCrossAxisCount
(
crossAxisCount:
3
),
children:
<
Widget
>[
Container
(
height:
2000.0
)],
children:
<
Widget
>[
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
],
),
),
);
...
...
@@ -672,7 +709,21 @@ void main() {
child:
GridView
(
gridDelegate:
const
SliverGridDelegateWithFixedCrossAxisCount
(
crossAxisCount:
3
),
clipBehavior:
Clip
.
antiAlias
,
children:
<
Widget
>[
Container
(
height:
2000.0
)],
children:
<
Widget
>[
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
Container
(
height:
2000.0
),
],
),
),
);
...
...
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