li_zy
Committed by GitHub

Update README.md

Showing 1 changed file with 11 additions and 9 deletions
@@ -15,9 +15,9 @@ csdn博客本工具介绍:https://blog.csdn.net/u011272795/article/details/82795 @@ -15,9 +15,9 @@ csdn博客本工具介绍:https://blog.csdn.net/u011272795/article/details/82795
15 15
16 16
17 17
18 -使用方法: 18 +## 使用方法:
19 19
20 -安装依赖: 20 +### 安装依赖:
21 ``` 21 ```
22 dependencies: 22 dependencies:
23 flutter: 23 flutter:
@@ -28,12 +28,13 @@ dependencies: @@ -28,12 +28,13 @@ dependencies:
28 url: git://github.com/lizhuoyuan/flutter_ScreenUtil 28 url: git://github.com/lizhuoyuan/flutter_ScreenUtil
29 ``` 29 ```
30 30
31 -在每个使用的地方导入包: 31 +### 在每个使用的地方导入包:
32 ``` 32 ```
33 import 'package:flutter_screenutil/flutter_screenutil.dart'; 33 import 'package:flutter_screenutil/flutter_screenutil.dart';
34 34
35 ``` 35 ```
36 36
  37 +### 设置尺寸
37 在使用之前请设置好设计稿的宽度和高度,如果不设置则使用默认尺寸 38 在使用之前请设置好设计稿的宽度和高度,如果不设置则使用默认尺寸
38 传入设计稿的宽度和高度(单位px),默认为1080*1920 39 传入设计稿的宽度和高度(单位px),默认为1080*1920
39 推荐在项目入口中设置,以保证在每次使用之前设置好了适配尺寸: 40 推荐在项目入口中设置,以保证在每次使用之前设置好了适配尺寸:
@@ -41,7 +42,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -41,7 +42,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
41 ScreenUtil.instance = new ScreenUtil(width: 360, height: 720); 42 ScreenUtil.instance = new ScreenUtil(width: 360, height: 720);
42 ``` 43 ```
43 44
44 -使用: 45 +### 使用:
45 ``` 46 ```
46 .... 47 ....
47 //传入设计稿的px尺寸: 48 //传入设计稿的px尺寸:
@@ -82,21 +83,22 @@ import 'package:flutter_app/ScreenUtil.dart'; //导入 @@ -82,21 +83,22 @@ import 'package:flutter_app/ScreenUtil.dart'; //导入
82 appBar: new AppBar( 83 appBar: new AppBar(
83 title: new Text(widget.title), 84 title: new Text(widget.title),
84 ), 85 ),
85 - body: Column( 86 + body: new Center(
  87 + child: Column(
86 children: <Widget>[ 88 children: <Widget>[
87 Row( 89 Row(
88 children: <Widget>[ 90 children: <Widget>[
89 Container( 91 Container(
90 - width: ScreenUtil().setWidth(540), 92 + width: ScreenUtil().setWidth(375),
91 height: ScreenUtil().setHeight(200), 93 height: ScreenUtil().setHeight(200),
92 color: Colors.red, 94 color: Colors.red,
93 - child: Text(ScreenUtil().setWidth(540).toString()), 95 + child: Text(ScreenUtil().setWidth(375).toString()),
94 ), 96 ),
95 Container( 97 Container(
96 - width: ScreenUtil().setWidth(540), 98 + width: ScreenUtil().setWidth(375),
97 height: ScreenUtil().setHeight(200), 99 height: ScreenUtil().setHeight(200),
98 color: Colors.blue, 100 color: Colors.blue,
99 - child: Text(ScreenUtil().setWidth(540).toString()), 101 + child: Text(ScreenUtil().setWidth(375).toString()),
100 ), 102 ),
101 ], 103 ],
102 ), 104 ),