Merge remote-tracking branch 'origin/master'
# Conflicts: # README.md # example/pubspec.yaml
Showing
3 changed files
with
15 additions
and
6 deletions
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # flutter_ScreenUtil | 2 | # flutter_ScreenUtil |
| 3 | **flutter 屏幕适配方案** | 3 | **flutter 屏幕适配方案** |
| 4 | 4 | ||
| 5 | -github: https://github.com/lizhuoyuan/flutter_ScreenUtil </br> | 5 | +github: https://github.com/OpenFlutter/flutter_ScreenUtil </br> |
| 6 | csdn博客工具介绍:https://blog.csdn.net/u011272795/article/details/82795477 | 6 | csdn博客工具介绍:https://blog.csdn.net/u011272795/article/details/82795477 |
| 7 | 7 | ||
| 8 | 8 | ||
| @@ -16,7 +16,7 @@ dependencies: | @@ -16,7 +16,7 @@ dependencies: | ||
| 16 | # 添加依赖 | 16 | # 添加依赖 |
| 17 | flutter_screenutil: | 17 | flutter_screenutil: |
| 18 | git: | 18 | git: |
| 19 | - url: git://github.com/lizhuoyuan/flutter_ScreenUtil | 19 | + url: git://github.com/openflutter/flutter_screenutil |
| 20 | ``` | 20 | ``` |
| 21 | 21 | ||
| 22 | ### 在每个使用的地方导入包: | 22 | ### 在每个使用的地方导入包: |
| @@ -40,8 +40,14 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -40,8 +40,14 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 40 | 适配尺寸: | 40 | 适配尺寸: |
| 41 | ``` | 41 | ``` |
| 42 | //传入设计稿的px尺寸: | 42 | //传入设计稿的px尺寸: |
| 43 | -width: ScreenUtil().setWidth(540), | ||
| 44 | -height: ScreenUtil().setHeight(200), | 43 | +适配后的宽度width: ScreenUtil().setWidth(540), |
| 44 | +适配后的高度height: ScreenUtil().setHeight(200), | ||
| 45 | + | ||
| 46 | +例如: | ||
| 47 | +Container( | ||
| 48 | + width: ScreenUtil().setWidth(375), | ||
| 49 | + height: ScreenUtil().setHeight(200), | ||
| 50 | + ), | ||
| 45 | ``` | 51 | ``` |
| 46 | 52 | ||
| 47 | 其他相关api: | 53 | 其他相关api: |
| @@ -107,6 +113,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -107,6 +113,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 107 | Text('设备的像素密度:${ScreenUtil.pixelRatio}'), | 113 | Text('设备的像素密度:${ScreenUtil.pixelRatio}'), |
| 108 | Text('底部安全区距离:${ScreenUtil.bottomBarHeight}px'), | 114 | Text('底部安全区距离:${ScreenUtil.bottomBarHeight}px'), |
| 109 | Text('状态栏高度:${ScreenUtil.statusBarHeight}px'), | 115 | Text('状态栏高度:${ScreenUtil.statusBarHeight}px'), |
| 116 | + Text('宽度相对于设计稿放大的倍数:${ScreenUtil().scaleWidth}'), | ||
| 117 | + Text('高度相对于设计稿放大的倍数:${ScreenUtil().scaleHeight}'), | ||
| 110 | ], | 118 | ], |
| 111 | ), | 119 | ), |
| 112 | ), | 120 | ), |
| @@ -21,8 +21,7 @@ dependencies: | @@ -21,8 +21,7 @@ dependencies: | ||
| 21 | cupertino_icons: ^0.1.2 | 21 | cupertino_icons: ^0.1.2 |
| 22 | flutter_screenutil: | 22 | flutter_screenutil: |
| 23 | git: | 23 | git: |
| 24 | - url: git://github.com/lizhuoyuan/flutter_screenUtil | ||
| 25 | - common_utils: ^1.0.2 | 24 | + url: git://github.com/openflutter/flutter_screenutil |
| 26 | dev_dependencies: | 25 | dev_dependencies: |
| 27 | flutter_test: | 26 | flutter_test: |
| 28 | sdk: flutter | 27 | sdk: flutter |
-
Please register or login to post a comment