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
ebd794a1
Unverified
Commit
ebd794a1
authored
Dec 02, 2020
by
Ferhat
Committed by
GitHub
Dec 02, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[web] Add wrapbox scroll benchmark (#70966)
parent
ff9d9fc2
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
177 additions
and
0 deletions
+177
-0
Icon-192.png
dev/benchmarks/macrobenchmarks/assets/Icon-192.png
+0
-0
bench_wrapbox_scroll.dart
...rks/macrobenchmarks/lib/src/web/bench_wrapbox_scroll.dart
+174
-0
web_benchmarks.dart
dev/benchmarks/macrobenchmarks/lib/web_benchmarks.dart
+2
-0
pubspec.yaml
dev/benchmarks/macrobenchmarks/pubspec.yaml
+1
-0
No files found.
dev/benchmarks/macrobenchmarks/assets/Icon-192.png
0 → 100644
View file @
ebd794a1
This diff was suppressed by a .gitattributes entry.
dev/benchmarks/macrobenchmarks/lib/src/web/bench_wrapbox_scroll.dart
0 → 100644
View file @
ebd794a1
// Copyright 2014 The Flutter 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
'dart:async'
;
import
'dart:ui'
;
import
'package:flutter/material.dart'
;
import
'recorder.dart'
;
/// Creates a [Wrap] inside a ListView.
///
/// Tests large number of DOM nodes since image breaks up large canvas.
class
BenchWrapBoxScroll
extends
WidgetRecorder
{
BenchWrapBoxScroll
()
:
super
(
name:
benchmarkName
);
static
const
String
benchmarkName
=
'bench_wrapbox_scroll'
;
@override
Widget
createWidget
()
{
return
MaterialApp
(
theme:
ThemeData
(
primarySwatch:
Colors
.
blue
,
),
title:
'WrapBox Scroll Benchmark'
,
home:
const
Scaffold
(
body:
MyHomePage
()),
);
}
}
class
MyHomePage
extends
StatefulWidget
{
const
MyHomePage
({
Key
key
,
this
.
title
})
:
super
(
key:
key
);
final
String
title
;
@override
_MyHomePageState
createState
()
=>
_MyHomePageState
();
}
class
_MyHomePageState
extends
State
<
MyHomePage
>
{
ScrollController
scrollController
;
int
block
=
0
;
static
const
Duration
stepDuration
=
Duration
(
milliseconds:
500
);
static
const
double
stepDistance
=
400
;
@override
void
initState
()
{
super
.
initState
();
scrollController
=
ScrollController
();
// Without the timer the animation doesn't begin.
Timer
.
run
(()
async
{
while
(
block
<
25
)
{
await
scrollController
.
animateTo
((
block
%
5
)
*
stepDistance
,
duration:
stepDuration
,
curve:
Curves
.
easeInOut
);
block
++;
}
});
}
@override
void
dispose
()
{
super
.
dispose
();
scrollController
.
dispose
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
ListView
(
controller:
scrollController
,
children:
<
Widget
>[
Wrap
(
children:
<
Widget
>[
for
(
int
i
=
0
;
i
<
30
;
i
++)
FractionallySizedBox
(
widthFactor:
0.2
,
child:
ProductPreview
(
i
)),
//need case1
for
(
int
i
=
0
;
i
<
30
;
i
++)
ProductPreview
(
i
),
//need case2
],
),
]);
}
}
class
ProductPreview
extends
StatelessWidget
{
const
ProductPreview
(
this
.
previewIndex
);
final
int
previewIndex
;
@override
Widget
build
(
BuildContext
context
)
{
return
GestureDetector
(
behavior:
HitTestBehavior
.
translucent
,
onTap:
()
=>
print
(
'tap'
),
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
Container
(
margin:
const
EdgeInsets
.
all
(
23
),
padding:
const
EdgeInsets
.
all
(
18
),
decoration:
const
BoxDecoration
(
color:
Color
(
0xfff9f9f9
),
shape:
BoxShape
.
circle
,
),
child:
Image
.
network
(
'assets/assets/Icon-192.png'
,
width:
100
,
height:
100
,
),
),
const
Text
(
'title'
,
),
const
SizedBox
(
height:
14
,
),
Wrap
(
alignment:
WrapAlignment
.
center
,
children:
<
Widget
>[
ProductOption
(
optionText:
'
$previewIndex
: option1'
,
),
ProductOption
(
optionText:
'
$previewIndex
: option2'
,
),
ProductOption
(
optionText:
'
$previewIndex
: option3'
,
),
ProductOption
(
optionText:
'
$previewIndex
: option4'
,
),
ProductOption
(
optionText:
'
$previewIndex
: option5'
,
),
],
),
],
),
);
}
}
class
ProductOption
extends
StatelessWidget
{
const
ProductOption
({
Key
key
,
@required
this
.
optionText
,
})
:
super
(
key:
key
);
final
String
optionText
;
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
constraints:
const
BoxConstraints
(
minWidth:
56
),
margin:
const
EdgeInsets
.
all
(
2
),
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
11
,
vertical:
5
),
decoration:
BoxDecoration
(
border:
Border
.
all
(
width:
1
,
color:
const
Color
(
0xffebebeb
),
),
borderRadius:
const
BorderRadius
.
all
(
Radius
.
circular
(
15
)),
),
child:
Text
(
optionText
,
maxLines:
1
,
textAlign:
TextAlign
.
center
,
overflow:
TextOverflow
.
ellipsis
,
),
);
}
}
dev/benchmarks/macrobenchmarks/lib/web_benchmarks.dart
View file @
ebd794a1
...
@@ -25,6 +25,7 @@ import 'src/web/bench_paths.dart';
...
@@ -25,6 +25,7 @@ import 'src/web/bench_paths.dart';
import
'src/web/bench_picture_recording.dart'
;
import
'src/web/bench_picture_recording.dart'
;
import
'src/web/bench_simple_lazy_text_scroll.dart'
;
import
'src/web/bench_simple_lazy_text_scroll.dart'
;
import
'src/web/bench_text_out_of_picture_bounds.dart'
;
import
'src/web/bench_text_out_of_picture_bounds.dart'
;
import
'src/web/bench_wrapbox_scroll.dart'
;
import
'src/web/recorder.dart'
;
import
'src/web/recorder.dart'
;
typedef
RecorderFactory
=
Recorder
Function
();
typedef
RecorderFactory
=
Recorder
Function
();
...
@@ -53,6 +54,7 @@ final Map<String, RecorderFactory> benchmarks = <String, RecorderFactory>{
...
@@ -53,6 +54,7 @@ final Map<String, RecorderFactory> benchmarks = <String, RecorderFactory>{
BenchMouseRegionGridScroll
.
benchmarkName
:
()
=>
BenchMouseRegionGridScroll
(),
BenchMouseRegionGridScroll
.
benchmarkName
:
()
=>
BenchMouseRegionGridScroll
(),
BenchMouseRegionGridHover
.
benchmarkName
:
()
=>
BenchMouseRegionGridHover
(),
BenchMouseRegionGridHover
.
benchmarkName
:
()
=>
BenchMouseRegionGridHover
(),
BenchMouseRegionMixedGridHover
.
benchmarkName
:
()
=>
BenchMouseRegionMixedGridHover
(),
BenchMouseRegionMixedGridHover
.
benchmarkName
:
()
=>
BenchMouseRegionMixedGridHover
(),
BenchWrapBoxScroll
.
benchmarkName
:
()
=>
BenchWrapBoxScroll
(),
if
(
isCanvasKit
)
if
(
isCanvasKit
)
BenchBuildColorsGrid
.
canvasKitBenchmarkName
:
()
=>
BenchBuildColorsGrid
.
canvasKit
(),
BenchBuildColorsGrid
.
canvasKitBenchmarkName
:
()
=>
BenchBuildColorsGrid
.
canvasKit
(),
...
...
dev/benchmarks/macrobenchmarks/pubspec.yaml
View file @
ebd794a1
...
@@ -87,6 +87,7 @@ flutter:
...
@@ -87,6 +87,7 @@ flutter:
-
packages/flutter_gallery_assets/food/butternut_squash_soup.png
-
packages/flutter_gallery_assets/food/butternut_squash_soup.png
-
packages/flutter_gallery_assets/food/cherry_pie.png
-
packages/flutter_gallery_assets/food/cherry_pie.png
-
assets/999x1000.png
-
assets/999x1000.png
-
assets/Icon-192.png
# The following assets are required for running Flutter Gallery benchmarks.
# The following assets are required for running Flutter Gallery benchmarks.
-
packages/flutter_gallery_assets/assets/icons/settings/settings_light.flr
-
packages/flutter_gallery_assets/assets/icons/settings/settings_light.flr
...
...
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