Skip to content

Commit

Permalink
0.5.2
Browse files Browse the repository at this point in the history
 Change the parameter type from int to double
  • Loading branch information
lizhuoyuan committed Apr 17, 2019
1 parent e779f59 commit a16e14e
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 18 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@ setSp(int fontSize, [allowFontScaling = false]) => allowFontScaling

## [0.5.1] - Fix the wrong way of using

It is recommended to use `ScreenUtil.getInstance()` instead of `ScreenUtil()` , for example: `ScreenUtil.getInstance().setHeight(25)` instead of `ScreenUtil().setHeight(25)`
It is recommended to use `ScreenUtil.getInstance()` instead of `ScreenUtil()` , for example: `ScreenUtil.getInstance().setHeight(25)` instead of `ScreenUtil().setHeight(25)`

## [0.5.2] - Change the parameter type from int to double

setWidth,setHeight,setSp.
for example:
you can use setWidth(100) or setWidth(100.0)
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies:
flutter:
sdk: flutter
# add flutter_ScreenUtil
flutter_screenutil: ^0.4.2
flutter_screenutil: ^0.5.2
```

### Add the following imports to your Dart code:
Expand All @@ -33,8 +33,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';

|Property|Type|Default Value|Description|
|:---|:---|:---|:---|
|width|int|1080px|The width of the device in the design draft, in px|
|height|int|1920px|The height of the device in the design draft, in px|
|width|double|1080px|The width of the device in the design draft, in px|
|height|double|1920px|The height of the device in the design draft, in px|
|allowFontScaling|bool|false|Sets whether the font size is scaled according to the system's "font size" assist option|

### Initialize and set the fit size and font size to scale according to the system's "font size" accessibility option
Expand Down
8 changes: 4 additions & 4 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

[README of English](https://github.com/OpenFlutter/flutter_ScreenUtil/blob/master/README.md)

github: https://github.com/OpenFlutter/flutter_ScreenUtil
github: https://github.com/OpenFlutter/flutter_screenutil

csdn博客工具介绍:https://blog.csdn.net/u011272795/article/details/82795477

Expand All @@ -26,7 +26,7 @@ dependencies:
flutter:
sdk: flutter
# 添加依赖
flutter_screenutil: ^0.5.0
flutter_screenutil: ^0.5.2
```

### 在每个使用的地方导入包:
Expand All @@ -38,8 +38,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';

|属性|类型|默认值|描述|
|:---|:---|:---|:---|
|width|int|1080px|设计稿中设备的宽度,单位px|
|height|int|1920px|设计稿中设备的高度,单位px|
|width|double|1080px|设计稿中设备的宽度,单位px|
|height|double|1920px|设计稿中设备的高度,单位px|
|allowFontScaling|bool|false|设置字体大小是否根据系统的“字体大小”辅助选项来进行缩放|

### 初始化并设置适配尺寸及字体大小是否根据系统的“字体大小”辅助选项来进行缩放
Expand Down
15 changes: 11 additions & 4 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.2"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
quiver:
dependency: transitive
description:
Expand All @@ -92,7 +99,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.1"
version: "1.5.5"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -120,14 +127,14 @@ packages:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.1.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.1"
version: "0.2.2"
typed_data:
dependency: transitive
description:
Expand All @@ -143,4 +150,4 @@ packages:
source: hosted
version: "2.0.8"
sdks:
dart: ">=2.0.0 <3.0.0"
dart: ">=2.1.1-dev.0.0 <3.0.0"
10 changes: 5 additions & 5 deletions lib/flutter_screenutil.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class ScreenUtil {
static ScreenUtil instance = new ScreenUtil();

//设计稿的设备尺寸修改
int width;
int height;
double width;
double height;
bool allowFontScaling;

static MediaQueryData _mediaQueryData;
Expand Down Expand Up @@ -77,19 +77,19 @@ class ScreenUtil {

///根据设计稿的设备宽度适配
///高度也根据这个来做适配可以保证不变形
setWidth(int width) => width * scaleWidth;
setWidth(double width) => width * scaleWidth;

/// 根据设计稿的设备高度适配
/// 当发现设计稿中的一屏显示的与当前样式效果不符合时,
/// 或者形状有差异时,高度适配建议使用此方法
/// 高度适配主要针对想根据设计稿的一屏展示一样的效果
setHeight(int height) => height * scaleHeight;
setHeight(double height) => height * scaleHeight;

///字体大小适配方法
///@param fontSize 传入设计稿上字体的px ,
///@param allowFontScaling 控制字体是否要根据系统的“字体大小”辅助选项来进行缩放。默认值为false。
///@param allowFontScaling Specifies whether fonts should scale to respect Text Size accessibility settings. The default is false.
setSp(int fontSize) => allowFontScaling
setSp(double fontSize) => allowFontScaling
? setWidth(fontSize)
: setWidth(fontSize) / _textScaleFactor;
}
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.5.1
version: 0.5.2
author: LiZhuoyuan <zhuoyuan93@gmail.com>
homepage: https://github.com/OpenFlutter/flutter_ScreenUtil

Expand Down

0 comments on commit a16e14e

Please sign in to comment.