File tree Expand file tree Collapse file tree 11 files changed +68
-7
lines changed Expand file tree Collapse file tree 11 files changed +68
-7
lines changed Original file line number Diff line number Diff line change
1
+ ## 0.1.0+8
2
+
3
+ * Adds an optional parameter ` treeShakeIcons ` to ` serveWebBenchmark ` .
4
+ * Adds a required and named parameter ` treeShakeIcons ` to ` BenchmarkServer ` .
5
+
1
6
## 0.1.0+7
2
7
3
8
* Updates ` package:process ` version constraints.
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ Future<BenchmarkResults> serveWebBenchmark({
46
46
int benchmarkServerPort = defaultBenchmarkServerPort,
47
47
int chromeDebugPort = defaultChromeDebugPort,
48
48
bool headless = true ,
49
+ bool treeShakeIcons = true ,
49
50
}) async {
50
51
// Reduce logging level. Otherwise, package:webkit_inspection_protocol is way too spammy.
51
52
Logger .root.level = Level .INFO ;
@@ -57,5 +58,6 @@ Future<BenchmarkResults> serveWebBenchmark({
57
58
benchmarkServerPort: benchmarkServerPort,
58
59
chromeDebugPort: chromeDebugPort,
59
60
headless: headless,
61
+ treeShakeIcons: treeShakeIcons,
60
62
).run ();
61
63
}
Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ class BenchmarkServer {
54
54
required this .benchmarkServerPort,
55
55
required this .chromeDebugPort,
56
56
required this .headless,
57
+ required this .treeShakeIcons,
57
58
});
58
59
59
60
final ProcessManager _processManager = const LocalProcessManager ();
@@ -84,6 +85,11 @@ class BenchmarkServer {
84
85
/// This is useful in environments (e.g. CI) that doesn't have a display.
85
86
final bool headless;
86
87
88
+ /// Whether to tree shake icons during the build.
89
+ ///
90
+ /// When false, '--no-tree-shake-icons' will be passed as a build argument.
91
+ final bool treeShakeIcons;
92
+
87
93
/// Builds and serves the benchmark app, and collects benchmark results.
88
94
Future <BenchmarkResults > run () async {
89
95
// Reduce logging level. Otherwise, package:webkit_inspection_protocol is way too spammy.
@@ -101,6 +107,7 @@ class BenchmarkServer {
101
107
'web' ,
102
108
'--dart-define=FLUTTER_WEB_ENABLE_PROFILING=true' ,
103
109
if (useCanvasKit) '--dart-define=FLUTTER_WEB_USE_SKIA=true' ,
110
+ if (! treeShakeIcons) '--no-tree-shake-icons' ,
104
111
'--profile' ,
105
112
'-t' ,
106
113
entryPoint,
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: web_benchmarks
2
2
description : A benchmark harness for performance-testing Flutter apps in Chrome.
3
3
repository : https://github.com/flutter/packages/tree/main/packages/web_benchmarks
4
4
issue_tracker : https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+web_benchmarks%22
5
- version : 0.1.0+7
5
+ version : 0.1.0+8
6
6
7
7
environment :
8
8
sdk : " >=2.19.0 <4.0.0"
File renamed without changes.
Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ import 'package:flutter/material.dart';
8
8
import 'package:flutter_test/flutter_test.dart' ;
9
9
import 'package:web_benchmarks/client.dart' ;
10
10
11
- import '../aboutpage .dart' show backKey;
12
- import '../homepage .dart' show aboutPageKey, textKey;
11
+ import '../about_page .dart' show backKey;
12
+ import '../home_page .dart' show aboutPageKey, textKey;
13
13
import '../main.dart' ;
14
14
15
15
/// A recorder that measures frame building durations.
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ // Copyright 2013 The Flutter Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import 'package:flutter/material.dart' ;
6
+
7
+ class IconGeneratorPage extends StatefulWidget {
8
+ const IconGeneratorPage ({super .key});
9
+
10
+ static int defaultIconCodePoint = int .parse ('0xf03f' );
11
+
12
+ @override
13
+ State <IconGeneratorPage > createState () => _IconGeneratorPageState ();
14
+ }
15
+
16
+ class _IconGeneratorPageState extends State <IconGeneratorPage > {
17
+ int iconCodePoint = IconGeneratorPage .defaultIconCodePoint;
18
+
19
+ @override
20
+ Widget build (BuildContext context) {
21
+ return Column (
22
+ children: < Widget > [
23
+ TextField (
24
+ onSubmitted: (String value) {
25
+ final int codePointAsInt =
26
+ int .tryParse (value) ?? IconGeneratorPage .defaultIconCodePoint;
27
+ setState (() {
28
+ iconCodePoint = codePointAsInt;
29
+ });
30
+ },
31
+ ),
32
+ const SizedBox (height: 24.0 ),
33
+ Icon (generateIcon (iconCodePoint)),
34
+ ],
35
+ );
36
+ }
37
+
38
+ // Unless '--no-tree-shake-icons' is passed to the flutter build command,
39
+ // the presence of this method will trigger an exception due to the use of
40
+ // non-constant invocations of [IconData].
41
+ IconData generateIcon (int materialIconCodePoint) => IconData (
42
+ materialIconCodePoint,
43
+ fontFamily: 'MaterialIcons' ,
44
+ );
45
+ }
Original file line number Diff line number Diff line change 4
4
5
5
import 'package:flutter/material.dart' ;
6
6
7
- import 'aboutpage.dart' ;
8
- import 'homepage.dart' ;
7
+ import 'about_page.dart' ;
8
+ import 'home_page.dart' ;
9
+ import 'icon_page.dart' ;
9
10
10
11
void main () {
11
12
runApp (const MyApp ());
@@ -26,6 +27,7 @@ class MyApp extends StatelessWidget {
26
27
routes: < String , WidgetBuilder > {
27
28
'home' : (_) => const HomePage (title: 'Flutter Demo Home Page' ),
28
29
'about' : (_) => const AboutPage (),
30
+ 'icon_generator' : (_) => const IconGeneratorPage (),
29
31
},
30
32
);
31
33
}
Original file line number Diff line number Diff line change @@ -6,10 +6,9 @@ publish_to: 'none'
6
6
version : 1.0.0+1
7
7
8
8
environment :
9
- sdk : " >=2.19.0 <4.0.0"
9
+ sdk : ' >=2.19.0 <4.0.0'
10
10
11
11
dependencies :
12
- cupertino_icons : ^1.0.5
13
12
flutter :
14
13
sdk : flutter
15
14
flutter_test :
You can’t perform that action at this time.
0 commit comments