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
7ac18379
Unverified
Commit
7ac18379
authored
Jul 06, 2018
by
Hans Muller
Committed by
GitHub
Jul 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deferred ListView.separator cleanups (#18720)
parent
e5d9feb5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
scroll_view.dart
packages/flutter/lib/src/widgets/scroll_view.dart
+12
-7
No files found.
packages/flutter/lib/src/widgets/scroll_view.dart
View file @
7ac18379
...
...
@@ -452,7 +452,7 @@ abstract class BoxScrollView extends ScrollView {
/// machinery can make use of the foreknowledge of the children's extent to save
/// work, for example when the scroll position changes drastically.
///
/// There are
three
options for constructing a [ListView]:
/// There are
four
options for constructing a [ListView]:
///
/// 1. The default constructor takes an explicit [List<Widget>] of children. This
/// constructor is appropriate for list views with a small number of
...
...
@@ -460,13 +460,18 @@ abstract class BoxScrollView extends ScrollView {
/// child that could possibly be displayed in the list view instead of just
/// those children that are actually visible.
///
/// 2. The [ListView.builder]
takes an [IndexedWidgetBuilder], which builds the
///
children on demand. This constructor is appropriate for list views with
/// a large (or infinite) number of children because the builder is called
/// 2. The [ListView.builder]
constructor takes an [IndexedWidgetBuilder], which
///
builds the children on demand. This constructor is appropriate for list views
///
with
a large (or infinite) number of children because the builder is called
/// only for those children that are actually visible.
///
/// 3. The [ListView.custom] takes a [SliverChildDelegate], which provides the
/// ability to customize additional aspects of the child model. For example,
/// 3. The [ListView.separated] constructor takes two [IndexedWidgetBuilder]s:
/// `itemBuilder` builds child items on demand, and `separatorBuilder`
/// similarly builds separator children which appear in between the child items.
/// This constructor is appropriate for list views with a fixed number of children.
///
/// 4. The [ListView.custom] constructor takes a [SliverChildDelegate], which provides
/// the ability to customize additional aspects of the child model. For example,
/// a [SliverChildDelegate] can control the algorithm used to estimate the
/// size of children that are not actually visible.
///
...
...
@@ -749,7 +754,7 @@ class ListView extends BoxScrollView {
childrenDelegate
=
new
SliverChildBuilderDelegate
(
(
BuildContext
context
,
int
index
)
{
final
int
itemIndex
=
index
~/
2
;
return
(
index
==
0
||
index
.
isEven
)
return
index
.
isEven
?
itemBuilder
(
context
,
itemIndex
)
:
separatorBuilder
(
context
,
itemIndex
);
},
...
...
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