Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
lizhuoyuan authored Dec 17, 2018
1 parent d15fb50 commit 382b3f3
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,38 @@ ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context);

### Use:

Adapt screen size:
```
#### Adapt screen size:

Pass the px size of the design draft:

Width after adaptation: ScreenUtil().setWidth(540),
Height after adaptation: ScreenUtil().setHeight(200),
Adapted to screen width: ScreenUtil().setWidth(540),

Adapted to screen height: ScreenUtil().setHeight(200),

**Note**

Height is also adapted according to setWidth to ensure no deformation (when you want a square)

setHeight method is mainly adapted in height, you want to control the height and actuality of a screen on the UIUsed when the same is displayed.

```
//for example:
//rectangle
Container(
width: ScreenUtil().setWidth(375),
height: ScreenUtil().setHeight(200),
...
),
////If you want to display a square:
Container(
width: ScreenUtil().setWidth(300),
height: ScreenUtil().setWidth(300),
),
```

Adapter font:
#### Adapter font:
```
ScreenUtil().setSp(28) //Incoming font size,the unit is pixel, fonts will scale to respect Text Size accessibility settings
ScreenUtil().setSp(28,false) //Incoming font size,the unit is pixel,fonts will not scale to respect Text Size accessibility settings
Expand All @@ -70,7 +86,7 @@ for example:
```

Other related apis:
#### Other related apis:
```
ScreenUtil.pixelRatio //Device pixel density
ScreenUtil.screenWidth //Device width
Expand Down

0 comments on commit 382b3f3

Please sign in to comment.