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
LiZhuoyuan
2020-06-20 13:02:07 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
bd7355c042dbd54a7b9ee38259f0a0e6e1c81c75
bd7355c0
1 parent
8c2d87c0
2.1.0
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
6 deletions
CHANGELOG.md
README.md
README_CN.md
README_PT.md
lib/size_extension.dart
pubspec.yaml
CHANGELOG.md
View file @
bd7355c
...
...
@@ -6,11 +6,14 @@
*
@Description: Update log
-->
#2.0.0
# 2.1.0
-
add 'nsp' , you can use 'fontSize: 24.nsp' instead of 'fontSize: ScreenUtil().setSp(24, allowFontScalingSelf: false)'
# 2.0.0
-
Use
`MediaQueryData.fromWindow(window)` instead of `MediaQuery.of(context)`
, no context parameter required
-
API changes, please note
#1.1.0
#
1.1.0
-
support ExtensionMethod Dart-SDK-2.6.0
-
you can use 'width: 50.w' instead of 'width: ScreenUtil().setWidth(50)'
'50.h' instead of 'ScreenUtil().setHeight(50)'
...
...
README.md
View file @
bd7355c
...
...
@@ -24,7 +24,7 @@ dependencies:
flutter:
sdk: flutter
# add flutter_screenutil
flutter_screenutil: ^2.
0
.0
flutter_screenutil: ^2.
1
.0
```
### Add the following imports to your Dart code:
...
...
@@ -71,6 +71,7 @@ ScreenUtil.init(width: 750, height: 1334, allowFontScaling: true); /
ScreenUtil
().
setHeight
(
200
)
(
sdk
>=
2.6
:
200
.
h
)
//Adapted to screen height
ScreenUtil
().
setSp
(
24
)
(
sdk
>=
2.6
:
24
.
sp
)
//Adapter font
ScreenUtil
().
setSp
(
24
,
allowFontScalingSelf:
true
)
(
sdk
>=
2.6
:
24
.
ssp
)
//Adapter font(fonts will scale to respect Text Size accessibility settings)
ScreenUtil
().
setSp
(
24
,
allowFontScalingSelf:
false
)
(
sdk
>=
2.6
:
24
.
nsp
)
//Adapter font(fonts will not scale to respect Text Size accessibility settings)
ScreenUtil
.
pixelRatio
//Device pixel density
ScreenUtil
.
screenWidth
//Device width
...
...
README_CN.md
View file @
bd7355c
...
...
@@ -29,7 +29,7 @@ dependencies:
flutter:
sdk: flutter
# 添加依赖
flutter_screenutil: ^2.
0
.0
flutter_screenutil: ^2.
1
.0
```
### 在每个使用的地方导入包:
...
...
@@ -75,6 +75,7 @@ ScreenUtil.init(width: 750, height: 1334, allowFontScaling: true); /
ScreenUtil
().
setHeight
(
200
)
(
sdk
>=
2.6
:
200
.
h
)
//根据屏幕高度适配尺寸
ScreenUtil
().
setSp
(
24
)
(
sdk
>=
2.6
:
24
.
sp
)
//适配字体
ScreenUtil
().
setSp
(
24
,
allowFontScalingSelf:
true
)
(
sdk
>=
2.6
:
24
.
ssp
)
//适配字体(根据系统的“字体大小”辅助选项来进行缩放)
ScreenUtil
().
setSp
(
24
,
allowFontScalingSelf:
false
)
(
sdk
>=
2.6
:
24
.
nsp
)
//适配字体(不会根据系统的“字体大小”辅助选项来进行缩放)
ScreenUtil
.
pixelRatio
//设备的像素密度
ScreenUtil
.
screenWidth
//设备宽度
...
...
README_PT.md
View file @
bd7355c
...
...
@@ -24,7 +24,7 @@ dependencies:
flutter:
sdk: flutter
# add flutter_screenutil
flutter_screenutil: ^2.
0
.0
flutter_screenutil: ^2.
1
.0
```
### Adicione o seguinte import em seu código Dart:
...
...
@@ -71,6 +71,7 @@ ScreenUtil.init(width: 750, height: 1334, allowFontScaling: true); /
ScreenUtil
().
setHeight
(
200
)
(
sdk
>=
2.6
:
200
.
h
)
//Adapted to screen height
ScreenUtil
().
setSp
(
24
)
(
sdk
>=
2.6
:
24
.
sp
)
//Adapter font
ScreenUtil
().
setSp
(
24
,
allowFontScalingSelf:
true
)
(
sdk
>=
2.6
:
24
.
ssp
)
//Adapter font(fonts will scale to respect Text Size accessibility settings)
ScreenUtil
().
setSp
(
24
,
allowFontScalingSelf:
false
)
(
sdk
>=
2.6
:
24
.
nsp
)
//Adapter font(fonts will not scale to respect Text Size accessibility settings)
ScreenUtil
.
pixelRatio
//Device pixel density
ScreenUtil
.
screenWidth
//Device width
...
...
lib/size_extension.dart
View file @
bd7355c
...
...
@@ -8,4 +8,6 @@ extension SizeExtension on num {
num
get
sp
=>
ScreenUtil
().
setSp
(
this
);
num
get
ssp
=>
ScreenUtil
().
setSp
(
this
,
allowFontScalingSelf:
true
);
num
get
nsp
=>
ScreenUtil
().
setSp
(
this
,
allowFontScalingSelf:
false
);
}
...
...
pubspec.yaml
View file @
bd7355c
name
:
flutter_screenutil
description
:
A flutter plugin for adapting screen and font size.Guaranteed to look good on different models
version
:
2.
0
.0
version
:
2.
1
.0
homepage
:
https://github.com/OpenFlutter/flutter_screenutil
environment
:
...
...
Please
register
or
login
to post a comment