Skip to content

Commit cbbfb91

Browse files
author
李卓原
committed
fix #150
1 parent 321cd02 commit cbbfb91

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

lib/screenutil.dart

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class ScreenUtil {
3434
_pixelRatio = window.devicePixelRatio;
3535
_screenWidth = window.physicalSize.width / _pixelRatio;
3636
_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;
3939
_textScaleFactor = window.textScaleFactor;
4040
}
4141

@@ -119,12 +119,9 @@ class ScreenUtil {
119119
///Font size adaptation method
120120
///@param [fontSize] The size of the font on the UI design, in px.
121121
///@param [allowFontScaling]
122-
num setSp(num fontSize, {bool allowFontScalingSelf}) =>
123-
allowFontScalingSelf == null
124-
? (allowFontScaling
125-
? (fontSize * scaleText)
126-
: ((fontSize * scaleText) / _textScaleFactor))
127-
: (allowFontScalingSelf
128-
? (fontSize * scaleText)
129-
: ((fontSize * scaleText) / _textScaleFactor));
122+
num setSp(num fontSize, {bool allowFontScalingSelf}) => allowFontScalingSelf == null
123+
? (allowFontScaling ? (fontSize * scaleText) : ((fontSize * scaleText) / _textScaleFactor))
124+
: (allowFontScalingSelf
125+
? (fontSize * scaleText)
126+
: ((fontSize * scaleText) / _textScaleFactor));
130127
}

0 commit comments

Comments
 (0)