Skip to content

Commit

Permalink
3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
李卓原 committed Oct 22, 2020
1 parent 2619cd4 commit d51945e
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 25 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
* @Description: Update log
-->

# 3.2.0
- Modify the method name to be more semantic: wp->sw , hp->sh
- Remove the restriction of flutter version
- Modify the return type num to double

# 3.1.1
- change readme

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@ ScreenUtil.init(context, designSize: Size(750, 1334), allowFontScaling: true);
ScreenUtil().setSp(24, allowFontScalingSelf: false) (sdk>=2.6 : 24.nsp) //Adapter font(fonts will not scale to respect Text Size accessibility settings)
ScreenUtil().pixelRatio //Device pixel density
ScreenUtil().screenWidth (sdk>=2.6 : 1.wp) //Device width
ScreenUtil().screenHeight (sdk>=2.6 : 1.hp) //Device height
ScreenUtil().screenWidth (sdk>=2.6 : 1.sw) //Device width
ScreenUtil().screenHeight (sdk>=2.6 : 1.sh) //Device height
ScreenUtil().bottomBarHeight //Bottom safe zone distance, suitable for buttons with full screen
ScreenUtil().statusBarHeight //Status bar height , Notch will be higher Unit px
ScreenUtil().textScaleFactor //System font scaling factor
ScreenUtil().scaleWidth //Ratio of actual width dp to design draft px
ScreenUtil().scaleHeight //Ratio of actual height dp to design draft px
0.2.wp //0.2 times the screen width
0.5.hp //50% of screen height
0.2.sw //0.2 times the screen width
0.5.sh //50% of screen height
```

#### Adapt screen size:
Expand Down
14 changes: 7 additions & 7 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,17 @@ ScreenUtil.init(context, designSize: Size(750, 1334), allowFontScaling: true);
ScreenUtil().setSp(24, allowFontScalingSelf: false) (sdk>=2.6 : 24.nsp) //适配字体(不会根据系统的“字体大小”辅助选项来进行缩放)
ScreenUtil.pixelRatio //设备的像素密度
ScreenUtil.screenWidth (sdk>=2.6 : 1.wp) //设备宽度
ScreenUtil.screenHeight (sdk>=2.6 : 1.hp) //设备高度
ScreenUtil.screenWidth (sdk>=2.6 : 1.sw) //设备宽度
ScreenUtil.screenHeight (sdk>=2.6 : 1.sh) //设备高度
ScreenUtil.bottomBarHeight //底部安全区距离,适用于全面屏下面有按键的
ScreenUtil.statusBarHeight //状态栏高度 刘海屏会更高 单位px
ScreenUtil.textScaleFactor //系统字体缩放比例
ScreenUtil().scaleWidth // 实际宽度的dp与设计稿px的比例
ScreenUtil().scaleHeight // 实际高度的dp与设计稿px的比例
0.2.wp //屏幕宽度的0.2倍
0.5.hp //屏幕高度的50%
0.2.sw //屏幕宽度的0.2倍
0.5.sh //屏幕高度的50%
```


Expand Down Expand Up @@ -232,7 +232,7 @@ class _ExampleWidgetState extends State<ExampleWidget> {
height: ScreenUtil().setHeight(200),
color: Colors.red,
child: Text(
'我的宽度:${0.5.wp}dp \n'
'我的宽度:${0.5.sw}dp \n'
'我的高度:${ScreenUtil().setHeight(200)}dp',
style: TextStyle(color: Colors.white, fontSize: ScreenUtil().setSp(24)),
),
Expand Down Expand Up @@ -326,8 +326,8 @@ class _ExampleWidgetState extends State<ExampleWidget> {
);
print('系统的字体缩放比例:${ScreenUtil().textScaleFactor}');
print('屏幕宽度的0.5:${0.5.wp}');
print('屏幕高度的0.5:${0.5.hp}');
print('屏幕宽度的0.5:${0.5.sw}');
print('屏幕高度的0.5:${0.5.sh}');
}
}
Expand Down
8 changes: 4 additions & 4 deletions README_PT.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ ScreenUtil.init(context, designSize: Size(750, 1334), allowFontScaling: true);
ScreenUtil().setSp(24, allowFontScalingSelf: false) (sdk>=2.6 : 24.nsp) //Adapter font(fonts will not scale to respect Text Size accessibility settings)
ScreenUtil.pixelRatio //Device pixel density
ScreenUtil.screenWidth (sdk>=2.6 : 1.wp) //Device width
ScreenUtil.screenHeight (sdk>=2.6 : 1.hp) //Device height
ScreenUtil.screenWidth (sdk>=2.6 : 1.sw) //Device width
ScreenUtil.screenHeight (sdk>=2.6 : 1.sh) //Device height
ScreenUtil.bottomBarHeight //Bottom safe zone distance, suitable for buttons with full screen
ScreenUtil.statusBarHeight //Status bar height , Notch will be higher Unit px
ScreenUtil.textScaleFactor //System font scaling factor
ScreenUtil().scaleWidth //Ratio of actual width dp to design draft px
ScreenUtil().scaleHeight //Ratio of actual height dp to design draft px
0.2.wp //0,2 vezes a largura da tela
0.5.hp //50% altura da tela
0.2.sw //0,2 vezes a largura da tela
0.5.sh //50% altura da tela
```

#### Adaptar o tamanho da tela:
Expand Down
8 changes: 4 additions & 4 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ class _ExampleWidgetState extends State<ExampleWidget> {
// Using Extensions
Container(
padding: EdgeInsets.all(10.w),
width: 0.5.wp,
width: 0.5.sw,
height: 200.h,
color: Colors.red,
child: Text(
'My width:${0.5.wp}dp \n'
'My width:${0.5.sw}dp \n'
'My height:${200.h}dp',
style: TextStyle(
color: Colors.white,
Expand Down Expand Up @@ -152,7 +152,7 @@ class _ExampleWidgetState extends State<ExampleWidget> {
print(
'The ratio of height width to the size of the design:${ScreenUtil().scaleHeight * ScreenUtil().pixelRatio}');
print('System font scaling:${ScreenUtil().textScaleFactor}');
print('0.5 times the screen width:${0.5.wp}');
print('0.5 times the screen height:${0.5.hp}');
print('0.5 times the screen width:${0.5.sw}');
print('0.5 times the screen height:${0.5.sh}');
}
}
6 changes: 3 additions & 3 deletions example/lib/main_zh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class _ExampleWidgetState extends State<ExampleWidget> {
height: ScreenUtil().setHeight(200),
color: Colors.red,
child: Text(
'我的宽度:${0.5.wp}dp \n'
'我的宽度:${0.5.sw}dp \n'
'我的高度:${ScreenUtil().setHeight(200)}dp',
style: TextStyle(color: Colors.white, fontSize: ScreenUtil().setSp(24)),
),
Expand Down Expand Up @@ -149,7 +149,7 @@ class _ExampleWidgetState extends State<ExampleWidget> {
);
print('系统的字体缩放比例:${ScreenUtil().textScaleFactor}');

print('屏幕宽度的0.5:${0.5.wp}');
print('屏幕高度的0.5:${0.5.hp}');
print('屏幕宽度的0.5:${0.5.sw}');
print('屏幕高度的0.5:${0.5.sh}');
}
}
4 changes: 2 additions & 2 deletions lib/size_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ extension SizeExtension on num {

///屏幕宽度的倍数
///Multiple of screen width
double get wp => ScreenUtil().screenWidth * this;
double get sw => ScreenUtil().screenWidth * this;

///屏幕高度的倍数
///Multiple of screen height
double get hp => ScreenUtil().screenHeight * this;
double get sh => ScreenUtil().screenHeight * this;
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_screenutil
description: A flutter plugin for adapting screen and font size.Guaranteed to look good on different models
version: 3.1.1
version: 3.2.0
homepage: https://github.com/OpenFlutter/flutter_screenutil/tree/beta

environment:
Expand Down

0 comments on commit d51945e

Please sign in to comment.