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
eda3167a
Commit
eda3167a
authored
May 21, 2018
by
ng1905
Committed by
Michael Goderbauer
May 21, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ScrollOffset calculation when childCount is null (#17722)
parent
cc4eeb1c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
4 deletions
+31
-4
AUTHORS
AUTHORS
+1
-0
sliver.dart
packages/flutter/lib/src/widgets/sliver.dart
+6
-4
grid_view_test.dart
packages/flutter/test/widgets/grid_view_test.dart
+24
-0
No files found.
AUTHORS
View file @
eda3167a
...
@@ -22,3 +22,4 @@ Fredrik Simón <fredrik@fsimon.net>
...
@@ -22,3 +22,4 @@ Fredrik Simón <fredrik@fsimon.net>
Ali Bitek <alibitek@protonmail.ch>
Ali Bitek <alibitek@protonmail.ch>
Tetsuhiro Ueda <najeira@gmail.com>
Tetsuhiro Ueda <najeira@gmail.com>
Dan Field <dfield@gmail.com>
Dan Field <dfield@gmail.com>
Noah Groß <gross@ngsger.de>
packages/flutter/lib/src/widgets/sliver.dart
View file @
eda3167a
...
@@ -779,15 +779,13 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
...
@@ -779,15 +779,13 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
});
});
}
}
double
_extrapolateMaxScrollOffset
(
static
double
_extrapolateMaxScrollOffset
(
int
firstIndex
,
int
firstIndex
,
int
lastIndex
,
int
lastIndex
,
double
leadingScrollOffset
,
double
leadingScrollOffset
,
double
trailingScrollOffset
,
double
trailingScrollOffset
,
int
childCount
,
)
{
)
{
final
int
childCount
=
this
.
childCount
;
if
(
childCount
==
null
)
return
double
.
infinity
;
if
(
lastIndex
==
childCount
-
1
)
if
(
lastIndex
==
childCount
-
1
)
return
trailingScrollOffset
;
return
trailingScrollOffset
;
final
int
reifiedCount
=
lastIndex
-
firstIndex
+
1
;
final
int
reifiedCount
=
lastIndex
-
firstIndex
+
1
;
...
@@ -803,6 +801,9 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
...
@@ -803,6 +801,9 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
double
leadingScrollOffset
,
double
leadingScrollOffset
,
double
trailingScrollOffset
,
double
trailingScrollOffset
,
})
{
})
{
final
int
childCount
=
this
.
childCount
;
if
(
childCount
==
null
)
return
double
.
infinity
;
return
widget
.
estimateMaxScrollOffset
(
return
widget
.
estimateMaxScrollOffset
(
constraints
,
constraints
,
firstIndex
,
firstIndex
,
...
@@ -814,6 +815,7 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
...
@@ -814,6 +815,7 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
lastIndex
,
lastIndex
,
leadingScrollOffset
,
leadingScrollOffset
,
trailingScrollOffset
,
trailingScrollOffset
,
childCount
,
);
);
}
}
...
...
packages/flutter/test/widgets/grid_view_test.dart
View file @
eda3167a
...
@@ -481,6 +481,30 @@ void main() {
...
@@ -481,6 +481,30 @@ void main() {
expect
(
find
.
text
(
'12'
),
findsNothing
);
expect
(
find
.
text
(
'12'
),
findsNothing
);
});
});
testWidgets
(
'GridView.builder with undefined itemCount'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
new
GridView
.
builder
(
gridDelegate:
const
SliverGridDelegateWithFixedCrossAxisCount
(
crossAxisCount:
4
,
),
shrinkWrap:
true
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
new
Container
(
child:
new
Text
(
'
$index
'
),
);
},
),
),
);
expect
(
find
.
text
(
'0'
),
findsOneWidget
);
expect
(
find
.
text
(
'11'
),
findsOneWidget
);
await
tester
.
drag
(
find
.
byType
(
GridView
),
const
Offset
(
0.0
,
-
300.0
));
await
tester
.
pump
(
const
Duration
(
milliseconds:
200
));
expect
(
find
.
text
(
'13'
),
findsOneWidget
);
});
testWidgets
(
'GridView cross axis layout'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'GridView cross axis layout'
,
(
WidgetTester
tester
)
async
{
final
Key
target
=
new
UniqueKey
();
final
Key
target
=
new
UniqueKey
();
...
...
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