李卓原

文档优化

@@ -89,17 +89,34 @@ Container( @@ -89,17 +89,34 @@ Container(
89 89
90 #### Adapter font: 90 #### Adapter font:
91 ``` 91 ```
92 - ScreenUtil().setSp(28) //Incoming font size,the unit is pixel, fonts will not scale to respect Text Size accessibility settings  
93 - ScreenUtil(allowFontScaling: true).setSp(28) //Incoming font size,the unit is pixel,fonts will scale to respect Text Size accessibility settings  
94 -  
95 -for example:  
96 - Text(  
97 - 'My font size is 28px and will not change with the system.',  
98 - style: TextStyle(  
99 - color: Colors.black,  
100 - fontSize:ScreenUtil(allowFontScaling: true).setSp(28, false)  
101 - )  
102 - ), 92 +//Incoming font size,the unit is pixel, fonts will not scale to respect Text Size accessibility settings
  93 +//(AllowallowFontScaling when initializing ScreenUtil)
  94 +ScreenUtil().setSp(28)
  95 +
  96 +//Incoming font size,the unit is pixel,fonts will scale to respect Text Size accessibility settings
  97 +//(If somewhere does not follow the global allowFontScaling setting)
  98 +ScreenUtil(allowFontScaling: true).setSp(28)
  99 +
  100 +//for example:
  101 +
  102 +Column(
  103 + crossAxisAlignment: CrossAxisAlignment.start,
  104 + children: <Widget>[
  105 + Text(
  106 + 'My font size is 24px on the design draft and will not change with the system.',
  107 + style: TextStyle(
  108 + color: Colors.black,
  109 + fontSize: ScreenUtil().setSp(24),
  110 + )),
  111 + Text(
  112 + 'My font size is 24px on the design draft and will change with the system.',
  113 + style: TextStyle(
  114 + color: Colors.black,
  115 + fontSize: ScreenUtil(allowFontScaling: true).setSp(24),
  116 + )),
  117 + ],
  118 + )
  119 +
103 120
104 ``` 121 ```
105 122
@@ -94,17 +94,26 @@ Container( @@ -94,17 +94,26 @@ Container(
94 传入设计稿的px尺寸: 94 传入设计稿的px尺寸:
95 95
96 ``` 96 ```
97 - ScreenUtil().setSp(28) //传入字体大小,默认不根据系统的“字体大小”辅助选项来进行缩放  
98 - ScreenUtil(allowFontScaling: true).setSp(28) //传入字体大小,根据系统的“字体大小”辅助选项来进行缩放 97 +//传入字体大小,默认不根据系统的“字体大小”辅助选项来进行缩放(可在初始化ScreenUtil时设置allowFontScaling)
  98 +ScreenUtil().setSp(28)
  99 +
  100 +//传入字体大小,根据系统的“字体大小”辅助选项来进行缩放(如果某个地方不遵循全局的allowFontScaling设置)
  101 +ScreenUtil(allowFontScaling: true).setSp(28)
99 102
100 -for example:  
101 - Text(  
102 - 'My font size is 28px and will not change with the system.',  
103 - style: TextStyle(  
104 - color: Colors.black,  
105 - fontSize: ScreenUtil(allowFontScaling: true).setSp(28)  
106 - )  
107 - ), 103 +//for example:
  104 +
  105 +Column(
  106 + crossAxisAlignment: CrossAxisAlignment.start,
  107 + children: <Widget>[
  108 + Text('我的文字大小在设计稿上是25px,不会随着系统的文字缩放比例变化',
  109 + style: TextStyle(
  110 + color: Colors.black, fontSize: ScreenUtil().setSp(24))),
  111 + Text('我的文字大小在设计稿上是25px,会随着系统的文字缩放比例变化',
  112 + style: TextStyle(
  113 + color: Colors.black, fontSize: ScreenUtil(allowFontScaling: true).setSp(24))),
  114 + ],
  115 + )
  116 +
108 117
109 ``` 118 ```
110 119
1 name: flutter_screenutil 1 name: flutter_screenutil
2 description: A flutter plugin for adapting screen and font size.Guaranteed to look good on different models 2 description: A flutter plugin for adapting screen and font size.Guaranteed to look good on different models
3 -version: 0.4.5 3 +version: 0.4.6
4 author: LiZhuoyuan <zhuoyuan93@gmail.com> 4 author: LiZhuoyuan <zhuoyuan93@gmail.com>
5 homepage: https://github.com/OpenFlutter/flutter_ScreenUtil 5 homepage: https://github.com/OpenFlutter/flutter_ScreenUtil
6 6