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
98264a47
Unverified
Commit
98264a47
authored
Jul 28, 2020
by
Ming Lyu (CareF)
Committed by
GitHub
Jul 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify macrobencharks/picture_cache (#62219)
parent
c867a1ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
58 deletions
+29
-58
picture_cache.dart
dev/benchmarks/macrobenchmarks/lib/src/picture_cache.dart
+26
-56
picture_cache_perf_test.dart
.../macrobenchmarks/test_driver/picture_cache_perf_test.dart
+3
-2
No files found.
dev/benchmarks/macrobenchmarks/lib/src/picture_cache.dart
View file @
98264a47
...
@@ -10,65 +10,35 @@ class PictureCachePage extends StatelessWidget {
...
@@ -10,65 +10,35 @@ class PictureCachePage extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
return
DefaultTabController
(
body:
DefaultTabController
(
length:
kTabNames
.
length
,
// This is the number of tabs.
length:
kTabNames
.
length
,
// This is the number of tabs.
child:
Scaffold
(
child:
NestedScrollView
(
appBar:
AppBar
(
key:
const
Key
(
'nested-scroll'
),
// this key is used by the driver test
title:
const
Text
(
'Picture Cache'
),
headerSliverBuilder:
(
BuildContext
context
,
bool
innerBoxIsScrolled
)
{
// pinned: true,
// These are the slivers that show up in the "outer" scroll view.
// expandedHeight: 50.0,
return
<
Widget
>[
// forceElevated: innerBoxIsScrolled,
SliverOverlapAbsorber
(
bottom:
TabBar
(
handle:
NestedScrollView
.
sliverOverlapAbsorberHandleFor
(
context
),
tabs:
kTabNames
.
map
((
String
name
)
=>
Tab
(
text:
name
)).
toList
(),
sliver:
SliverAppBar
(
title:
const
Text
(
'Picture Cache'
),
pinned:
true
,
expandedHeight:
50.0
,
forceElevated:
innerBoxIsScrolled
,
bottom:
TabBar
(
tabs:
kTabNames
.
map
((
String
name
)
=>
Tab
(
text:
name
)).
toList
(),
),
),
),
];
},
body:
TabBarView
(
children:
kTabNames
.
map
((
String
name
)
{
return
SafeArea
(
top:
false
,
bottom:
false
,
child:
Builder
(
builder:
(
BuildContext
context
)
{
return
VerticalList
();
},
),
);
}).
toList
(),
),
),
),
),
),
body:
TabBarView
(
);
key:
const
Key
(
'tabbar_view'
),
// this key is used by the driver test
}
children:
kTabNames
.
map
((
String
name
)
{
}
return
SafeArea
(
top:
false
,
class
VerticalList
extends
StatelessWidget
{
bottom:
false
,
static
const
int
kItemCount
=
100
;
child:
Builder
(
builder:
(
BuildContext
context
)
{
@override
return
ListView
.
builder
(
Widget
build
(
BuildContext
context
)
{
itemBuilder:
(
BuildContext
context
,
int
index
)
=>
ListItem
(
index:
index
),
return
CustomScrollView
(
);
slivers:
<
Widget
>[
},
SliverOverlapInjector
(
),
// This is the flip side of the SliverOverlapAbsorber above.
);
handle:
NestedScrollView
.
sliverOverlapAbsorberHandleFor
(
context
),
}).
toList
(),
),
SliverList
(
delegate:
SliverChildBuilderDelegate
(
(
BuildContext
context
,
int
index
)
=>
ListItem
(
index:
index
),
childCount:
kItemCount
,
),
),
),
]
,
)
,
);
);
}
}
}
}
...
...
dev/benchmarks/macrobenchmarks/test_driver/picture_cache_perf_test.dart
View file @
98264a47
...
@@ -13,9 +13,10 @@ void main() {
...
@@ -13,9 +13,10 @@ void main() {
kPictureCacheRouteName
,
kPictureCacheRouteName
,
pageDelay:
const
Duration
(
seconds:
1
),
pageDelay:
const
Duration
(
seconds:
1
),
driverOps:
(
FlutterDriver
driver
)
async
{
driverOps:
(
FlutterDriver
driver
)
async
{
final
SerializableFinder
nestedScroll
=
find
.
byValueKey
(
'nested-scroll
'
);
final
SerializableFinder
tabBarView
=
find
.
byValueKey
(
'tabbar_view
'
);
Future
<
void
>
_scrollOnce
(
double
offset
)
async
{
Future
<
void
>
_scrollOnce
(
double
offset
)
async
{
await
driver
.
scroll
(
nestedScroll
,
offset
,
0.0
,
const
Duration
(
milliseconds:
300
));
// Technically it's not scrolling but moving
await
driver
.
scroll
(
tabBarView
,
offset
,
0.0
,
const
Duration
(
milliseconds:
300
));
await
Future
<
void
>.
delayed
(
const
Duration
(
milliseconds:
500
));
await
Future
<
void
>.
delayed
(
const
Duration
(
milliseconds:
500
));
}
}
for
(
int
i
=
0
;
i
<
3
;
i
+=
1
)
{
for
(
int
i
=
0
;
i
<
3
;
i
+=
1
)
{
...
...
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