Showing
1 changed file
with
13 additions
and
3 deletions
@@ -46,15 +46,25 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -46,15 +46,25 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
46 | 适配尺寸: | 46 | 适配尺寸: |
47 | ``` | 47 | ``` |
48 | //传入设计稿的px尺寸: | 48 | //传入设计稿的px尺寸: |
49 | -适配后的宽度width: ScreenUtil().setWidth(540), | ||
50 | -适配后的高度height: ScreenUtil().setHeight(200), | ||
51 | -高度也根据setWidth来做适配可以保证不变形 | 49 | +根据款第适配 width: ScreenUtil().setWidth(540), |
50 | +根据高度适配 height: ScreenUtil().setHeight(200), | ||
51 | + | ||
52 | +**注意** | ||
53 | + | ||
54 | +高度也根据setWidth来做适配可以保证不变形(当你想要一个正方形的时候) | ||
55 | +setHeight方法主要是在高度上进行适配, 在你想控制UI上一屏的高度与实际中显示一样时使用. | ||
52 | 56 | ||
53 | 例如: | 57 | 例如: |
54 | Container( | 58 | Container( |
55 | width: ScreenUtil().setWidth(375), | 59 | width: ScreenUtil().setWidth(375), |
56 | height: ScreenUtil().setHeight(200), | 60 | height: ScreenUtil().setHeight(200), |
57 | ), | 61 | ), |
62 | + | ||
63 | +如果你想显示一个正方形: | ||
64 | +Container( | ||
65 | + width: ScreenUtil().setWidth(300), | ||
66 | + height: ScreenUtil().setWidth(300), | ||
67 | + ), | ||
58 | ``` | 68 | ``` |
59 | 69 | ||
60 | 适配字体: | 70 | 适配字体: |
-
Please register or login to post a comment