李卓原

3.2.0

... ... @@ -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
... ...
... ... @@ -76,8 +76,8 @@ 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
... ... @@ -85,8 +85,8 @@ ScreenUtil.init(context, designSize: Size(750, 1334), allowFontScaling: true);
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:
... ...
... ... @@ -79,8 +79,8 @@ 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 //系统字体缩放比例
... ... @@ -88,8 +88,8 @@ ScreenUtil.init(context, designSize: Size(750, 1334), allowFontScaling: true);
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%
```
... ... @@ -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)),
),
... ... @@ -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}');
}
}
... ...
... ... @@ -75,8 +75,8 @@ 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
... ... @@ -84,8 +84,8 @@ ScreenUtil.init(context, designSize: Size(750, 1334), allowFontScaling: true);
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:
... ...
... ... @@ -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,
... ... @@ -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}');
}
}
... ...
... ... @@ -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)),
),
... ... @@ -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}');
}
}
... ...
... ... @@ -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;
}
... ...
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:
... ...