Showing
6 changed files
with
16 additions
and
8 deletions
@@ -5,12 +5,15 @@ | @@ -5,12 +5,15 @@ | ||
5 | * @LastEditTime: 2020年6月20日 11:20:02 | 5 | * @LastEditTime: 2020年6月20日 11:20:02 |
6 | * @Description: Update log | 6 | * @Description: Update log |
7 | --> | 7 | --> |
8 | + | ||
9 | +# 2.1.0 | ||
10 | +- add 'nsp' , you can use 'fontSize: 24.nsp' instead of 'fontSize: ScreenUtil().setSp(24, allowFontScalingSelf: false)' | ||
8 | 11 | ||
9 | -#2.0.0 | 12 | +# 2.0.0 |
10 | - Use `MediaQueryData.fromWindow(window)` instead of `MediaQuery.of(context)`, no context parameter required | 13 | - Use `MediaQueryData.fromWindow(window)` instead of `MediaQuery.of(context)`, no context parameter required |
11 | - API changes, please note | 14 | - API changes, please note |
12 | 15 | ||
13 | -#1.1.0 | 16 | +# 1.1.0 |
14 | - support ExtensionMethod Dart-SDK-2.6.0 | 17 | - support ExtensionMethod Dart-SDK-2.6.0 |
15 | - you can use 'width: 50.w' instead of 'width: ScreenUtil().setWidth(50)' | 18 | - you can use 'width: 50.w' instead of 'width: ScreenUtil().setWidth(50)' |
16 | '50.h' instead of 'ScreenUtil().setHeight(50)' | 19 | '50.h' instead of 'ScreenUtil().setHeight(50)' |
@@ -24,7 +24,7 @@ dependencies: | @@ -24,7 +24,7 @@ dependencies: | ||
24 | flutter: | 24 | flutter: |
25 | sdk: flutter | 25 | sdk: flutter |
26 | # add flutter_screenutil | 26 | # add flutter_screenutil |
27 | - flutter_screenutil: ^2.0.0 | 27 | + flutter_screenutil: ^2.1.0 |
28 | ``` | 28 | ``` |
29 | 29 | ||
30 | ### Add the following imports to your Dart code: | 30 | ### Add the following imports to your Dart code: |
@@ -71,6 +71,7 @@ ScreenUtil.init(width: 750, height: 1334, allowFontScaling: true); / | @@ -71,6 +71,7 @@ ScreenUtil.init(width: 750, height: 1334, allowFontScaling: true); / | ||
71 | ScreenUtil().setHeight(200) (sdk>=2.6 : 200.h) //Adapted to screen height | 71 | ScreenUtil().setHeight(200) (sdk>=2.6 : 200.h) //Adapted to screen height |
72 | ScreenUtil().setSp(24) (sdk>=2.6 : 24.sp) //Adapter font | 72 | ScreenUtil().setSp(24) (sdk>=2.6 : 24.sp) //Adapter font |
73 | ScreenUtil().setSp(24, allowFontScalingSelf: true) (sdk>=2.6 : 24.ssp) //Adapter font(fonts will scale to respect Text Size accessibility settings) | 73 | ScreenUtil().setSp(24, allowFontScalingSelf: true) (sdk>=2.6 : 24.ssp) //Adapter font(fonts will scale to respect Text Size accessibility settings) |
74 | + ScreenUtil().setSp(24, allowFontScalingSelf: false) (sdk>=2.6 : 24.nsp) //Adapter font(fonts will not scale to respect Text Size accessibility settings) | ||
74 | 75 | ||
75 | ScreenUtil.pixelRatio //Device pixel density | 76 | ScreenUtil.pixelRatio //Device pixel density |
76 | ScreenUtil.screenWidth //Device width | 77 | ScreenUtil.screenWidth //Device width |
@@ -29,7 +29,7 @@ dependencies: | @@ -29,7 +29,7 @@ dependencies: | ||
29 | flutter: | 29 | flutter: |
30 | sdk: flutter | 30 | sdk: flutter |
31 | # 添加依赖 | 31 | # 添加依赖 |
32 | - flutter_screenutil: ^2.0.0 | 32 | + flutter_screenutil: ^2.1.0 |
33 | ``` | 33 | ``` |
34 | 34 | ||
35 | ### 在每个使用的地方导入包: | 35 | ### 在每个使用的地方导入包: |
@@ -74,7 +74,8 @@ ScreenUtil.init(width: 750, height: 1334, allowFontScaling: true); / | @@ -74,7 +74,8 @@ ScreenUtil.init(width: 750, height: 1334, allowFontScaling: true); / | ||
74 | ScreenUtil().setWidth(540) (sdk>=2.6 : 540.w) //根据屏幕宽度适配尺寸 | 74 | ScreenUtil().setWidth(540) (sdk>=2.6 : 540.w) //根据屏幕宽度适配尺寸 |
75 | ScreenUtil().setHeight(200) (sdk>=2.6 : 200.h) //根据屏幕高度适配尺寸 | 75 | ScreenUtil().setHeight(200) (sdk>=2.6 : 200.h) //根据屏幕高度适配尺寸 |
76 | ScreenUtil().setSp(24) (sdk>=2.6 : 24.sp) //适配字体 | 76 | ScreenUtil().setSp(24) (sdk>=2.6 : 24.sp) //适配字体 |
77 | - ScreenUtil().setSp(24, allowFontScalingSelf: true) (sdk>=2.6 : 24.ssp) //适配字体(根据系统的“字体大小”辅助选项来进行缩放) | 77 | + ScreenUtil().setSp(24, allowFontScalingSelf: true) (sdk>=2.6 : 24.ssp) //适配字体(根据系统的“字体大小”辅助选项来进行缩放) |
78 | + ScreenUtil().setSp(24, allowFontScalingSelf: false) (sdk>=2.6 : 24.nsp) //适配字体(不会根据系统的“字体大小”辅助选项来进行缩放) | ||
78 | 79 | ||
79 | ScreenUtil.pixelRatio //设备的像素密度 | 80 | ScreenUtil.pixelRatio //设备的像素密度 |
80 | ScreenUtil.screenWidth //设备宽度 | 81 | ScreenUtil.screenWidth //设备宽度 |
@@ -24,7 +24,7 @@ dependencies: | @@ -24,7 +24,7 @@ dependencies: | ||
24 | flutter: | 24 | flutter: |
25 | sdk: flutter | 25 | sdk: flutter |
26 | # add flutter_screenutil | 26 | # add flutter_screenutil |
27 | - flutter_screenutil: ^2.0.0 | 27 | + flutter_screenutil: ^2.1.0 |
28 | ``` | 28 | ``` |
29 | 29 | ||
30 | ### Adicione o seguinte import em seu código Dart: | 30 | ### Adicione o seguinte import em seu código Dart: |
@@ -70,7 +70,8 @@ ScreenUtil.init(width: 750, height: 1334, allowFontScaling: true); / | @@ -70,7 +70,8 @@ ScreenUtil.init(width: 750, height: 1334, allowFontScaling: true); / | ||
70 | ScreenUtil().setWidth(540) (sdk>=2.6 : 540.w) //Adapted to screen width | 70 | ScreenUtil().setWidth(540) (sdk>=2.6 : 540.w) //Adapted to screen width |
71 | ScreenUtil().setHeight(200) (sdk>=2.6 : 200.h) //Adapted to screen height | 71 | ScreenUtil().setHeight(200) (sdk>=2.6 : 200.h) //Adapted to screen height |
72 | ScreenUtil().setSp(24) (sdk>=2.6 : 24.sp) //Adapter font | 72 | ScreenUtil().setSp(24) (sdk>=2.6 : 24.sp) //Adapter font |
73 | - ScreenUtil().setSp(24, allowFontScalingSelf: true) (sdk>=2.6 : 24.ssp) //Adapter font(fonts will scale to respect Text Size accessibility settings) | 73 | + ScreenUtil().setSp(24, allowFontScalingSelf: true) (sdk>=2.6 : 24.ssp) //Adapter font(fonts will scale to respect Text Size accessibility settings) |
74 | + ScreenUtil().setSp(24, allowFontScalingSelf: false) (sdk>=2.6 : 24.nsp) //Adapter font(fonts will not scale to respect Text Size accessibility settings) | ||
74 | 75 | ||
75 | ScreenUtil.pixelRatio //Device pixel density | 76 | ScreenUtil.pixelRatio //Device pixel density |
76 | ScreenUtil.screenWidth //Device width | 77 | ScreenUtil.screenWidth //Device width |
@@ -8,4 +8,6 @@ extension SizeExtension on num { | @@ -8,4 +8,6 @@ extension SizeExtension on num { | ||
8 | num get sp => ScreenUtil().setSp(this); | 8 | num get sp => ScreenUtil().setSp(this); |
9 | 9 | ||
10 | num get ssp => ScreenUtil().setSp(this, allowFontScalingSelf: true); | 10 | num get ssp => ScreenUtil().setSp(this, allowFontScalingSelf: true); |
11 | + | ||
12 | + num get nsp => ScreenUtil().setSp(this, allowFontScalingSelf: false); | ||
11 | } | 13 | } |
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: 2.0.0 | 3 | +version: 2.1.0 |
4 | homepage: https://github.com/OpenFlutter/flutter_screenutil | 4 | homepage: https://github.com/OpenFlutter/flutter_screenutil |
5 | 5 | ||
6 | environment: | 6 | environment: |
-
Please register or login to post a comment