Skip to content

Commit

Permalink
文档优化
Browse files Browse the repository at this point in the history
  • Loading branch information
lizhuoyuan committed Jan 14, 2019
1 parent 91bb9b2 commit 6685db5
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 22 deletions.
39 changes: 28 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,34 @@ Container(

#### Adapter font:
```
ScreenUtil().setSp(28) //Incoming font size,the unit is pixel, fonts will not scale to respect Text Size accessibility settings
ScreenUtil(allowFontScaling: true).setSp(28) //Incoming font size,the unit is pixel,fonts will scale to respect Text Size accessibility settings
for example:
Text(
'My font size is 28px and will not change with the system.',
style: TextStyle(
color: Colors.black,
fontSize:ScreenUtil(allowFontScaling: true).setSp(28, false)
)
),
//Incoming font size,the unit is pixel, fonts will not scale to respect Text Size accessibility settings
//(AllowallowFontScaling when initializing ScreenUtil)
ScreenUtil().setSp(28)
//Incoming font size,the unit is pixel,fonts will scale to respect Text Size accessibility settings
//(If somewhere does not follow the global allowFontScaling setting)
ScreenUtil(allowFontScaling: true).setSp(28)
//for example:
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'My font size is 24px on the design draft and will not change with the system.',
style: TextStyle(
color: Colors.black,
fontSize: ScreenUtil().setSp(24),
)),
Text(
'My font size is 24px on the design draft and will change with the system.',
style: TextStyle(
color: Colors.black,
fontSize: ScreenUtil(allowFontScaling: true).setSp(24),
)),
],
)
```

Expand Down
29 changes: 19 additions & 10 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,26 @@ Container(
传入设计稿的px尺寸:

```
ScreenUtil().setSp(28) //传入字体大小,默认不根据系统的“字体大小”辅助选项来进行缩放
ScreenUtil(allowFontScaling: true).setSp(28) //传入字体大小,根据系统的“字体大小”辅助选项来进行缩放
//传入字体大小,默认不根据系统的“字体大小”辅助选项来进行缩放(可在初始化ScreenUtil时设置allowFontScaling)
ScreenUtil().setSp(28)
//传入字体大小,根据系统的“字体大小”辅助选项来进行缩放(如果某个地方不遵循全局的allowFontScaling设置)
ScreenUtil(allowFontScaling: true).setSp(28)
for example:
Text(
'My font size is 28px and will not change with the system.',
style: TextStyle(
color: Colors.black,
fontSize: ScreenUtil(allowFontScaling: true).setSp(28)
)
),
//for example:
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('我的文字大小在设计稿上是25px,不会随着系统的文字缩放比例变化',
style: TextStyle(
color: Colors.black, fontSize: ScreenUtil().setSp(24))),
Text('我的文字大小在设计稿上是25px,会随着系统的文字缩放比例变化',
style: TextStyle(
color: Colors.black, fontSize: ScreenUtil(allowFontScaling: true).setSp(24))),
],
)
```

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_screenutil
description: A flutter plugin for adapting screen and font size.Guaranteed to look good on different models
version: 0.4.5
version: 0.4.6
author: LiZhuoyuan <zhuoyuan93@gmail.com>
homepage: https://github.com/OpenFlutter/flutter_ScreenUtil

Expand Down

0 comments on commit 6685db5

Please sign in to comment.