Showing
1 changed file
with
7 additions
and
4 deletions
@@ -25,9 +25,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -25,9 +25,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
25 | 25 | ||
26 | ``` | 26 | ``` |
27 | 27 | ||
28 | -### 设置尺寸 | ||
29 | -在使用之前请设置好设计稿的宽度和高度,如果不设置则使用默认尺寸 | ||
30 | -传入设计稿的宽度和高度(单位px),默认为1080*1920 | 28 | +### 初始化设置尺寸 |
29 | +在使用之前请设置好设计稿的宽度和高度,传入设计稿的宽度和高度(单位px) | ||
30 | +如果不设置则使用默认尺寸,默认为1080*1920 | ||
31 | 推荐在项目入口中设置,以保证在每次使用之前设置好了适配尺寸: | 31 | 推荐在项目入口中设置,以保证在每次使用之前设置好了适配尺寸: |
32 | 32 | ||
33 | ``` | 33 | ``` |
@@ -49,7 +49,7 @@ height: ScreenUtil().setHeight(200), | @@ -49,7 +49,7 @@ height: ScreenUtil().setHeight(200), | ||
49 | ScreenUtil.screenWidth //设备宽度 | 49 | ScreenUtil.screenWidth //设备宽度 |
50 | ScreenUtil.screenHeight //设备高度 | 50 | ScreenUtil.screenHeight //设备高度 |
51 | ScreenUtil.bottomBarHeight //底部安全区距离,适用于全面屏下面有按键的 | 51 | ScreenUtil.bottomBarHeight //底部安全区距离,适用于全面屏下面有按键的 |
52 | - ScreenUtil.statusBarHeight //状态栏高度 刘海屏会更高 | 52 | + ScreenUtil.statusBarHeight //状态栏高度 刘海屏会更高 单位px |
53 | 53 | ||
54 | ScreenUtil().scaleWidth //宽度相对于设计稿放大的倍数 | 54 | ScreenUtil().scaleWidth //宽度相对于设计稿放大的倍数 |
55 | ScreenUtil().scaleHeight //高度相对于设计稿放大的倍数 | 55 | ScreenUtil().scaleHeight //高度相对于设计稿放大的倍数 |
@@ -101,6 +101,9 @@ import 'package:flutter_app/ScreenUtil.dart'; //导入 | @@ -101,6 +101,9 @@ import 'package:flutter_app/ScreenUtil.dart'; //导入 | ||
101 | ); | 101 | ); |
102 | } | 102 | } |
103 | ``` | 103 | ``` |
104 | + | ||
105 | +example demo: (./example)` | ||
106 | + | ||
104 | 效果: | 107 | 效果: |
105 | 上面的205.xxx 是dp的单位, | 108 | 上面的205.xxx 是dp的单位, |
106 | 下面的单位是px | 109 | 下面的单位是px |
-
Please register or login to post a comment