Showing
4 changed files
with
8 additions
and
12 deletions
@@ -206,8 +206,7 @@ Container( | @@ -206,8 +206,7 @@ Container( | ||
206 | 206 | ||
207 | #### Adapter font: | 207 | #### Adapter font: |
208 | ``` dart | 208 | ``` dart |
209 | -//Incoming font size(The unit is the same as the unit at initialization), fonts will not scale to respect Text Size accessibility settings | ||
210 | -//(AllowallowFontScaling when initializing ScreenUtil) | 209 | +//Incoming font size(The unit is the same as the unit at initialization) |
211 | ScreenUtil().setSp(28) | 210 | ScreenUtil().setSp(28) |
212 | 28.sp | 211 | 28.sp |
213 | 212 | ||
@@ -226,7 +225,7 @@ Column( | @@ -226,7 +225,7 @@ Column( | ||
226 | style: TextStyle( | 225 | style: TextStyle( |
227 | color: Colors.black, | 226 | color: Colors.black, |
228 | fontSize: ScreenUtil() | 227 | fontSize: ScreenUtil() |
229 | - .setSp(24, allowFontScalingSelf: true))), | 228 | + .setSp(24))), |
230 | ], | 229 | ], |
231 | ) | 230 | ) |
232 | ``` | 231 | ``` |
@@ -192,7 +192,7 @@ height:200.h | @@ -192,7 +192,7 @@ height:200.h | ||
192 | 传入设计稿的字体大小: | 192 | 传入设计稿的字体大小: |
193 | 193 | ||
194 | ```dart | 194 | ```dart |
195 | -//传入字体大小(单位和初始化时的单位保持一致),默认不根据系统的“字体大小”辅助选项来进行缩放(可在初始化ScreenUtil时设置allowFontScaling) | 195 | +//传入字体大小(单位和初始化时的单位保持一致) |
196 | ScreenUtil().setSp(28) | 196 | ScreenUtil().setSp(28) |
197 | 或 | 197 | 或 |
198 | 28.sp (dart sdk>=2.6) | 198 | 28.sp (dart sdk>=2.6) |
@@ -205,13 +205,12 @@ Column( | @@ -205,13 +205,12 @@ Column( | ||
205 | Text('我的文字大小在设计稿上是24dp,不会随着系统的文字缩放比例变化', | 205 | Text('我的文字大小在设计稿上是24dp,不会随着系统的文字缩放比例变化', |
206 | style: TextStyle( | 206 | style: TextStyle( |
207 | color: Colors.black, | 207 | color: Colors.black, |
208 | - fontSize: ScreenUtil().setSp(24), | 208 | + fontSize: 24.sp, |
209 | )), | 209 | )), |
210 | Text('我的文字大小在设计稿上是24dp,会随着系统的文字缩放比例变化', | 210 | Text('我的文字大小在设计稿上是24dp,会随着系统的文字缩放比例变化', |
211 | style: TextStyle( | 211 | style: TextStyle( |
212 | color: Colors.black, | 212 | color: Colors.black, |
213 | - fontSize: ScreenUtil() | ||
214 | - .setSp(24, allowFontScalingSelf: true))), | 213 | + fontSize: 24.sp)), |
215 | ], | 214 | ], |
216 | ) | 215 | ) |
217 | ``` | 216 | ``` |
@@ -102,7 +102,6 @@ class _HomePageState extends State<HomePage> { | @@ -102,7 +102,6 @@ class _HomePageState extends State<HomePage> { | ||
102 | maxWidth: MediaQuery.of(context).size.width, | 102 | maxWidth: MediaQuery.of(context).size.width, |
103 | maxHeight: MediaQuery.of(context).size.height), | 103 | maxHeight: MediaQuery.of(context).size.height), |
104 | designSize: Size(360, 690), | 104 | designSize: Size(360, 690), |
105 | - allowFontScaling: false, | ||
106 | orientation: Orientation.portrait); | 105 | orientation: Orientation.portrait); |
107 | return Scaffold(); | 106 | return Scaffold(); |
108 | } | 107 | } |
@@ -188,8 +187,8 @@ Container( | @@ -188,8 +187,8 @@ Container( | ||
188 | 187 | ||
189 | #### Adaptar fonte: | 188 | #### Adaptar fonte: |
190 | ``` dart | 189 | ``` dart |
191 | -//Tamanho da fonte informado, em pixels, a fonte não irá dimensionar respeitando a opção "Tamanho de Fonte" nas configurações de acessibilidade | ||
192 | -//(allowFontScaling quando iniciar o ScreenUtil) | 190 | +//Tamanho da fonte informado, em dp |
191 | + | ||
193 | ScreenUtil().setSp(28) | 192 | ScreenUtil().setSp(28) |
194 | 193 | ||
195 | //Tamanho da fonte informado,em pixels,a fonte irá dimensionar respeitando a opção "Tamanho de Fonte" nas configurações de acessibilidade | 194 | //Tamanho da fonte informado,em pixels,a fonte irá dimensionar respeitando a opção "Tamanho de Fonte" nas configurações de acessibilidade |
@@ -211,7 +210,7 @@ Column( | @@ -211,7 +210,7 @@ Column( | ||
211 | style: TextStyle( | 210 | style: TextStyle( |
212 | color: Colors.black, | 211 | color: Colors.black, |
213 | fontSize: ScreenUtil() | 212 | fontSize: ScreenUtil() |
214 | - .setSp(24, allowFontScalingSelf: true))), | 213 | + .setSp(24))), |
215 | ], | 214 | ], |
216 | ) | 215 | ) |
217 | ``` | 216 | ``` |
@@ -126,7 +126,6 @@ class _ExampleWidgetState extends State<ExampleWidget> { | @@ -126,7 +126,6 @@ class _ExampleWidgetState extends State<ExampleWidget> { | ||
126 | onPressed: () { | 126 | onPressed: () { |
127 | ScreenUtil.init( | 127 | ScreenUtil.init( |
128 | designSize: Size(1500, 1334), | 128 | designSize: Size(1500, 1334), |
129 | - allowFontScaling: false, | ||
130 | ); | 129 | ); |
131 | setState(() {}); | 130 | setState(() {}); |
132 | }, | 131 | }, |
-
Please register or login to post a comment