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
li_zy
2018-09-24 15:06:29 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2018-09-24 15:06:29 +0800
Commit
ea24458194488969b8efc4b138600b20661b1599
ea244581
1 parent
6bca8e61
Update README.md
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
README.md
README.md
View file @
ea24458
...
...
@@ -15,9 +15,9 @@ csdn博客本工具介绍:https://blog.csdn.net/u011272795/article/details/82795
使用方法:
##
使用方法:
安装依赖:
###
安装依赖:
```
dependencies:
flutter:
...
...
@@ -28,12 +28,13 @@ dependencies:
url: git://github.com/lizhuoyuan/flutter_ScreenUtil
```
在每个使用的地方导入包:
###
在每个使用的地方导入包:
```
import 'package:flutter_screenutil/flutter_screenutil.dart';
```
### 设置尺寸
在使用之前请设置好设计稿的宽度和高度,如果不设置则使用默认尺寸
传入设计稿的宽度和高度(单位px),默认为1080
*
1920
推荐在项目入口中设置,以保证在每次使用之前设置好了适配尺寸:
...
...
@@ -41,7 +42,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
ScreenUtil.instance = new ScreenUtil(width: 360, height: 720);
```
使用:
###
使用:
```
....
//传入设计稿的px尺寸:
...
...
@@ -82,21 +83,22 @@ import 'package:flutter_app/ScreenUtil.dart'; //导入
appBar: new AppBar(
title: new Text(widget.title),
),
body: Column(
body: new Center(
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Container(
width: ScreenUtil().setWidth(540
),
width: ScreenUtil().setWidth(375
),
height: ScreenUtil().setHeight(200),
color: Colors.red,
child: Text(ScreenUtil().setWidth(540
).toString()),
child: Text(ScreenUtil().setWidth(375
).toString()),
),
Container(
width: ScreenUtil().setWidth(540
),
width: ScreenUtil().setWidth(375
),
height: ScreenUtil().setHeight(200),
color: Colors.blue,
child: Text(ScreenUtil().setWidth(540
).toString()),
child: Text(ScreenUtil().setWidth(375
).toString()),
),
],
),
...
...
Please
register
or
login
to post a comment