LiZhuoyuan

readme

@@ -47,8 +47,14 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -47,8 +47,14 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
47 ### Initialize and set the fit size and font size to scale according to the system's "font size" accessibility option 47 ### Initialize and set the fit size and font size to scale according to the system's "font size" accessibility option
48 Please set the size of the design draft before use, the width and height of the design draft (unit px). 48 Please set the size of the design draft before use, the width and height of the design draft (unit px).
49 49
  50 +```
50 51
51 -```dart 52 +void main() {
  53 + WidgetsFlutterBinding.ensureInitialized();
  54 + //Set the fit size (fill in the screen size of the device in the design) If the design is based on the size of the iPhone6 ​​(iPhone6 ​​750*1334)
  55 + ScreenUtil.init(designSize: Size(750, 1334), allowFontScaling: false);
  56 + runApp(MyApp());
  57 +}
52 58
53 //fill in the screen size of the device in the design 59 //fill in the screen size of the device in the design
54 60
@@ -56,15 +56,21 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -56,15 +56,21 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
56 56
57 ``` 57 ```
58 //填入设计稿中设备的屏幕尺寸 58 //填入设计稿中设备的屏幕尺寸
  59 +void main() {
  60 + WidgetsFlutterBinding.ensureInitialized();
  61 + //设置适配尺寸 (填入设计稿中设备的屏幕尺寸) 此处假如设计稿是按iPhone6的尺寸设计的(iPhone6 750*1334)
  62 + ScreenUtil.init(designSize: Size(750, 1334), allowFontScaling: false);
  63 + runApp(MyApp());
  64 +}
59 65
60 //默认 width : 1080px , height:1920px , allowFontScaling:false 66 //默认 width : 1080px , height:1920px , allowFontScaling:false
61 -ScreenUtil.init(context); 67 +ScreenUtil.init();
62 68
63 //假如设计稿是按iPhone6的尺寸设计的(iPhone6 750*1334) 69 //假如设计稿是按iPhone6的尺寸设计的(iPhone6 750*1334)
64 -ScreenUtil.init(context, width: 750, height: 1334); 70 +ScreenUtil.init(designSize: Size(750, 1334));
65 71
66 //设置字体大小根据系统的“字体大小”辅助选项来进行缩放,默认为false 72 //设置字体大小根据系统的“字体大小”辅助选项来进行缩放,默认为false
67 -ScreenUtil.init(context, width: 750, height: 1334, allowFontScaling: true); 73 +ScreenUtil.init(designSize: Size(750, 1334), allowFontScaling: true);
68 74
69 ``` 75 ```
70 76
@@ -47,17 +47,22 @@ Por favor, defina a largura e altura do protótipo de design antes de usar (em p @@ -47,17 +47,22 @@ Por favor, defina a largura e altura do protótipo de design antes de usar (em p
47 Certifique-se de definir as dimensões na paginal inicial do MaterialApp (ou seja, no arquivo de entrada, defina apenas uma vez) para garantir que o tamanho de ajuste seja o mesmo antes de cada uso: 47 Certifique-se de definir as dimensões na paginal inicial do MaterialApp (ou seja, no arquivo de entrada, defina apenas uma vez) para garantir que o tamanho de ajuste seja o mesmo antes de cada uso:
48 48
49 ```dart 49 ```dart
50 -  
51 //Preencha o tamanho da tela do dispositivo no protótipo de design 50 //Preencha o tamanho da tela do dispositivo no protótipo de design
  51 +void main() {
  52 + WidgetsFlutterBinding.ensureInitialized();
  53 + //Set the fit size (fill in the screen size of the device in the design) If the design is based on the size of the iPhone6 ​​(iPhone6 ​​750*1334)
  54 + ScreenUtil.init(designSize: Size(750, 1334), allowFontScaling: false);
  55 + runApp(MyApp());
  56 +}
52 57
53 //Valor padrão: width : 1080px , height:1920px , allowFontScaling:false 58 //Valor padrão: width : 1080px , height:1920px , allowFontScaling:false
54 -ScreenUtil.init(context); 59 +ScreenUtil.init();
55 60
56 //Se o design é baseado no iPhone6 ​​(iPhone6 ​​750*1334) 61 //Se o design é baseado no iPhone6 ​​(iPhone6 ​​750*1334)
57 -ScreenUtil.init(context, width: 750, height: 1334); 62 +ScreenUtil.init(designSize: Size(750, 1334));
58 63
59 //Se você quer definir que o tamanho da fonte seja ajustado de acordo com a opção "tamanho da fonte" na acessibilidade do sistema 64 //Se você quer definir que o tamanho da fonte seja ajustado de acordo com a opção "tamanho da fonte" na acessibilidade do sistema
60 -ScreenUtil.init(context, width: 750, height: 1334, allowFontScaling: true); 65 +ScreenUtil.init(designSize: Size(750, 1334), allowFontScaling: true);
61 66
62 ``` 67 ```
63 68