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
88a01ac4
Commit
88a01ac4
authored
Feb 14, 2017
by
Adam Barth
Committed by
GitHub
Feb 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port complex_layout to Sliver-based scrolling (#8114)
parent
f36566fa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
21 deletions
+7
-21
main.dart
dev/benchmarks/complex_layout/lib/main.dart
+7
-21
No files found.
dev/benchmarks/complex_layout/lib/main.dart
View file @
88a01ac4
...
...
@@ -52,28 +52,9 @@ class ComplexLayout extends StatefulWidget {
static
ComplexLayoutState
of
(
BuildContext
context
)
=>
context
.
ancestorStateOfType
(
const
TypeMatcher
<
ComplexLayoutState
>());
}
class
FancyItemDelegate
extends
LazyBlockDelegate
{
@override
Widget
buildItem
(
BuildContext
context
,
int
index
)
{
if
(
index
%
2
==
0
)
return
new
FancyImageItem
(
index
,
key:
new
ValueKey
<
int
>(
index
));
else
return
new
FancyGalleryItem
(
index
,
key:
new
ValueKey
<
int
>(
index
));
}
@override
bool
shouldRebuild
(
FancyItemDelegate
oldDelegate
)
=>
false
;
@override
double
estimateTotalExtent
(
int
firstIndex
,
int
lastIndex
,
double
minOffset
,
double
firstStartOffset
,
double
lastEndOffset
)
{
return
double
.
INFINITY
;
}
}
class
ComplexLayoutState
extends
State
<
ComplexLayout
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
appBar:
new
AppBar
(
title:
new
Text
(
'Advanced Layout'
),
...
...
@@ -91,9 +72,14 @@ class ComplexLayoutState extends State<ComplexLayout> {
body:
new
Column
(
children:
<
Widget
>[
new
Expanded
(
child:
new
L
azyBlock
(
child:
new
L
istView
.
builder
(
key:
new
Key
(
'main-scroll'
),
// this key is used by the driver test
delegate:
new
FancyItemDelegate
(),
itemBuilder:
(
BuildContext
context
,
int
index
)
{
if
(
index
%
2
==
0
)
return
new
FancyImageItem
(
index
,
key:
new
ValueKey
<
int
>(
index
));
else
return
new
FancyGalleryItem
(
index
,
key:
new
ValueKey
<
int
>(
index
));
},
)
),
new
BottomBar
(),
...
...
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