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
39d9bcda
Commit
39d9bcda
authored
Apr 21, 2017
by
Hans Muller
Committed by
GitHub
Apr 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ListView.Builder() handles appends when scrolled to the end (#9533)
parent
df45aac1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
98 additions
and
3 deletions
+98
-3
sliver_fixed_extent_list.dart
...s/flutter/lib/src/rendering/sliver_fixed_extent_list.dart
+4
-0
sliver_grid.dart
packages/flutter/lib/src/rendering/sliver_grid.dart
+4
-0
sliver_list.dart
packages/flutter/lib/src/rendering/sliver_list.dart
+4
-0
list_view_relayout_test.dart
packages/flutter/test/widgets/list_view_relayout_test.dart
+0
-3
listview_end_append_test.dart
packages/flutter/test/widgets/listview_end_append_test.dart
+59
-0
scrollable_grid_test.dart
packages/flutter/test/widgets/scrollable_grid_test.dart
+27
-0
No files found.
packages/flutter/lib/src/rendering/sliver_fixed_extent_list.dart
View file @
39d9bcda
...
@@ -209,6 +209,10 @@ abstract class RenderSliverFixedExtentBoxAdaptor extends RenderSliverMultiBoxAda
...
@@ -209,6 +209,10 @@ abstract class RenderSliverFixedExtentBoxAdaptor extends RenderSliverMultiBoxAda
||
constraints
.
scrollOffset
>
0.0
,
||
constraints
.
scrollOffset
>
0.0
,
);
);
// We may have started the layout while scrolled to the end, which would not
// expose a new child.
if
(
estimatedMaxScrollOffset
==
trailingScrollOffset
)
childManager
.
setDidUnderflow
(
true
);
childManager
.
didFinishLayout
();
childManager
.
didFinishLayout
();
}
}
}
}
...
...
packages/flutter/lib/src/rendering/sliver_grid.dart
View file @
39d9bcda
...
@@ -589,6 +589,10 @@ class RenderSliverGrid extends RenderSliverMultiBoxAdaptor {
...
@@ -589,6 +589,10 @@ class RenderSliverGrid extends RenderSliverMultiBoxAdaptor {
hasVisualOverflow:
true
,
hasVisualOverflow:
true
,
);
);
// We may have started the layout while scrolled to the end, which
// would not expose a new child.
if
(
estimatedTotalExtent
==
trailingScrollOffset
)
childManager
.
setDidUnderflow
(
true
);
childManager
.
didFinishLayout
();
childManager
.
didFinishLayout
();
}
}
}
}
packages/flutter/lib/src/rendering/sliver_list.dart
View file @
39d9bcda
...
@@ -243,6 +243,10 @@ class RenderSliverList extends RenderSliverMultiBoxAdaptor {
...
@@ -243,6 +243,10 @@ class RenderSliverList extends RenderSliverMultiBoxAdaptor {
hasVisualOverflow:
endScrollOffset
>
targetEndScrollOffset
||
constraints
.
scrollOffset
>
0.0
,
hasVisualOverflow:
endScrollOffset
>
targetEndScrollOffset
||
constraints
.
scrollOffset
>
0.0
,
);
);
// We may have started the layout while scrolled to the end, which would not
// expose a new child.
if
(
estimatedMaxScrollOffset
==
endScrollOffset
)
childManager
.
setDidUnderflow
(
true
);
childManager
.
didFinishLayout
();
childManager
.
didFinishLayout
();
}
}
}
}
packages/flutter/test/widgets/list_view_relayout_test.dart
View file @
39d9bcda
...
@@ -124,9 +124,6 @@ void main() {
...
@@ -124,9 +124,6 @@ void main() {
expect
(
find
.
text
(
'300'
),
findsOneWidget
);
expect
(
find
.
text
(
'300'
),
findsOneWidget
);
expect
(
find
.
text
(
'400'
),
findsOneWidget
);
expect
(
find
.
text
(
'400'
),
findsOneWidget
);
expect
(
find
.
text
(
'100'
),
findsNothing
);
expect
(
find
.
text
(
'100'
),
findsNothing
);
final
RenderSliverList
list
=
tester
.
renderObject
(
find
.
byType
(
SliverList
));
expect
(
list
.
geometry
.
scrollExtent
,
equals
(
700.0
));
});
});
testWidgets
(
'Overflowing ListView should become scrollable'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Overflowing ListView should become scrollable'
,
(
WidgetTester
tester
)
async
{
...
...
packages/flutter/test/widgets/listview_end_append_test.dart
0 → 100644
View file @
39d9bcda
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/widgets.dart'
;
void
main
(
)
{
testWidgets
(
'ListView.builder() fixed itemExtent, scroll to end, append, scroll'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/9506
Widget
buildFrame
(
int
itemCount
)
{
return
new
ListView
.
builder
(
itemExtent:
200.0
,
itemCount:
itemCount
,
itemBuilder:
(
BuildContext
context
,
int
index
)
=>
new
Text
(
'item
$index
'
),
);
}
await
tester
.
pumpWidget
(
buildFrame
(
3
));
expect
(
find
.
text
(
'item 0'
),
findsOneWidget
);
expect
(
find
.
text
(
'item 1'
),
findsOneWidget
);
expect
(
find
.
text
(
'item 2'
),
findsOneWidget
);
await
tester
.
pumpWidget
(
buildFrame
(
4
));
expect
(
find
.
text
(
'item 3'
),
findsNothing
);
final
TestGesture
gesture
=
await
tester
.
startGesture
(
const
Offset
(
0.0
,
300.0
));
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
200.0
));
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'item 3'
),
findsOneWidget
);
});
testWidgets
(
'ListView.builder() fixed itemExtent, scroll to end, append, scroll'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/9506
Widget
buildFrame
(
int
itemCount
)
{
return
new
ListView
.
builder
(
itemCount:
itemCount
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
new
SizedBox
(
height:
200.0
,
child:
new
Text
(
'item
$index
'
),
);
},
);
}
await
tester
.
pumpWidget
(
buildFrame
(
3
));
expect
(
find
.
text
(
'item 0'
),
findsOneWidget
);
expect
(
find
.
text
(
'item 1'
),
findsOneWidget
);
expect
(
find
.
text
(
'item 2'
),
findsOneWidget
);
await
tester
.
pumpWidget
(
buildFrame
(
4
));
final
TestGesture
gesture
=
await
tester
.
startGesture
(
const
Offset
(
0.0
,
300.0
));
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
200.0
));
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'item 3'
),
findsOneWidget
);
});
}
packages/flutter/test/widgets/scrollable_grid_test.dart
View file @
39d9bcda
...
@@ -68,4 +68,31 @@ void main() {
...
@@ -68,4 +68,31 @@ void main() {
expect
(
find
.
text
(
'3'
),
findsNothing
);
expect
(
find
.
text
(
'3'
),
findsNothing
);
expect
(
find
.
text
(
'4'
),
findsNothing
);
expect
(
find
.
text
(
'4'
),
findsNothing
);
});
});
testWidgets
(
'GridView.count() fixed itemExtent, scroll to end, append, scroll'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/9506
Widget
buildFrame
(
int
itemCount
)
{
return
new
GridView
.
count
(
crossAxisCount:
itemCount
,
children:
new
List
<
Widget
>.
generate
(
itemCount
,
(
int
index
)
{
return
new
SizedBox
(
height:
200.0
,
child:
new
Text
(
'item
$index
'
),
);
}),
);
}
await
tester
.
pumpWidget
(
buildFrame
(
3
));
expect
(
find
.
text
(
'item 0'
),
findsOneWidget
);
expect
(
find
.
text
(
'item 1'
),
findsOneWidget
);
expect
(
find
.
text
(
'item 2'
),
findsOneWidget
);
await
tester
.
pumpWidget
(
buildFrame
(
4
));
final
TestGesture
gesture
=
await
tester
.
startGesture
(
const
Offset
(
0.0
,
300.0
));
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
200.0
));
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'item 3'
),
findsOneWidget
);
});
}
}
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