Showing
1 changed file
with
15 additions
and
3 deletions
@@ -17,14 +17,26 @@ csdn博客本工具介绍:https://blog.csdn.net/u011272795/article/details/82795 | @@ -17,14 +17,26 @@ csdn博客本工具介绍:https://blog.csdn.net/u011272795/article/details/82795 | ||
17 | 17 | ||
18 | 使用方法: | 18 | 使用方法: |
19 | 19 | ||
20 | -导入包: | 20 | +安装依赖: |
21 | ``` | 21 | ``` |
22 | -import 'package:flutter_app/ScreenUtil.dart'; //导入 | 22 | +dependencies: |
23 | + flutter: | ||
24 | + sdk: flutter | ||
25 | + # 添加依赖 | ||
26 | + flutter_screenutil: | ||
27 | + git: | ||
28 | + url: git://github.com/lizhuoyuan/flutter_ScreenUtil | ||
29 | +``` | ||
30 | + | ||
31 | +在每个使用的地方导入包: | ||
32 | +``` | ||
33 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
34 | + | ||
23 | ``` | 35 | ``` |
24 | 36 | ||
25 | 在使用之前请设置好设计稿的宽度和高度,如果不设置则使用默认尺寸 | 37 | 在使用之前请设置好设计稿的宽度和高度,如果不设置则使用默认尺寸 |
26 | 传入设计稿的宽度和高度(单位px),默认为1080*1920 | 38 | 传入设计稿的宽度和高度(单位px),默认为1080*1920 |
27 | -推荐在main.dart中设置,以保证在使用之前设置好了适配尺寸: | 39 | +推荐在项目入口中设置,以保证在每次使用之前设置好了适配尺寸: |
28 | ``` | 40 | ``` |
29 | ScreenUtil.instance = new ScreenUtil(width: 360, height: 720); | 41 | ScreenUtil.instance = new ScreenUtil(width: 360, height: 720); |
30 | ``` | 42 | ``` |
-
Please register or login to post a comment