Showing
6 changed files
with
10 additions
and
8 deletions
@@ -5,6 +5,8 @@ | @@ -5,6 +5,8 @@ | ||
5 | * @LastEditTime: 2020年6月20日 11:20:02 | 5 | * @LastEditTime: 2020年6月20日 11:20:02 |
6 | * @Description: Update log | 6 | * @Description: Update log |
7 | --> | 7 | --> |
8 | +# 3.0.2 | ||
9 | +- Change the unit of'statusBarHeight' and 'bottomBarHeight' to dp | ||
8 | 10 | ||
9 | # 3.0.1 | 11 | # 3.0.1 |
10 | - update readme | 12 | - update readme |
@@ -28,7 +28,7 @@ dependencies: | @@ -28,7 +28,7 @@ dependencies: | ||
28 | flutter: | 28 | flutter: |
29 | sdk: flutter | 29 | sdk: flutter |
30 | # add flutter_screenutil | 30 | # add flutter_screenutil |
31 | - flutter_screenutil: ^3.0.1 | 31 | + flutter_screenutil: ^3.0.2 |
32 | ``` | 32 | ``` |
33 | ### Add the following imports to your Dart code: | 33 | ### Add the following imports to your Dart code: |
34 | ``` | 34 | ``` |
@@ -28,7 +28,7 @@ dependencies: | @@ -28,7 +28,7 @@ dependencies: | ||
28 | flutter: | 28 | flutter: |
29 | sdk: flutter | 29 | sdk: flutter |
30 | # add flutter_screenutil | 30 | # add flutter_screenutil |
31 | - flutter_screenutil: ^3.0.1 | 31 | + flutter_screenutil: ^3.0.2 |
32 | ``` | 32 | ``` |
33 | 33 | ||
34 | ### Adicione o seguinte import em seu código Dart: | 34 | ### Adicione o seguinte import em seu código Dart: |
@@ -34,8 +34,8 @@ class ScreenUtil { | @@ -34,8 +34,8 @@ class ScreenUtil { | ||
34 | _pixelRatio = window.devicePixelRatio; | 34 | _pixelRatio = window.devicePixelRatio; |
35 | _screenWidth = window.physicalSize.width / _pixelRatio; | 35 | _screenWidth = window.physicalSize.width / _pixelRatio; |
36 | _screenHeight = window.physicalSize.height / _pixelRatio; | 36 | _screenHeight = window.physicalSize.height / _pixelRatio; |
37 | - _statusBarHeight = window.padding.top; | ||
38 | - _bottomBarHeight = window.padding.bottom; | 37 | + _statusBarHeight = window.padding.top / _pixelRatio; |
38 | + _bottomBarHeight = window.padding.bottom / _pixelRatio; | ||
39 | _textScaleFactor = window.textScaleFactor; | 39 | _textScaleFactor = window.textScaleFactor; |
40 | } | 40 | } |
41 | 41 | ||
@@ -83,11 +83,11 @@ class ScreenUtil { | @@ -83,11 +83,11 @@ class ScreenUtil { | ||
83 | 83 | ||
84 | /// 状态栏高度 dp 刘海屏会更高 | 84 | /// 状态栏高度 dp 刘海屏会更高 |
85 | /// The offset from the top | 85 | /// The offset from the top |
86 | - double get statusBarHeight => _statusBarHeight / _pixelRatio; | 86 | + double get statusBarHeight => _statusBarHeight; |
87 | 87 | ||
88 | /// 底部安全区距离 dp | 88 | /// 底部安全区距离 dp |
89 | /// The offset from the bottom. | 89 | /// The offset from the bottom. |
90 | - double get bottomBarHeight => _bottomBarHeight / _pixelRatio; | 90 | + double get bottomBarHeight => _bottomBarHeight; |
91 | 91 | ||
92 | /// 实际的dp与UI设计px的比例 | 92 | /// 实际的dp与UI设计px的比例 |
93 | /// The ratio of the actual dp to the design draft px | 93 | /// The ratio of the actual dp to the design draft px |
1 | name: flutter_screenutil | 1 | name: flutter_screenutil |
2 | description: A flutter plugin for adapting screen and font size.Guaranteed to look good on different models | 2 | description: A flutter plugin for adapting screen and font size.Guaranteed to look good on different models |
3 | -version: 3.0.1 | 3 | +version: 3.0.2 |
4 | homepage: https://github.com/OpenFlutter/flutter_screenutil/tree/beta | 4 | homepage: https://github.com/OpenFlutter/flutter_screenutil/tree/beta |
5 | 5 | ||
6 | environment: | 6 | environment: |
-
Please register or login to post a comment