Showing
14 changed files
with
152 additions
and
71 deletions
@@ -2,39 +2,47 @@ | @@ -2,39 +2,47 @@ | ||
2 | * @Author: zhuoyuan93@gmail.com | 2 | * @Author: zhuoyuan93@gmail.com |
3 | * @Date: 2018-10-16 19:43:03 | 3 | * @Date: 2018-10-16 19:43:03 |
4 | * @LastEditors: zhuoyuan93@gmail.com | 4 | * @LastEditors: zhuoyuan93@gmail.com |
5 | - * @LastEditTime: 2019-08-23 16:41:10 | 5 | + * @LastEditTime: 2019-11-19 11:41 |
6 | * @Description: Update log | 6 | * @Description: Update log |
7 | --> | 7 | --> |
8 | 8 | ||
9 | -# 0.0.1 | 9 | +# 0.7.0 |
10 | 10 | ||
11 | -- first version | 11 | +- 给所有方法添加返回类型. |
12 | 12 | ||
13 | -# 0.0.2 | 13 | +# 0.6.0 |
14 | 14 | ||
15 | -- Fixed bug when releasing | 15 | +- Completing comments , adding English commentsWelcome to add, correct |
16 | +- 参数同时支持传入 int / double 或者是var size = 100 , var size = 100.0. | ||
17 | +- The argument also supports passing in in / double / var size = 100 /var size = 100.0 | ||
16 | 18 | ||
17 | -# 0.2.2 | 19 | +# 0.5.3 |
18 | 20 | ||
19 | -- Optimize documentation | 21 | +- Change the units of statusBarHeight and bottomBarHeight to dp |
20 | 22 | ||
21 | -# 0.3.0 | 23 | +# 0.5.2 |
22 | 24 | ||
23 | -- Add font size adaptation | 25 | +- Change the parameter type from int to double |
24 | 26 | ||
25 | -# 0.3.1 | 27 | +- setWidth,setHeight,setSp. for example: you can use setWidth(100) or setWidth(100.0) |
26 | 28 | ||
27 | -- Perfect documentation | ||
28 | -- Width is enlarged relative to the design draft => The ratio of font and width to the size of the design | ||
29 | -- Height is enlarged relative to the design draft => The ratio of height width to the size of the design | 29 | +# 0.5.1 |
30 | 30 | ||
31 | -# 0.4.0 | 31 | +- Fix the wrong way of using |
32 | 32 | ||
33 | -- Optimize font adaptation method | 33 | +- It is recommended to use `ScreenUtil.getInstance()` instead of `ScreenUtil()` , for example: `ScreenUtil.getInstance().setHeight(25)` instead of `ScreenUtil().setHeight(25)` |
34 | 34 | ||
35 | -# 0.4.1 | 35 | +# 0.4.4 |
36 | 36 | ||
37 | -- Fix font adaptation issues | 37 | +- Fix bugs that default fonts change with the system |
38 | + | ||
39 | +# 0.4.3 | ||
40 | + | ||
41 | +- Modify the font to change with the system zoom mode. The default value is false. | ||
42 | + | ||
43 | +- setSp(int fontSize, [allowFontScaling = false]) => allowFontScaling | ||
44 | +? setWidth(fontSize) \* \_textScaleFactor | ||
45 | +: setWidth(fontSize); | ||
38 | 46 | ||
39 | # 0.4.2 | 47 | # 0.4.2 |
40 | 48 | ||
@@ -47,36 +55,37 @@ | @@ -47,36 +55,37 @@ | ||
47 | - ///当前设备高度 dp | 55 | - ///当前设备高度 dp |
48 | - ScreenUtil.screenHeightDp | 56 | - ScreenUtil.screenHeightDp |
49 | 57 | ||
50 | -# 0.4.3 | 58 | +# 0.4.1 |
51 | 59 | ||
52 | -- Modify the font to change with the system zoom mode. The default value is false. | 60 | +- Fix font adaptation issues |
53 | 61 | ||
54 | -- setSp(int fontSize, [allowFontScaling = false]) => allowFontScaling | ||
55 | -? setWidth(fontSize) \* \_textScaleFactor | ||
56 | -: setWidth(fontSize); | 62 | +# 0.4.0 |
57 | 63 | ||
58 | -# 0.4.4 | 64 | +- Optimize font adaptation method |
59 | 65 | ||
60 | -- Fix bugs that default fonts change with the system | 66 | +# 0.3.1 |
61 | 67 | ||
62 | -# 0.5.1 | 68 | +- Perfect documentation |
69 | +- Width is enlarged relative to the design draft => The ratio of font and width to the size of the design | ||
70 | +- Height is enlarged relative to the design draft => The ratio of height width to the size of the design | ||
63 | 71 | ||
64 | -- Fix the wrong way of using | ||
65 | 72 | ||
66 | -- It is recommended to use `ScreenUtil.getInstance()` instead of `ScreenUtil()` , for example: `ScreenUtil.getInstance().setHeight(25)` instead of `ScreenUtil().setHeight(25)` | 73 | +# 0.3.0 |
67 | 74 | ||
68 | -# 0.5.2 | 75 | +- Add font size adaptation |
69 | 76 | ||
70 | -- Change the parameter type from int to double | 77 | +# 0.2.2 |
71 | 78 | ||
72 | -- setWidth,setHeight,setSp. for example: you can use setWidth(100) or setWidth(100.0) | 79 | +- Optimize documentation |
80 | + | ||
81 | +# 0.0.2 | ||
82 | + | ||
83 | +- Fixed bug when releasing | ||
84 | + | ||
85 | +# 0.0.1 | ||
86 | + | ||
87 | +- first version | ||
73 | 88 | ||
74 | -# 0.5.3 | ||
75 | 89 | ||
76 | -- Change the units of statusBarHeight and bottomBarHeight to dp | ||
77 | 90 | ||
78 | -# 0.6.0 | ||
79 | 91 | ||
80 | -- Completing comments , adding English commentsWelcome to add, correct | ||
81 | -- 参数同时支持传入 int / double 或者是var size = 100 , var size = 100.0. | ||
82 | -- The argument also supports passing in in / double / var size = 100 /var size = 100.0 |
@@ -143,7 +143,7 @@ Column( | @@ -143,7 +143,7 @@ Column( | ||
143 | //import | 143 | //import |
144 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 144 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
145 | 145 | ||
146 | -...dart | 146 | +... |
147 | 147 | ||
148 | @override | 148 | @override |
149 | Widget build(BuildContext context) { | 149 | Widget build(BuildContext context) { |
@@ -178,6 +178,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -178,6 +178,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
178 | Row( | 178 | Row( |
179 | children: <Widget>[ | 179 | children: <Widget>[ |
180 | Container( | 180 | Container( |
181 | + padding: EdgeInsets.all(ScreenUtil.getInstance().setWidth(10)), | ||
181 | width: ScreenUtil.getInstance().setWidth(375), | 182 | width: ScreenUtil.getInstance().setWidth(375), |
182 | height: ScreenUtil.getInstance().setHeight(200), | 183 | height: ScreenUtil.getInstance().setHeight(200), |
183 | color: Colors.red, | 184 | color: Colors.red, |
@@ -189,6 +190,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -189,6 +190,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
189 | ), | 190 | ), |
190 | ), | 191 | ), |
191 | Container( | 192 | Container( |
193 | + padding: EdgeInsets.all(ScreenUtil.getInstance().setWidth(10)), | ||
192 | width: ScreenUtil.getInstance().setWidth(375), | 194 | width: ScreenUtil.getInstance().setWidth(375), |
193 | height: ScreenUtil.getInstance().setHeight(200), | 195 | height: ScreenUtil.getInstance().setHeight(200), |
194 | color: Colors.blue, | 196 | color: Colors.blue, |
@@ -136,12 +136,12 @@ Column( | @@ -136,12 +136,12 @@ Column( | ||
136 | 136 | ||
137 | ``` | 137 | ``` |
138 | 138 | ||
139 | -``` | 139 | +```dart |
140 | //导入 | 140 | //导入 |
141 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 141 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
142 | 142 | ||
143 | ... | 143 | ... |
144 | - | 144 | + |
145 | @override | 145 | @override |
146 | Widget build(BuildContext context) { | 146 | Widget build(BuildContext context) { |
147 | //设置适配尺寸 (填入设计稿中设备的屏幕尺寸) 假如设计稿是按iPhone6的尺寸设计的(iPhone6 750*1334) | 147 | //设置适配尺寸 (填入设计稿中设备的屏幕尺寸) 假如设计稿是按iPhone6的尺寸设计的(iPhone6 750*1334) |
@@ -175,6 +175,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -175,6 +175,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
175 | Row( | 175 | Row( |
176 | children: <Widget>[ | 176 | children: <Widget>[ |
177 | Container( | 177 | Container( |
178 | + padding: EdgeInsets.all(ScreenUtil.getInstance().setWidth(10)), | ||
178 | width: ScreenUtil.getInstance().setWidth(375), | 179 | width: ScreenUtil.getInstance().setWidth(375), |
179 | height: ScreenUtil.getInstance().setHeight(200), | 180 | height: ScreenUtil.getInstance().setHeight(200), |
180 | color: Colors.red, | 181 | color: Colors.red, |
@@ -187,6 +188,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -187,6 +188,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
187 | ), | 188 | ), |
188 | ), | 189 | ), |
189 | Container( | 190 | Container( |
191 | + padding: EdgeInsets.all(ScreenUtil.getInstance().setWidth(10)), | ||
190 | width: ScreenUtil.getInstance().setWidth(375), | 192 | width: ScreenUtil.getInstance().setWidth(375), |
191 | height: ScreenUtil.getInstance().setHeight(200), | 193 | height: ScreenUtil.getInstance().setHeight(200), |
192 | color: Colors.blue, | 194 | color: Colors.blue, |
example/android/.project
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<projectDescription> | ||
3 | + <name>android</name> | ||
4 | + <comment>Project android created by Buildship.</comment> | ||
5 | + <projects> | ||
6 | + </projects> | ||
7 | + <buildSpec> | ||
8 | + <buildCommand> | ||
9 | + <name>org.eclipse.buildship.core.gradleprojectbuilder</name> | ||
10 | + <arguments> | ||
11 | + </arguments> | ||
12 | + </buildCommand> | ||
13 | + </buildSpec> | ||
14 | + <natures> | ||
15 | + <nature>org.eclipse.buildship.core.gradleprojectnature</nature> | ||
16 | + </natures> | ||
17 | +</projectDescription> |
example/android/app/.classpath
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<classpath> | ||
3 | + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/> | ||
4 | + <classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/> | ||
5 | + <classpathentry kind="output" path="bin/default"/> | ||
6 | +</classpath> |
example/android/app/.project
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<projectDescription> | ||
3 | + <name>app</name> | ||
4 | + <comment>Project app created by Buildship.</comment> | ||
5 | + <projects> | ||
6 | + </projects> | ||
7 | + <buildSpec> | ||
8 | + <buildCommand> | ||
9 | + <name>org.eclipse.jdt.core.javabuilder</name> | ||
10 | + <arguments> | ||
11 | + </arguments> | ||
12 | + </buildCommand> | ||
13 | + <buildCommand> | ||
14 | + <name>org.eclipse.buildship.core.gradleprojectbuilder</name> | ||
15 | + <arguments> | ||
16 | + </arguments> | ||
17 | + </buildCommand> | ||
18 | + </buildSpec> | ||
19 | + <natures> | ||
20 | + <nature>org.eclipse.jdt.core.javanature</nature> | ||
21 | + <nature>org.eclipse.buildship.core.gradleprojectnature</nature> | ||
22 | + </natures> | ||
23 | +</projectDescription> |
1 | +#!/bin/sh | ||
2 | +# This is a generated file; do not edit or check into version control. | ||
3 | +export "FLUTTER_ROOT=D:\flutter" | ||
4 | +export "FLUTTER_APPLICATION_PATH=D:\Project\flutter_ScreenUtil\example" | ||
5 | +export "FLUTTER_TARGET=lib\main.dart" | ||
6 | +export "FLUTTER_BUILD_DIR=build" | ||
7 | +export "SYMROOT=${SOURCE_ROOT}/../build\ios" | ||
8 | +export "FLUTTER_FRAMEWORK_DIR=D:\flutter\bin\cache\artifacts\engine\ios" | ||
9 | +export "FLUTTER_BUILD_NAME=1.0.0" | ||
10 | +export "FLUTTER_BUILD_NUMBER=1" |
@@ -61,6 +61,8 @@ class _MyHomePageState extends State<MyHomePage> { | @@ -61,6 +61,8 @@ class _MyHomePageState extends State<MyHomePage> { | ||
61 | Row( | 61 | Row( |
62 | children: <Widget>[ | 62 | children: <Widget>[ |
63 | Container( | 63 | Container( |
64 | + padding: | ||
65 | + EdgeInsets.all(ScreenUtil.getInstance().setWidth(10)), | ||
64 | width: ScreenUtil.getInstance().setWidth(375), | 66 | width: ScreenUtil.getInstance().setWidth(375), |
65 | height: ScreenUtil.getInstance().setHeight(200), | 67 | height: ScreenUtil.getInstance().setHeight(200), |
66 | color: Colors.red, | 68 | color: Colors.red, |
@@ -72,6 +74,8 @@ class _MyHomePageState extends State<MyHomePage> { | @@ -72,6 +74,8 @@ class _MyHomePageState extends State<MyHomePage> { | ||
72 | ), | 74 | ), |
73 | ), | 75 | ), |
74 | Container( | 76 | Container( |
77 | + padding: | ||
78 | + EdgeInsets.all(ScreenUtil.getInstance().setWidth(10)), | ||
75 | width: ScreenUtil.getInstance().setWidth(375), | 79 | width: ScreenUtil.getInstance().setWidth(375), |
76 | height: ScreenUtil.getInstance().setHeight(200), | 80 | height: ScreenUtil.getInstance().setHeight(200), |
77 | color: Colors.blue, | 81 | color: Colors.blue, |
@@ -48,7 +48,7 @@ class _MyHomePageState extends State<MyHomePage> { | @@ -48,7 +48,7 @@ class _MyHomePageState extends State<MyHomePage> { | ||
48 | print( | 48 | print( |
49 | '高度相对于设计稿放大的比例:${ScreenUtil.getInstance().scaleHeight * ScreenUtil.pixelRatio}'); | 49 | '高度相对于设计稿放大的比例:${ScreenUtil.getInstance().scaleHeight * ScreenUtil.pixelRatio}'); |
50 | print('系统的字体缩放比例:${ScreenUtil.textScaleFactory}'); | 50 | print('系统的字体缩放比例:${ScreenUtil.textScaleFactory}'); |
51 | - | 51 | + |
52 | return Scaffold( | 52 | return Scaffold( |
53 | appBar: AppBar( | 53 | appBar: AppBar( |
54 | title: Text(widget.title), | 54 | title: Text(widget.title), |
@@ -68,6 +68,8 @@ class _MyHomePageState extends State<MyHomePage> { | @@ -68,6 +68,8 @@ class _MyHomePageState extends State<MyHomePage> { | ||
68 | Row( | 68 | Row( |
69 | children: <Widget>[ | 69 | children: <Widget>[ |
70 | Container( | 70 | Container( |
71 | + padding: | ||
72 | + EdgeInsets.all(ScreenUtil.getInstance().setWidth(10)), | ||
71 | width: ScreenUtil.getInstance().setWidth(375), | 73 | width: ScreenUtil.getInstance().setWidth(375), |
72 | height: ScreenUtil.getInstance().setHeight(200), | 74 | height: ScreenUtil.getInstance().setHeight(200), |
73 | color: Colors.red, | 75 | color: Colors.red, |
@@ -80,6 +82,8 @@ class _MyHomePageState extends State<MyHomePage> { | @@ -80,6 +82,8 @@ class _MyHomePageState extends State<MyHomePage> { | ||
80 | ), | 82 | ), |
81 | ), | 83 | ), |
82 | Container( | 84 | Container( |
85 | + padding: | ||
86 | + EdgeInsets.all(ScreenUtil.getInstance().setWidth(10)), | ||
83 | width: ScreenUtil.getInstance().setWidth(375), | 87 | width: ScreenUtil.getInstance().setWidth(375), |
84 | height: ScreenUtil.getInstance().setHeight(200), | 88 | height: ScreenUtil.getInstance().setHeight(200), |
85 | color: Colors.blue, | 89 | color: Colors.blue, |
@@ -5,35 +5,35 @@ packages: | @@ -5,35 +5,35 @@ packages: | ||
5 | dependency: transitive | 5 | dependency: transitive |
6 | description: | 6 | description: |
7 | name: async | 7 | name: async |
8 | - url: "https://pub.flutter-io.cn" | 8 | + url: "https://pub.dartlang.org" |
9 | source: hosted | 9 | source: hosted |
10 | - version: "2.2.0" | 10 | + version: "2.3.0" |
11 | boolean_selector: | 11 | boolean_selector: |
12 | dependency: transitive | 12 | dependency: transitive |
13 | description: | 13 | description: |
14 | name: boolean_selector | 14 | name: boolean_selector |
15 | - url: "https://pub.flutter-io.cn" | 15 | + url: "https://pub.dartlang.org" |
16 | source: hosted | 16 | source: hosted |
17 | - version: "1.0.4" | 17 | + version: "1.0.5" |
18 | charcode: | 18 | charcode: |
19 | dependency: transitive | 19 | dependency: transitive |
20 | description: | 20 | description: |
21 | name: charcode | 21 | name: charcode |
22 | - url: "https://pub.flutter-io.cn" | 22 | + url: "https://pub.dartlang.org" |
23 | source: hosted | 23 | source: hosted |
24 | version: "1.1.2" | 24 | version: "1.1.2" |
25 | collection: | 25 | collection: |
26 | dependency: transitive | 26 | dependency: transitive |
27 | description: | 27 | description: |
28 | name: collection | 28 | name: collection |
29 | - url: "https://pub.flutter-io.cn" | 29 | + url: "https://pub.dartlang.org" |
30 | source: hosted | 30 | source: hosted |
31 | version: "1.14.11" | 31 | version: "1.14.11" |
32 | cupertino_icons: | 32 | cupertino_icons: |
33 | dependency: "direct main" | 33 | dependency: "direct main" |
34 | description: | 34 | description: |
35 | name: cupertino_icons | 35 | name: cupertino_icons |
36 | - url: "https://pub.flutter-io.cn" | 36 | + url: "https://pub.dartlang.org" |
37 | source: hosted | 37 | source: hosted |
38 | version: "0.1.2" | 38 | version: "0.1.2" |
39 | flutter: | 39 | flutter: |
@@ -57,37 +57,37 @@ packages: | @@ -57,37 +57,37 @@ packages: | ||
57 | dependency: transitive | 57 | dependency: transitive |
58 | description: | 58 | description: |
59 | name: matcher | 59 | name: matcher |
60 | - url: "https://pub.flutter-io.cn" | 60 | + url: "https://pub.dartlang.org" |
61 | source: hosted | 61 | source: hosted |
62 | version: "0.12.5" | 62 | version: "0.12.5" |
63 | meta: | 63 | meta: |
64 | dependency: transitive | 64 | dependency: transitive |
65 | description: | 65 | description: |
66 | name: meta | 66 | name: meta |
67 | - url: "https://pub.flutter-io.cn" | 67 | + url: "https://pub.dartlang.org" |
68 | source: hosted | 68 | source: hosted |
69 | - version: "1.1.6" | 69 | + version: "1.1.7" |
70 | path: | 70 | path: |
71 | dependency: transitive | 71 | dependency: transitive |
72 | description: | 72 | description: |
73 | name: path | 73 | name: path |
74 | - url: "https://pub.flutter-io.cn" | 74 | + url: "https://pub.dartlang.org" |
75 | source: hosted | 75 | source: hosted |
76 | - version: "1.6.2" | 76 | + version: "1.6.4" |
77 | pedantic: | 77 | pedantic: |
78 | dependency: transitive | 78 | dependency: transitive |
79 | description: | 79 | description: |
80 | name: pedantic | 80 | name: pedantic |
81 | - url: "https://pub.flutter-io.cn" | 81 | + url: "https://pub.dartlang.org" |
82 | source: hosted | 82 | source: hosted |
83 | - version: "1.7.0" | 83 | + version: "1.8.0+1" |
84 | quiver: | 84 | quiver: |
85 | dependency: transitive | 85 | dependency: transitive |
86 | description: | 86 | description: |
87 | name: quiver | 87 | name: quiver |
88 | - url: "https://pub.flutter-io.cn" | 88 | + url: "https://pub.dartlang.org" |
89 | source: hosted | 89 | source: hosted |
90 | - version: "2.0.3" | 90 | + version: "2.0.5" |
91 | sky_engine: | 91 | sky_engine: |
92 | dependency: transitive | 92 | dependency: transitive |
93 | description: flutter | 93 | description: flutter |
@@ -97,56 +97,56 @@ packages: | @@ -97,56 +97,56 @@ packages: | ||
97 | dependency: transitive | 97 | dependency: transitive |
98 | description: | 98 | description: |
99 | name: source_span | 99 | name: source_span |
100 | - url: "https://pub.flutter-io.cn" | 100 | + url: "https://pub.dartlang.org" |
101 | source: hosted | 101 | source: hosted |
102 | version: "1.5.5" | 102 | version: "1.5.5" |
103 | stack_trace: | 103 | stack_trace: |
104 | dependency: transitive | 104 | dependency: transitive |
105 | description: | 105 | description: |
106 | name: stack_trace | 106 | name: stack_trace |
107 | - url: "https://pub.flutter-io.cn" | 107 | + url: "https://pub.dartlang.org" |
108 | source: hosted | 108 | source: hosted |
109 | version: "1.9.3" | 109 | version: "1.9.3" |
110 | stream_channel: | 110 | stream_channel: |
111 | dependency: transitive | 111 | dependency: transitive |
112 | description: | 112 | description: |
113 | name: stream_channel | 113 | name: stream_channel |
114 | - url: "https://pub.flutter-io.cn" | 114 | + url: "https://pub.dartlang.org" |
115 | source: hosted | 115 | source: hosted |
116 | version: "2.0.0" | 116 | version: "2.0.0" |
117 | string_scanner: | 117 | string_scanner: |
118 | dependency: transitive | 118 | dependency: transitive |
119 | description: | 119 | description: |
120 | name: string_scanner | 120 | name: string_scanner |
121 | - url: "https://pub.flutter-io.cn" | 121 | + url: "https://pub.dartlang.org" |
122 | source: hosted | 122 | source: hosted |
123 | - version: "1.0.4" | 123 | + version: "1.0.5" |
124 | term_glyph: | 124 | term_glyph: |
125 | dependency: transitive | 125 | dependency: transitive |
126 | description: | 126 | description: |
127 | name: term_glyph | 127 | name: term_glyph |
128 | - url: "https://pub.flutter-io.cn" | 128 | + url: "https://pub.dartlang.org" |
129 | source: hosted | 129 | source: hosted |
130 | version: "1.1.0" | 130 | version: "1.1.0" |
131 | test_api: | 131 | test_api: |
132 | dependency: transitive | 132 | dependency: transitive |
133 | description: | 133 | description: |
134 | name: test_api | 134 | name: test_api |
135 | - url: "https://pub.flutter-io.cn" | 135 | + url: "https://pub.dartlang.org" |
136 | source: hosted | 136 | source: hosted |
137 | version: "0.2.5" | 137 | version: "0.2.5" |
138 | typed_data: | 138 | typed_data: |
139 | dependency: transitive | 139 | dependency: transitive |
140 | description: | 140 | description: |
141 | name: typed_data | 141 | name: typed_data |
142 | - url: "https://pub.flutter-io.cn" | 142 | + url: "https://pub.dartlang.org" |
143 | source: hosted | 143 | source: hosted |
144 | version: "1.1.6" | 144 | version: "1.1.6" |
145 | vector_math: | 145 | vector_math: |
146 | dependency: transitive | 146 | dependency: transitive |
147 | description: | 147 | description: |
148 | name: vector_math | 148 | name: vector_math |
149 | - url: "https://pub.flutter-io.cn" | 149 | + url: "https://pub.dartlang.org" |
150 | source: hosted | 150 | source: hosted |
151 | version: "2.0.8" | 151 | version: "2.0.8" |
152 | sdks: | 152 | sdks: |
@@ -84,16 +84,16 @@ class ScreenUtil { | @@ -84,16 +84,16 @@ class ScreenUtil { | ||
84 | 84 | ||
85 | /// 实际的dp与UI设计px的比例 | 85 | /// 实际的dp与UI设计px的比例 |
86 | /// The ratio of the actual dp to the design draft px | 86 | /// The ratio of the actual dp to the design draft px |
87 | - get scaleWidth => _screenWidth / instance.width; | 87 | + double get scaleWidth => _screenWidth / instance.width; |
88 | 88 | ||
89 | - get scaleHeight => _screenHeight / instance.height; | 89 | + double get scaleHeight => _screenHeight / instance.height; |
90 | 90 | ||
91 | /// 根据UI设计的设备宽度适配 | 91 | /// 根据UI设计的设备宽度适配 |
92 | /// 高度也可以根据这个来做适配可以保证不变形,比如你先要一个正方形的时候. | 92 | /// 高度也可以根据这个来做适配可以保证不变形,比如你先要一个正方形的时候. |
93 | /// Adapted to the device width of the UI Design. | 93 | /// Adapted to the device width of the UI Design. |
94 | /// Height can also be adapted according to this to ensure no deformation , | 94 | /// Height can also be adapted according to this to ensure no deformation , |
95 | /// if you want a square | 95 | /// if you want a square |
96 | - setWidth(num width) => width * scaleWidth; | 96 | + num setWidth(num width) => width * scaleWidth; |
97 | 97 | ||
98 | /// 根据UI设计的设备高度适配 | 98 | /// 根据UI设计的设备高度适配 |
99 | /// 当发现UI设计中的一屏显示的与当前样式效果不符合时, | 99 | /// 当发现UI设计中的一屏显示的与当前样式效果不符合时, |
@@ -103,14 +103,14 @@ class ScreenUtil { | @@ -103,14 +103,14 @@ class ScreenUtil { | ||
103 | /// It is recommended to use this method to achieve a high degree of adaptation | 103 | /// It is recommended to use this method to achieve a high degree of adaptation |
104 | /// when it is found that one screen in the UI design | 104 | /// when it is found that one screen in the UI design |
105 | /// does not match the current style effect, or if there is a difference in shape. | 105 | /// does not match the current style effect, or if there is a difference in shape. |
106 | - setHeight(num height) => height * scaleHeight; | 106 | + num setHeight(num height) => height * scaleHeight; |
107 | 107 | ||
108 | ///字体大小适配方法 | 108 | ///字体大小适配方法 |
109 | ///@param [fontSize] UI设计上字体的大小,单位px. | 109 | ///@param [fontSize] UI设计上字体的大小,单位px. |
110 | ///Font size adaptation method | 110 | ///Font size adaptation method |
111 | ///@param [fontSize] The size of the font on the UI design, in px. | 111 | ///@param [fontSize] The size of the font on the UI design, in px. |
112 | ///@param [allowFontScaling] | 112 | ///@param [allowFontScaling] |
113 | - setSp(num fontSize) => allowFontScaling | 113 | + num setSp(num fontSize) => allowFontScaling |
114 | ? setWidth(fontSize) | 114 | ? setWidth(fontSize) |
115 | : setWidth(fontSize) / _textScaleFactor; | 115 | : setWidth(fontSize) / _textScaleFactor; |
116 | } | 116 | } |
1 | name: flutter_screenutil | 1 | name: flutter_screenutil |
2 | description: A flutter plugin for adapting screen and font size.Guaranteed to look good on different models | 2 | description: A flutter plugin for adapting screen and font size.Guaranteed to look good on different models |
3 | -version: 0.6.0 | 3 | +version: 0.6.1 |
4 | author: LiZhuoyuan <zhuoyuan93@gmail.com> | 4 | author: LiZhuoyuan <zhuoyuan93@gmail.com> |
5 | homepage: https://github.com/OpenFlutter/flutter_ScreenUtil | 5 | homepage: https://github.com/OpenFlutter/flutter_ScreenUtil |
6 | 6 |
-
Please register or login to post a comment