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
Aneesh Rao
2020-09-30 11:09:04 +0530
Browse Files
Options
Browse Files
Download
Plain Diff
Committed by
GitHub
2020-09-30 11:09:04 +0530
Commit
714c83f369d7e14d861ce896293e5408ee705064
714c83f3
2 parents
c35e4b96
c0b3318b
Merge branch 'master' into docs
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
lib/screenutil.dart
lib/size_extension.dart
lib/screenutil.dart
View file @
714c83f
...
...
@@ -97,7 +97,7 @@ class ScreenUtil {
/// Adapted to the device width of the UI Design.
/// Height can also be adapted according to this to ensure no deformation ,
/// if you want a square
num
setWidth
(
num
width
)
=>
width
*
scaleWidth
;
double
setWidth
(
num
width
)
=>
width
*
scaleWidth
;
/// 根据UI设计的设备高度适配
/// 当发现UI设计中的一屏显示的与当前样式效果不符合时,
...
...
@@ -107,14 +107,14 @@ class ScreenUtil {
/// It is recommended to use this method to achieve a high degree of adaptation
/// when it is found that one screen in the UI design
/// does not match the current style effect, or if there is a difference in shape.
num
setHeight
(
num
height
)
=>
height
*
scaleHeight
;
double
setHeight
(
num
height
)
=>
height
*
scaleHeight
;
///字体大小适配方法
///- [fontSize] UI设计上字体的大小,单位px.
///Font size adaptation method
///- [fontSize] The size of the font on the UI design, in px.
///- [allowFontScaling]
num
setSp
(
num
fontSize
,
{
bool
allowFontScalingSelf
})
=>
double
setSp
(
num
fontSize
,
{
bool
allowFontScalingSelf
})
=>
allowFontScalingSelf
==
null
?
(
allowFontScaling
?
(
fontSize
*
scaleText
)
...
...
lib/size_extension.dart
View file @
714c83f
...
...
@@ -2,25 +2,25 @@ import 'package:flutter_screenutil/screenutil.dart';
extension
SizeExtension
on
num
{
///[ScreenUtil.setWidth]
num
get
w
=>
ScreenUtil
().
setWidth
(
this
);
double
get
w
=>
ScreenUtil
().
setWidth
(
this
);
///[ScreenUtil.setHeight]
num
get
h
=>
ScreenUtil
().
setHeight
(
this
);
double
get
h
=>
ScreenUtil
().
setHeight
(
this
);
///[ScreenUtil.setSp]
num
get
sp
=>
ScreenUtil
().
setSp
(
this
);
double
get
sp
=>
ScreenUtil
().
setSp
(
this
);
///[ScreenUtil.setSp]
num
get
ssp
=>
ScreenUtil
().
setSp
(
this
,
allowFontScalingSelf:
true
);
double
get
ssp
=>
ScreenUtil
().
setSp
(
this
,
allowFontScalingSelf:
true
);
///[ScreenUtil.setSp]
num
get
nsp
=>
ScreenUtil
().
setSp
(
this
,
allowFontScalingSelf:
false
);
double
get
nsp
=>
ScreenUtil
().
setSp
(
this
,
allowFontScalingSelf:
false
);
///屏幕宽度的倍数
///Multiple of screen width
num
get
wp
=>
ScreenUtil
().
screenWidth
*
this
;
double
get
wp
=>
ScreenUtil
().
screenWidth
*
this
;
///屏幕高度的倍数
///Multiple of screen height
num
get
hp
=>
ScreenUtil
().
screenHeight
*
this
;
double
get
hp
=>
ScreenUtil
().
screenHeight
*
this
;
}
...
...
Please
register
or
login
to post a comment