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
995b3324
Unverified
Commit
995b3324
authored
Jun 16, 2022
by
Dan Field
Committed by
GitHub
Jun 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Make RenderSliverGrid more accurately report overflow" (#106123)
parent
ede7fc67
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
54 deletions
+5
-54
sliver_grid.dart
packages/flutter/lib/src/rendering/sliver_grid.dart
+3
-1
grid_view_test.dart
packages/flutter/test/widgets/grid_view_test.dart
+2
-53
No files found.
packages/flutter/lib/src/rendering/sliver_grid.dart
View file @
995b3324
...
...
@@ -658,6 +658,7 @@ class RenderSliverGrid extends RenderSliverMultiBoxAdaptor {
leadingScrollOffset:
leadingScrollOffset
,
trailingScrollOffset:
trailingScrollOffset
,
);
final
double
paintExtent
=
calculatePaintOffset
(
constraints
,
from:
math
.
min
(
constraints
.
scrollOffset
,
leadingScrollOffset
),
...
...
@@ -674,7 +675,8 @@ class RenderSliverGrid extends RenderSliverMultiBoxAdaptor {
paintExtent:
paintExtent
,
maxPaintExtent:
estimatedTotalExtent
,
cacheExtent:
cacheExtent
,
hasVisualOverflow:
estimatedTotalExtent
>
paintExtent
||
constraints
.
scrollOffset
>
0.0
||
constraints
.
overlap
!=
0.0
,
// Conservative to avoid complexity.
hasVisualOverflow:
true
,
);
// We may have started the layout while scrolled to the end, which
...
...
packages/flutter/test/widgets/grid_view_test.dart
View file @
995b3324
...
...
@@ -645,50 +645,13 @@ 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
),
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
),
],
children:
<
Widget
>[
Container
(
height:
2000.0
)],
),
),
);
...
...
@@ -709,21 +672,7 @@ void main() {
child:
GridView
(
gridDelegate:
const
SliverGridDelegateWithFixedCrossAxisCount
(
crossAxisCount:
3
),
clipBehavior:
Clip
.
antiAlias
,
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
),
],
children:
<
Widget
>[
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