Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
flutter_screenutil
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
李卓原
2022-02-14 13:38:13 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
dd6ec78475d6d0684a6763ab737ea6201688a818
dd6ec784
1 parent
264ed087
校验context
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
lib/screen_util.dart
lib/screen_util.dart
View file @
dd6ec78
...
...
@@ -55,11 +55,13 @@ class ScreenUtil {
/// 每个逻辑像素的字体像素数,字体的缩放比例
/// The number of font pixels for each logical pixel.
double
get
textScaleFactor
=>
MediaQuery
.
of
(
context
!).
textScaleFactor
;
double
get
textScaleFactor
=>
context
!=
null
?
MediaQuery
.
of
(
context
!).
textScaleFactor
:
1
;
/// 设备的像素密度
/// The size of the media in logical pixels (e.g, the size of the screen).
double
?
get
pixelRatio
=>
MediaQuery
.
of
(
context
!).
devicePixelRatio
;
double
?
get
pixelRatio
=>
context
!=
null
?
MediaQuery
.
of
(
context
!).
devicePixelRatio
:
1
;
/// 当前设备宽度 dp
/// The horizontal extent of this size.
...
...
Please
register
or
login
to post a comment