李卓原

0.5.2

Change the parameter type from int to double
@@ -34,4 +34,10 @@ setSp(int fontSize, [allowFontScaling = false]) => allowFontScaling @@ -34,4 +34,10 @@ setSp(int fontSize, [allowFontScaling = false]) => allowFontScaling
34 34
35 ## [0.5.1] - Fix the wrong way of using 35 ## [0.5.1] - Fix the wrong way of using
36 36
37 -It is recommended to use `ScreenUtil.getInstance()` instead of `ScreenUtil()` , for example: `ScreenUtil.getInstance().setHeight(25)` instead of `ScreenUtil().setHeight(25)`  
  37 +It is recommended to use `ScreenUtil.getInstance()` instead of `ScreenUtil()` , for example: `ScreenUtil.getInstance().setHeight(25)` instead of `ScreenUtil().setHeight(25)`
  38 +
  39 +## [0.5.2] - Change the parameter type from int to double
  40 +
  41 +setWidth,setHeight,setSp.
  42 +for example:
  43 +you can use setWidth(100) or setWidth(100.0)
@@ -21,7 +21,7 @@ dependencies: @@ -21,7 +21,7 @@ dependencies:
21 flutter: 21 flutter:
22 sdk: flutter 22 sdk: flutter
23 # add flutter_ScreenUtil 23 # add flutter_ScreenUtil
24 - flutter_screenutil: ^0.4.2 24 + flutter_screenutil: ^0.5.2
25 ``` 25 ```
26 26
27 ### Add the following imports to your Dart code: 27 ### Add the following imports to your Dart code:
@@ -33,8 +33,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -33,8 +33,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
33 33
34 |Property|Type|Default Value|Description| 34 |Property|Type|Default Value|Description|
35 |:---|:---|:---|:---| 35 |:---|:---|:---|:---|
36 -|width|int|1080px|The width of the device in the design draft, in px|  
37 -|height|int|1920px|The height of the device in the design draft, in px| 36 +|width|double|1080px|The width of the device in the design draft, in px|
  37 +|height|double|1920px|The height of the device in the design draft, in px|
38 |allowFontScaling|bool|false|Sets whether the font size is scaled according to the system's "font size" assist option| 38 |allowFontScaling|bool|false|Sets whether the font size is scaled according to the system's "font size" assist option|
39 39
40 ### Initialize and set the fit size and font size to scale according to the system's "font size" accessibility option 40 ### Initialize and set the fit size and font size to scale according to the system's "font size" accessibility option
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 10
11 [README of English](https://github.com/OpenFlutter/flutter_ScreenUtil/blob/master/README.md) 11 [README of English](https://github.com/OpenFlutter/flutter_ScreenUtil/blob/master/README.md)
12 12
13 -github: https://github.com/OpenFlutter/flutter_ScreenUtil 13 +github: https://github.com/OpenFlutter/flutter_screenutil
14 14
15 csdn博客工具介绍:https://blog.csdn.net/u011272795/article/details/82795477 15 csdn博客工具介绍:https://blog.csdn.net/u011272795/article/details/82795477
16 16
@@ -26,7 +26,7 @@ dependencies: @@ -26,7 +26,7 @@ dependencies:
26 flutter: 26 flutter:
27 sdk: flutter 27 sdk: flutter
28 # 添加依赖 28 # 添加依赖
29 - flutter_screenutil: ^0.5.0 29 + flutter_screenutil: ^0.5.2
30 ``` 30 ```
31 31
32 ### 在每个使用的地方导入包: 32 ### 在每个使用的地方导入包:
@@ -38,8 +38,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -38,8 +38,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
38 38
39 |属性|类型|默认值|描述| 39 |属性|类型|默认值|描述|
40 |:---|:---|:---|:---| 40 |:---|:---|:---|:---|
41 -|width|int|1080px|设计稿中设备的宽度,单位px|  
42 -|height|int|1920px|设计稿中设备的高度,单位px| 41 +|width|double|1080px|设计稿中设备的宽度,单位px|
  42 +|height|double|1920px|设计稿中设备的高度,单位px|
43 |allowFontScaling|bool|false|设置字体大小是否根据系统的“字体大小”辅助选项来进行缩放| 43 |allowFontScaling|bool|false|设置字体大小是否根据系统的“字体大小”辅助选项来进行缩放|
44 44
45 ### 初始化并设置适配尺寸及字体大小是否根据系统的“字体大小”辅助选项来进行缩放 45 ### 初始化并设置适配尺寸及字体大小是否根据系统的“字体大小”辅助选项来进行缩放
@@ -74,6 +74,13 @@ packages: @@ -74,6 +74,13 @@ packages:
74 url: "https://pub.dartlang.org" 74 url: "https://pub.dartlang.org"
75 source: hosted 75 source: hosted
76 version: "1.6.2" 76 version: "1.6.2"
  77 + pedantic:
  78 + dependency: transitive
  79 + description:
  80 + name: pedantic
  81 + url: "https://pub.dartlang.org"
  82 + source: hosted
  83 + version: "1.5.0"
77 quiver: 84 quiver:
78 dependency: transitive 85 dependency: transitive
79 description: 86 description:
@@ -92,7 +99,7 @@ packages: @@ -92,7 +99,7 @@ packages:
92 name: source_span 99 name: source_span
93 url: "https://pub.dartlang.org" 100 url: "https://pub.dartlang.org"
94 source: hosted 101 source: hosted
95 - version: "1.4.1" 102 + version: "1.5.5"
96 stack_trace: 103 stack_trace:
97 dependency: transitive 104 dependency: transitive
98 description: 105 description:
@@ -120,14 +127,14 @@ packages: @@ -120,14 +127,14 @@ packages:
120 name: term_glyph 127 name: term_glyph
121 url: "https://pub.dartlang.org" 128 url: "https://pub.dartlang.org"
122 source: hosted 129 source: hosted
123 - version: "1.0.1" 130 + version: "1.1.0"
124 test_api: 131 test_api:
125 dependency: transitive 132 dependency: transitive
126 description: 133 description:
127 name: test_api 134 name: test_api
128 url: "https://pub.dartlang.org" 135 url: "https://pub.dartlang.org"
129 source: hosted 136 source: hosted
130 - version: "0.2.1" 137 + version: "0.2.2"
131 typed_data: 138 typed_data:
132 dependency: transitive 139 dependency: transitive
133 description: 140 description:
@@ -143,4 +150,4 @@ packages: @@ -143,4 +150,4 @@ packages:
143 source: hosted 150 source: hosted
144 version: "2.0.8" 151 version: "2.0.8"
145 sdks: 152 sdks:
146 - dart: ">=2.0.0 <3.0.0" 153 + dart: ">=2.1.1-dev.0.0 <3.0.0"
@@ -9,8 +9,8 @@ class ScreenUtil { @@ -9,8 +9,8 @@ class ScreenUtil {
9 static ScreenUtil instance = new ScreenUtil(); 9 static ScreenUtil instance = new ScreenUtil();
10 10
11 //设计稿的设备尺寸修改 11 //设计稿的设备尺寸修改
12 - int width;  
13 - int height; 12 + double width;
  13 + double height;
14 bool allowFontScaling; 14 bool allowFontScaling;
15 15
16 static MediaQueryData _mediaQueryData; 16 static MediaQueryData _mediaQueryData;
@@ -77,19 +77,19 @@ class ScreenUtil { @@ -77,19 +77,19 @@ class ScreenUtil {
77 77
78 ///根据设计稿的设备宽度适配 78 ///根据设计稿的设备宽度适配
79 ///高度也根据这个来做适配可以保证不变形 79 ///高度也根据这个来做适配可以保证不变形
80 - setWidth(int width) => width * scaleWidth; 80 + setWidth(double width) => width * scaleWidth;
81 81
82 /// 根据设计稿的设备高度适配 82 /// 根据设计稿的设备高度适配
83 /// 当发现设计稿中的一屏显示的与当前样式效果不符合时, 83 /// 当发现设计稿中的一屏显示的与当前样式效果不符合时,
84 /// 或者形状有差异时,高度适配建议使用此方法 84 /// 或者形状有差异时,高度适配建议使用此方法
85 /// 高度适配主要针对想根据设计稿的一屏展示一样的效果 85 /// 高度适配主要针对想根据设计稿的一屏展示一样的效果
86 - setHeight(int height) => height * scaleHeight; 86 + setHeight(double height) => height * scaleHeight;
87 87
88 ///字体大小适配方法 88 ///字体大小适配方法
89 ///@param fontSize 传入设计稿上字体的px , 89 ///@param fontSize 传入设计稿上字体的px ,
90 ///@param allowFontScaling 控制字体是否要根据系统的“字体大小”辅助选项来进行缩放。默认值为false。 90 ///@param allowFontScaling 控制字体是否要根据系统的“字体大小”辅助选项来进行缩放。默认值为false。
91 ///@param allowFontScaling Specifies whether fonts should scale to respect Text Size accessibility settings. The default is false. 91 ///@param allowFontScaling Specifies whether fonts should scale to respect Text Size accessibility settings. The default is false.
92 - setSp(int fontSize) => allowFontScaling 92 + setSp(double fontSize) => allowFontScaling
93 ? setWidth(fontSize) 93 ? setWidth(fontSize)
94 : setWidth(fontSize) / _textScaleFactor; 94 : setWidth(fontSize) / _textScaleFactor;
95 } 95 }
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.5.1 3 +version: 0.5.2
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