@@ -23,7 +23,7 @@ dependencies:
2323 flutter :
2424 sdk : flutter
2525 # add flutter_screenutil
26- flutter_screenutil : ^4.0.0-beta3
26+ flutter_screenutil : ^4.0.1
2727` ` `
2828### Add the following imports to your Dart code:
2929` ` ` dart
@@ -34,7 +34,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
3434
3535| Property| Type| Default Value| Description|
3636| :---| :---| :---| :---|
37- | designSize| Size| Size(1080, 1920 )| The size of the device in the design draft, in px |
37+ | designSize| Size| Size(360, 690 )| The size of the device in the design draft, in dp |
3838| allowFontScaling| bool| false| Sets whether the font size is scaled according to the system's "font size" assist option|
3939
4040### Initialize and set the fit size and font size to scale according to the system's "font size" accessibility option
@@ -59,22 +59,22 @@ class MyApp extends StatelessWidget {
5959
6060//fill in the screen size of the device in the design
6161
62- //default value : width : 1080px , height:1920px , allowFontScaling:false
62+ //default value : width : 360dp , height:690dp , allowFontScaling:false
6363ScreenUtil.init(constraints);
6464
65- //If the design is based on the size of the iPhone6 (iPhone6 750*1334 )
66- ScreenUtil.init(constraints, designSize: Size(750, 1334 ));
65+ //The size of the equipment in the design draft(360,690 )
66+ ScreenUtil.init(constraints, designSize: Size(360, 690 ));
6767
6868//If you want to set the font size is scaled according to the system's "font size" assist option
69- ScreenUtil.init(constraints, designSize: Size(750, 1334 ), allowFontScaling: true);
69+ ScreenUtil.init(constraints, designSize: Size(360, 690 ), allowFontScaling: true);
7070
7171```
7272
7373### Use:
7474
7575### API
7676
77- #### Pass the px size of the design draft
77+ #### Pass the dp size of the design draft
7878
7979``` dart
8080 ScreenUtil().setWidth(540) (dart sdk>=2.6 : 540.w) //Adapted to screen width
@@ -87,19 +87,19 @@ ScreenUtil.init(constraints, designSize: Size(750, 1334), allowFontScaling: true
8787 ScreenUtil().screenWidth (dart sdk>=2.6 : 1.sw) //Device width
8888 ScreenUtil().screenHeight (dart sdk>=2.6 : 1.sh) //Device height
8989 ScreenUtil().bottomBarHeight //Bottom safe zone distance, suitable for buttons with full screen
90- ScreenUtil().statusBarHeight //Status bar height , Notch will be higher Unit px
90+ ScreenUtil().statusBarHeight //Status bar height , Notch will be higher
9191 ScreenUtil().textScaleFactor //System font scaling factor
9292
93- ScreenUtil().scaleWidth //Ratio of actual width dp to ui design
94- ScreenUtil().scaleHeight //Ratio of actual height dp to ui design
93+ ScreenUtil().scaleWidth //The ratio of actual width to UI design
94+ ScreenUtil().scaleHeight //The ratio of actual height to UI design
9595
9696 0.2.sw //0.2 times the screen width
9797 0.5.sh //50% of screen height
9898```
9999
100100#### Adapt screen size:
101101
102- Pass the px size of the design draft((The unit is the same as the unit at initialization)):
102+ Pass the dp size of the design draft((The unit is the same as the unit at initialization)):
103103
104104Adapted to screen width: ` ScreenUtil().setWidth(540) ` ,
105105
@@ -169,13 +169,13 @@ Column(
169169 crossAxisAlignment: CrossAxisAlignment.start,
170170 children: <Widget>[
171171 Text(
172- 'My font size is 24px on the design draft and will not change with the system.',
172+ 'My font size is 24dp on the design draft and will not change with the system.',
173173 style: TextStyle(
174174 color: Colors.black,
175175 fontSize: ScreenUtil().setSp(24),
176176 )),
177177 Text(
178- 'My font size is 24px on the design draft and will change with the system.',
178+ 'My font size is 24dp on the design draft and will change with the system.',
179179 style: TextStyle(
180180 color: Colors.black,
181181 fontSize: ScreenUtil()
0 commit comments