Showing
1 changed file
with
3 additions
and
4 deletions
| @@ -38,15 +38,14 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -38,15 +38,14 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 38 | 在使用之前请设置好设计稿的宽度和高度,如果不设置则使用默认尺寸 | 38 | 在使用之前请设置好设计稿的宽度和高度,如果不设置则使用默认尺寸 |
| 39 | 传入设计稿的宽度和高度(单位px),默认为1080*1920 | 39 | 传入设计稿的宽度和高度(单位px),默认为1080*1920 |
| 40 | 推荐在项目入口中设置,以保证在每次使用之前设置好了适配尺寸: | 40 | 推荐在项目入口中设置,以保证在每次使用之前设置好了适配尺寸: |
| 41 | + | ||
| 41 | ``` | 42 | ``` |
| 42 | ScreenUtil.instance = new ScreenUtil(width: 360, height: 720); | 43 | ScreenUtil.instance = new ScreenUtil(width: 360, height: 720); |
| 43 | ``` | 44 | ``` |
| 44 | 45 | ||
| 45 | ### 使用: | 46 | ### 使用: |
| 46 | -``` | ||
| 47 | - | ||
| 48 | 47 | ||
| 49 | -### 适配尺寸: | 48 | +适配尺寸: |
| 50 | ``` | 49 | ``` |
| 51 | //传入设计稿的px尺寸: | 50 | //传入设计稿的px尺寸: |
| 52 | width: ScreenUtil().setWidth(540), | 51 | width: ScreenUtil().setWidth(540), |
| @@ -54,7 +53,7 @@ height: ScreenUtil().setHeight(200), | @@ -54,7 +53,7 @@ height: ScreenUtil().setHeight(200), | ||
| 54 | ``` | 53 | ``` |
| 55 | 54 | ||
| 56 | 其他相关api: | 55 | 其他相关api: |
| 57 | - | 56 | +``` |
| 58 | ScreenUtil.pixelRatio //设备的像素密度 | 57 | ScreenUtil.pixelRatio //设备的像素密度 |
| 59 | ScreenUtil.screenWidth //设备宽度 | 58 | ScreenUtil.screenWidth //设备宽度 |
| 60 | ScreenUtil.screenHeight //设备高度 | 59 | ScreenUtil.screenHeight //设备高度 |
-
Please register or login to post a comment