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
李卓原
2018-09-29 15:53:57 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
e3d2574ec1d8d42284d0ed3d1a5a2473edafdb90
e3d2574e
2 parents
eb6f7404
62d8b7d3
Merge remote-tracking branch 'origin/master'
# Conflicts: # README.md # example/pubspec.yaml
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
6 deletions
README.md
example/README.md
example/pubspec.yaml
README.md
View file @
e3d2574
...
...
@@ -2,7 +2,7 @@
# flutter_ScreenUtil
**flutter 屏幕适配方案**
github: https://github.com/
lizhuoyuan/flutter_ScreenUtil
</br>
github: https://github.com/
OpenFlutter/flutter_ScreenUtil
</br>
csdn博客工具介绍:https://blog.csdn.net/u011272795/article/details/82795477
...
...
@@ -16,7 +16,7 @@ dependencies:
# 添加依赖
flutter_screenutil:
git:
url: git://github.com/
lizhuoyuan/flutter_ScreenUtil
url: git://github.com/
openflutter/flutter_screenutil
```
### 在每个使用的地方导入包:
...
...
@@ -40,8 +40,14 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
适配尺寸:
```
//传入设计稿的px尺寸:
width: ScreenUtil().setWidth(540),
height: ScreenUtil().setHeight(200),
适配后的宽度width: ScreenUtil().setWidth(540),
适配后的高度height: ScreenUtil().setHeight(200),
例如:
Container(
width: ScreenUtil().setWidth(375),
height: ScreenUtil().setHeight(200),
),
```
其他相关api:
...
...
@@ -107,6 +113,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
Text('设备的像素密度:${ScreenUtil.pixelRatio}'),
Text('底部安全区距离:${ScreenUtil.bottomBarHeight}px'),
Text('状态栏高度:${ScreenUtil.statusBarHeight}px'),
Text('宽度相对于设计稿放大的倍数:${ScreenUtil().scaleWidth}'),
Text('高度相对于设计稿放大的倍数:${ScreenUtil().scaleHeight}'),
],
),
),
...
...
example/README.md
View file @
e3d2574
...
...
@@ -2,6 +2,8 @@
flutter_screenutil的使用示例

## Getting Started
For help getting started with Flutter, view our online
...
...
example/pubspec.yaml
View file @
e3d2574
...
...
@@ -21,8 +21,7 @@ dependencies:
cupertino_icons
:
^0.1.2
flutter_screenutil
:
git
:
url
:
git://github.com/lizhuoyuan/flutter_screenUtil
common_utils
:
^1.0.2
url
:
git://github.com/openflutter/flutter_screenutil
dev_dependencies
:
flutter_test
:
sdk
:
flutter
...
...
Please
register
or
login
to post a comment