李卓原

优化部分示例

1 -# Generated by pub on 2019-02-21 16:04:26.823126.  
2 -async:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.0.8/lib/ 1 +# Generated by pub on 2019-05-15 14:31:19.119581.
  2 +async:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.1.0/lib/
3 boolean_selector:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.4/lib/ 3 boolean_selector:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.4/lib/
4 charcode:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib/ 4 charcode:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib/
5 collection:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.14.11/lib/ 5 collection:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.14.11/lib/
6 flutter:file:///D:/flutter/packages/flutter/lib/ 6 flutter:file:///D:/flutter/packages/flutter/lib/
7 flutter_test:file:///D:/flutter/packages/flutter_test/lib/ 7 flutter_test:file:///D:/flutter/packages/flutter_test/lib/
8 -matcher:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.3+1/lib/ 8 +matcher:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.5/lib/
9 meta:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.1.6/lib/ 9 meta:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.1.6/lib/
10 path:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.6.2/lib/ 10 path:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.6.2/lib/
11 -quiver:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/quiver-2.0.1/lib/ 11 +pedantic:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/pedantic-1.5.0/lib/
  12 +quiver:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/quiver-2.0.2/lib/
12 sky_engine:file:///D:/flutter/bin/cache/pkg/sky_engine/lib/ 13 sky_engine:file:///D:/flutter/bin/cache/pkg/sky_engine/lib/
13 -source_span:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.4.1/lib/ 14 +source_span:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.5.5/lib/
14 stack_trace:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.3/lib/ 15 stack_trace:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.3/lib/
15 -stream_channel:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-1.6.8/lib/ 16 +stream_channel:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.0.0/lib/
16 string_scanner:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.4/lib/ 17 string_scanner:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.4/lib/
17 -term_glyph:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.0.1/lib/  
18 -test_api:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.1/lib/ 18 +term_glyph:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.1.0/lib/
  19 +test_api:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.4/lib/
19 typed_data:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.6/lib/ 20 typed_data:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.6/lib/
20 vector_math:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.0.8/lib/ 21 vector_math:file:///D:/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.0.8/lib/
21 flutter_screenutil:lib/ 22 flutter_screenutil:lib/
@@ -33,14 +33,14 @@ class _MyHomePageState extends State<MyHomePage> { @@ -33,14 +33,14 @@ class _MyHomePageState extends State<MyHomePage> {
33 ///Set the fit size (fill in the screen size of the device in the design) If the design is based on the size of the iPhone6 ​​(iPhone6 ​​750*1334) 33 ///Set the fit size (fill in the screen size of the device in the design) If the design is based on the size of the iPhone6 ​​(iPhone6 ​​750*1334)
34 ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context); 34 ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context);
35 35
36 - print('Device width:${ScreenUtil.screenWidth}'); //Device width  
37 - print('Device height:${ScreenUtil.screenHeight}'); //Device height 36 + print('Device width px:${ScreenUtil.screenWidth}'); //Device width
  37 + print('Device height px:${ScreenUtil.screenHeight}'); //Device height
38 print( 38 print(
39 'Device pixel density:${ScreenUtil.pixelRatio}'); //Device pixel density 39 'Device pixel density:${ScreenUtil.pixelRatio}'); //Device pixel density
40 print( 40 print(
41 - 'Bottom safe zone distance:${ScreenUtil.bottomBarHeight}'); //Bottom safe zone distance,suitable for buttons with full screen 41 + 'Bottom safe zone distance px:${ScreenUtil.bottomBarHeight}'); //Bottom safe zone distance,suitable for buttons with full screen
42 print( 42 print(
43 - 'Status bar height:${ScreenUtil.statusBarHeight}px'); //Status bar height , Notch will be higher Unit px 43 + 'Status bar height px:${ScreenUtil.statusBarHeight}px'); //Status bar height , Notch will be higher Unit px
44 print( 44 print(
45 'Ratio of actual width dp to design draft px:${ScreenUtil.getInstance().scaleWidth}'); 45 'Ratio of actual width dp to design draft px:${ScreenUtil.getInstance().scaleWidth}');
46 print( 46 print(
@@ -49,6 +49,7 @@ class _MyHomePageState extends State<MyHomePage> { @@ -49,6 +49,7 @@ class _MyHomePageState extends State<MyHomePage> {
49 'The ratio of font and width to the size of the design:${ScreenUtil.getInstance().scaleWidth * ScreenUtil.pixelRatio}'); 49 'The ratio of font and width to the size of the design:${ScreenUtil.getInstance().scaleWidth * ScreenUtil.pixelRatio}');
50 print( 50 print(
51 'The ratio of height width to the size of the design:${ScreenUtil.getInstance().scaleHeight * ScreenUtil.pixelRatio}'); 51 'The ratio of height width to the size of the design:${ScreenUtil.getInstance().scaleHeight * ScreenUtil.pixelRatio}');
  52 +
52 return new Scaffold( 53 return new Scaffold(
53 appBar: new AppBar( 54 appBar: new AppBar(
54 title: new Text(widget.title), 55 title: new Text(widget.title),
@@ -84,6 +85,8 @@ class _MyHomePageState extends State<MyHomePage> { @@ -84,6 +85,8 @@ class _MyHomePageState extends State<MyHomePage> {
84 ), 85 ),
85 Text('Device width:${ScreenUtil.screenWidth}px'), 86 Text('Device width:${ScreenUtil.screenWidth}px'),
86 Text('Device height:${ScreenUtil.screenHeight}px'), 87 Text('Device height:${ScreenUtil.screenHeight}px'),
  88 + Text('Device width:${ScreenUtil.screenWidthDp}dp'),
  89 + Text('Device height:${ScreenUtil.screenHeightDp}dp'),
87 Text('Device pixel density:${ScreenUtil.pixelRatio}'), 90 Text('Device pixel density:${ScreenUtil.pixelRatio}'),
88 Text('Bottom safe zone distance:${ScreenUtil.bottomBarHeight}px'), 91 Text('Bottom safe zone distance:${ScreenUtil.bottomBarHeight}px'),
89 Text('Status bar height:${ScreenUtil.statusBarHeight}px'), 92 Text('Status bar height:${ScreenUtil.statusBarHeight}px'),
@@ -95,14 +98,6 @@ class _MyHomePageState extends State<MyHomePage> { @@ -95,14 +98,6 @@ class _MyHomePageState extends State<MyHomePage> {
95 'Ratio of actual height dp to design draft px:${ScreenUtil.getInstance().scaleHeight}', 98 'Ratio of actual height dp to design draft px:${ScreenUtil.getInstance().scaleHeight}',
96 textAlign: TextAlign.center, 99 textAlign: TextAlign.center,
97 ), 100 ),
98 - Text(  
99 - 'The ratio of font and width to the size of the design:${ScreenUtil.getInstance().scaleWidth * ScreenUtil.pixelRatio}',  
100 - textAlign: TextAlign.center,  
101 - ),  
102 - Text(  
103 - 'The ratio of height width to the size of the design:${ScreenUtil.getInstance().scaleHeight * ScreenUtil.pixelRatio}',  
104 - textAlign: TextAlign.center,  
105 - ),  
106 SizedBox( 101 SizedBox(
107 height: ScreenUtil.getInstance().setHeight(100), 102 height: ScreenUtil.getInstance().setHeight(100),
108 ), 103 ),
@@ -45,12 +45,13 @@ class _MyHomePageState extends State<MyHomePage> { @@ -45,12 +45,13 @@ class _MyHomePageState extends State<MyHomePage> {
45 45
46 print( 46 print(
47 '宽度和字体相对于设计稿放大的比例:${ScreenUtil.getInstance().scaleWidth * ScreenUtil.pixelRatio}'); 47 '宽度和字体相对于设计稿放大的比例:${ScreenUtil.getInstance().scaleWidth * ScreenUtil.pixelRatio}');
48 - print('高度相对于设计稿放大的比例:${ScreenUtil.getInstance().scaleHeight * ScreenUtil.pixelRatio}'); 48 + print(
  49 + '高度相对于设计稿放大的比例:${ScreenUtil.getInstance().scaleHeight * ScreenUtil.pixelRatio}');
49 print('系统的字体缩放比例:${ScreenUtil.textScaleFactory}'); 50 print('系统的字体缩放比例:${ScreenUtil.textScaleFactory}');
50 51
51 - return new Scaffold(  
52 - appBar: new AppBar(  
53 - title: new Text(widget.title), 52 + return Scaffold(
  53 + appBar: AppBar(
  54 + title: Text(widget.title),
54 ), 55 ),
55 floatingActionButton: FloatingActionButton( 56 floatingActionButton: FloatingActionButton(
56 onPressed: () { 57 onPressed: () {
@@ -82,35 +83,31 @@ class _MyHomePageState extends State<MyHomePage> { @@ -82,35 +83,31 @@ class _MyHomePageState extends State<MyHomePage> {
82 width: ScreenUtil.getInstance().setWidth(375), 83 width: ScreenUtil.getInstance().setWidth(375),
83 height: ScreenUtil.getInstance().setHeight(200), 84 height: ScreenUtil.getInstance().setHeight(200),
84 color: Colors.blue, 85 color: Colors.blue,
85 - child: Text('我的宽度:${ScreenUtil.getInstance().setWidth(375)}dp',  
86 - style: TextStyle(  
87 - color: Colors.white,  
88 - fontSize: ScreenUtil.getInstance().setSp(24),  
89 - )), 86 + child:
  87 + Text('我的宽度:${ScreenUtil.getInstance().setWidth(375)}dp',
  88 + style: TextStyle(
  89 + color: Colors.white,
  90 + fontSize: ScreenUtil.getInstance().setSp(24),
  91 + )),
90 ), 92 ),
91 ], 93 ],
92 ), 94 ),
93 Text('设备宽度:${ScreenUtil.screenWidth}px'), 95 Text('设备宽度:${ScreenUtil.screenWidth}px'),
94 Text('设备高度:${ScreenUtil.screenHeight}px'), 96 Text('设备高度:${ScreenUtil.screenHeight}px'),
  97 + Text('设备宽度:${ScreenUtil.screenWidthDp}dp'),
  98 + Text('设备高度:${ScreenUtil.screenHeightDp}dp'),
  99 + Text('设计稿宽度:${ScreenUtil.getInstance().width}'),
95 Text('设备的像素密度:${ScreenUtil.pixelRatio}'), 100 Text('设备的像素密度:${ScreenUtil.pixelRatio}'),
96 Text('底部安全区距离:${ScreenUtil.bottomBarHeight}px'), 101 Text('底部安全区距离:${ScreenUtil.bottomBarHeight}px'),
97 Text('状态栏高度:${ScreenUtil.statusBarHeight}px'), 102 Text('状态栏高度:${ScreenUtil.statusBarHeight}px'),
98 Text( 103 Text(
99 - '实际高度的dp与设计稿px的比例:${ScreenUtil.getInstance().scaleHeight}', 104 + '实际宽度的dp与设计稿px的比例:${ScreenUtil.getInstance().scaleWidth}',
100 textAlign: TextAlign.center, 105 textAlign: TextAlign.center,
101 ), 106 ),
102 Text( 107 Text(
103 '实际高度的dp与设计稿px的比例:${ScreenUtil.getInstance().scaleHeight}', 108 '实际高度的dp与设计稿px的比例:${ScreenUtil.getInstance().scaleHeight}',
104 textAlign: TextAlign.center, 109 textAlign: TextAlign.center,
105 ), 110 ),
106 - Text(  
107 - '宽度和字体相对于设计稿放大的比例:${ScreenUtil.getInstance().scaleWidth * ScreenUtil.pixelRatio}',  
108 - textAlign: TextAlign.center,  
109 - ),  
110 - Text(  
111 - '高度相对于设计稿放大的比例:${ScreenUtil.getInstance().scaleHeight * ScreenUtil.pixelRatio}',  
112 - textAlign: TextAlign.center,  
113 - ),  
114 SizedBox( 111 SizedBox(
115 height: ScreenUtil.getInstance().setHeight(100), 112 height: ScreenUtil.getInstance().setHeight(100),
116 ), 113 ),
@@ -118,10 +115,11 @@ class _MyHomePageState extends State<MyHomePage> { @@ -118,10 +115,11 @@ class _MyHomePageState extends State<MyHomePage> {
118 Column( 115 Column(
119 crossAxisAlignment: CrossAxisAlignment.start, 116 crossAxisAlignment: CrossAxisAlignment.start,
120 children: <Widget>[ 117 children: <Widget>[
121 - Text('我的文字大小在设计稿上是25px,不会随着系统的文字缩放比例变化', 118 + Text('我的文字大小在设计稿上是24px,不会随着系统的文字缩放比例变化',
122 style: TextStyle( 119 style: TextStyle(
123 - color: Colors.black, fontSize: ScreenUtil.getInstance().setSp(24))),  
124 - Text('我的文字大小在设计稿上是25px,会随着系统的文字缩放比例变化', 120 + color: Colors.black,
  121 + fontSize: ScreenUtil.getInstance().setSp(24))),
  122 + Text('我的文字大小在设计稿上是24px,会随着系统的文字缩放比例变化',
125 style: TextStyle( 123 style: TextStyle(
126 color: Colors.black, 124 color: Colors.black,
127 fontSize: 125 fontSize:
@@ -7,7 +7,7 @@ packages: @@ -7,7 +7,7 @@ packages:
7 name: async 7 name: async
8 url: "https://pub.dartlang.org" 8 url: "https://pub.dartlang.org"
9 source: hosted 9 source: hosted
10 - version: "2.0.8" 10 + version: "2.1.0"
11 boolean_selector: 11 boolean_selector:
12 dependency: transitive 12 dependency: transitive
13 description: 13 description:
@@ -47,7 +47,7 @@ packages: @@ -47,7 +47,7 @@ packages:
47 path: ".." 47 path: ".."
48 relative: true 48 relative: true
49 source: path 49 source: path
50 - version: "0.5.1" 50 + version: "0.5.2"
51 flutter_test: 51 flutter_test:
52 dependency: "direct dev" 52 dependency: "direct dev"
53 description: flutter 53 description: flutter
@@ -59,7 +59,7 @@ packages: @@ -59,7 +59,7 @@ packages:
59 name: matcher 59 name: matcher
60 url: "https://pub.dartlang.org" 60 url: "https://pub.dartlang.org"
61 source: hosted 61 source: hosted
62 - version: "0.12.3+1" 62 + version: "0.12.5"
63 meta: 63 meta:
64 dependency: transitive 64 dependency: transitive
65 description: 65 description:
@@ -87,7 +87,7 @@ packages: @@ -87,7 +87,7 @@ packages:
87 name: quiver 87 name: quiver
88 url: "https://pub.dartlang.org" 88 url: "https://pub.dartlang.org"
89 source: hosted 89 source: hosted
90 - version: "2.0.1" 90 + version: "2.0.2"
91 sky_engine: 91 sky_engine:
92 dependency: transitive 92 dependency: transitive
93 description: flutter 93 description: flutter
@@ -113,7 +113,7 @@ packages: @@ -113,7 +113,7 @@ packages:
113 name: stream_channel 113 name: stream_channel
114 url: "https://pub.dartlang.org" 114 url: "https://pub.dartlang.org"
115 source: hosted 115 source: hosted
116 - version: "1.6.8" 116 + version: "2.0.0"
117 string_scanner: 117 string_scanner:
118 dependency: transitive 118 dependency: transitive
119 description: 119 description:
@@ -134,7 +134,7 @@ packages: @@ -134,7 +134,7 @@ packages:
134 name: test_api 134 name: test_api
135 url: "https://pub.dartlang.org" 135 url: "https://pub.dartlang.org"
136 source: hosted 136 source: hosted
137 - version: "0.2.2" 137 + version: "0.2.4"
138 typed_data: 138 typed_data:
139 dependency: transitive 139 dependency: transitive
140 description: 140 description:
@@ -150,4 +150,4 @@ packages: @@ -150,4 +150,4 @@ packages:
150 source: hosted 150 source: hosted
151 version: "2.0.8" 151 version: "2.0.8"
152 sdks: 152 sdks:
153 - dart: ">=2.1.1-dev.0.0 <3.0.0" 153 + dart: ">=2.2.0 <3.0.0"
@@ -7,7 +7,7 @@ packages: @@ -7,7 +7,7 @@ packages:
7 name: async 7 name: async
8 url: "https://pub.dartlang.org" 8 url: "https://pub.dartlang.org"
9 source: hosted 9 source: hosted
10 - version: "2.0.8" 10 + version: "2.1.0"
11 boolean_selector: 11 boolean_selector:
12 dependency: transitive 12 dependency: transitive
13 description: 13 description:
@@ -45,7 +45,7 @@ packages: @@ -45,7 +45,7 @@ packages:
45 name: matcher 45 name: matcher
46 url: "https://pub.dartlang.org" 46 url: "https://pub.dartlang.org"
47 source: hosted 47 source: hosted
48 - version: "0.12.3+1" 48 + version: "0.12.5"
49 meta: 49 meta:
50 dependency: transitive 50 dependency: transitive
51 description: 51 description:
@@ -60,13 +60,20 @@ packages: @@ -60,13 +60,20 @@ packages:
60 url: "https://pub.dartlang.org" 60 url: "https://pub.dartlang.org"
61 source: hosted 61 source: hosted
62 version: "1.6.2" 62 version: "1.6.2"
  63 + pedantic:
  64 + dependency: transitive
  65 + description:
  66 + name: pedantic
  67 + url: "https://pub.dartlang.org"
  68 + source: hosted
  69 + version: "1.5.0"
63 quiver: 70 quiver:
64 dependency: transitive 71 dependency: transitive
65 description: 72 description:
66 name: quiver 73 name: quiver
67 url: "https://pub.dartlang.org" 74 url: "https://pub.dartlang.org"
68 source: hosted 75 source: hosted
69 - version: "2.0.1" 76 + version: "2.0.2"
70 sky_engine: 77 sky_engine:
71 dependency: transitive 78 dependency: transitive
72 description: flutter 79 description: flutter
@@ -78,7 +85,7 @@ packages: @@ -78,7 +85,7 @@ packages:
78 name: source_span 85 name: source_span
79 url: "https://pub.dartlang.org" 86 url: "https://pub.dartlang.org"
80 source: hosted 87 source: hosted
81 - version: "1.4.1" 88 + version: "1.5.5"
82 stack_trace: 89 stack_trace:
83 dependency: transitive 90 dependency: transitive
84 description: 91 description:
@@ -92,7 +99,7 @@ packages: @@ -92,7 +99,7 @@ packages:
92 name: stream_channel 99 name: stream_channel
93 url: "https://pub.dartlang.org" 100 url: "https://pub.dartlang.org"
94 source: hosted 101 source: hosted
95 - version: "1.6.8" 102 + version: "2.0.0"
96 string_scanner: 103 string_scanner:
97 dependency: transitive 104 dependency: transitive
98 description: 105 description:
@@ -106,14 +113,14 @@ packages: @@ -106,14 +113,14 @@ packages:
106 name: term_glyph 113 name: term_glyph
107 url: "https://pub.dartlang.org" 114 url: "https://pub.dartlang.org"
108 source: hosted 115 source: hosted
109 - version: "1.0.1" 116 + version: "1.1.0"
110 test_api: 117 test_api:
111 dependency: transitive 118 dependency: transitive
112 description: 119 description:
113 name: test_api 120 name: test_api
114 url: "https://pub.dartlang.org" 121 url: "https://pub.dartlang.org"
115 source: hosted 122 source: hosted
116 - version: "0.2.1" 123 + version: "0.2.4"
117 typed_data: 124 typed_data:
118 dependency: transitive 125 dependency: transitive
119 description: 126 description:
@@ -129,4 +136,4 @@ packages: @@ -129,4 +136,4 @@ packages:
129 source: hosted 136 source: hosted
130 version: "2.0.8" 137 version: "2.0.8"
131 sdks: 138 sdks:
132 - dart: ">=2.0.0 <3.0.0" 139 + dart: ">=2.2.0 <3.0.0"