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
13fe079b
Unverified
Commit
13fe079b
authored
Feb 01, 2021
by
chunhtai
Committed by
GitHub
Feb 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes preceision error during SliverGridRegularTileLayout (#74851)
parent
6bd54753
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
sliver_grid.dart
packages/flutter/lib/src/rendering/sliver_grid.dart
+1
-1
grid_view_test.dart
packages/flutter/test/widgets/grid_view_test.dart
+24
-0
No files found.
packages/flutter/lib/src/rendering/sliver_grid.dart
View file @
13fe079b
...
...
@@ -194,7 +194,7 @@ class SliverGridRegularTileLayout extends SliverGridLayout {
@override
int
getMinChildIndexForScrollOffset
(
double
scrollOffset
)
{
return
mainAxisStride
>
0.0
?
crossAxisCount
*
(
scrollOffset
~/
mainAxisStride
)
:
0
;
return
mainAxisStride
>
precisionErrorTolerance
?
crossAxisCount
*
(
scrollOffset
~/
mainAxisStride
)
:
0
;
}
@override
...
...
packages/flutter/test/widgets/grid_view_test.dart
View file @
13fe079b
...
...
@@ -315,6 +315,30 @@ void main() {
expect
(
find
.
text
(
'4'
),
findsNothing
);
});
testWidgets
(
'SliverGridRegularTileLayout - can handle close to zero mainAxisStride'
,
(
WidgetTester
tester
)
async
{
const
SliverGridDelegateWithMaxCrossAxisExtent
delegate
=
SliverGridDelegateWithMaxCrossAxisExtent
(
childAspectRatio:
1
e300
,
maxCrossAxisExtent:
500.0
,
);
final
SliverGridLayout
layout
=
delegate
.
getLayout
(
const
SliverConstraints
(
axisDirection:
AxisDirection
.
down
,
growthDirection:
GrowthDirection
.
forward
,
userScrollDirection:
ScrollDirection
.
forward
,
scrollOffset:
100.0
,
precedingScrollExtent:
0.0
,
overlap:
0.0
,
remainingPaintExtent:
0.0
,
crossAxisExtent:
500
,
crossAxisDirection:
AxisDirection
.
right
,
viewportMainAxisExtent:
100.0
,
remainingCacheExtent:
0.0
,
cacheOrigin:
0.0
,
)
);
expect
(
layout
.
getMinChildIndexForScrollOffset
(
1000.0
),
0.0
);
});
testWidgets
(
'GridView - change maxChildCrossAxisExtent'
,
(
WidgetTester
tester
)
async
{
final
List
<
int
>
log
=
<
int
>[];
...
...
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