Showing
3 changed files
with
30 additions
and
20 deletions
| @@ -217,17 +217,20 @@ Column( | @@ -217,17 +217,20 @@ Column( | ||
| 217 | crossAxisAlignment: CrossAxisAlignment.start, | 217 | crossAxisAlignment: CrossAxisAlignment.start, |
| 218 | children: <Widget>[ | 218 | children: <Widget>[ |
| 219 | Text( | 219 | Text( |
| 220 | - 'My font size is 24dp on the design draft and will not change with the system.', | ||
| 221 | - style: TextStyle( | ||
| 222 | - color: Colors.black, | ||
| 223 | - fontSize: ScreenUtil().setSp(24), | ||
| 224 | - )), | 220 | + '16sp, will not change with the system.', |
| 221 | + style: TextStyle( | ||
| 222 | + color: Colors.black, | ||
| 223 | + fontSize: 16.sp, | ||
| 224 | + ), | ||
| 225 | + textScaleFactor: 1.0, | ||
| 226 | + ), | ||
| 225 | Text( | 227 | Text( |
| 226 | - 'My font size is 24dp on the design draft and will change with the system.', | ||
| 227 | - style: TextStyle( | ||
| 228 | - color: Colors.black, | ||
| 229 | - fontSize: ScreenUtil() | ||
| 230 | - .setSp(24))), | 228 | + '16sp,if data is not set in MediaQuery,my font size will change with the system.', |
| 229 | + style: TextStyle( | ||
| 230 | + color: Colors.black, | ||
| 231 | + fontSize: 16.sp, | ||
| 232 | + ), | ||
| 233 | + ), | ||
| 231 | ], | 234 | ], |
| 232 | ) | 235 | ) |
| 233 | ``` | 236 | ``` |
| @@ -204,15 +204,21 @@ ScreenUtil().setSp(28) | @@ -204,15 +204,21 @@ ScreenUtil().setSp(28) | ||
| 204 | Column( | 204 | Column( |
| 205 | crossAxisAlignment: CrossAxisAlignment.start, | 205 | crossAxisAlignment: CrossAxisAlignment.start, |
| 206 | children: <Widget>[ | 206 | children: <Widget>[ |
| 207 | - Text('我的文字大小在设计稿上是24dp,不会随着系统的文字缩放比例变化', | ||
| 208 | - style: TextStyle( | ||
| 209 | - color: Colors.black, | ||
| 210 | - fontSize: 24.sp, | ||
| 211 | - )), | ||
| 212 | - Text('我的文字大小在设计稿上是24dp,会随着系统的文字缩放比例变化', | ||
| 213 | - style: TextStyle( | ||
| 214 | - color: Colors.black, | ||
| 215 | - fontSize: 24.sp)), | 207 | + Text( |
| 208 | + '我的文字大小在设计稿上是16dp,因为设置了`textScaleFactor`,所以不会随着系统的文字缩放比例变化', | ||
| 209 | + style: TextStyle( | ||
| 210 | + color: Colors.black, | ||
| 211 | + fontSize: 16.sp, | ||
| 212 | + ), | ||
| 213 | + textScaleFactor: 1.0, | ||
| 214 | + ), | ||
| 215 | + Text( | ||
| 216 | + '我的文字大小在设计稿上是16dp,会随着系统的文字缩放比例变化', | ||
| 217 | + style: TextStyle( | ||
| 218 | + color: Colors.black, | ||
| 219 | + fontSize: 16.sp, | ||
| 220 | + ), | ||
| 221 | + ), | ||
| 216 | ], | 222 | ], |
| 217 | ) | 223 | ) |
| 218 | ``` | 224 | ``` |
| @@ -205,7 +205,8 @@ Column( | @@ -205,7 +205,8 @@ Column( | ||
| 205 | style: TextStyle( | 205 | style: TextStyle( |
| 206 | color: Colors.black, | 206 | color: Colors.black, |
| 207 | fontSize: ScreenUtil().setSp(24), | 207 | fontSize: ScreenUtil().setSp(24), |
| 208 | - )), | 208 | + ), |
| 209 | + textScaleFactor: 1.0,), | ||
| 209 | Text( | 210 | Text( |
| 210 | 'Minha fonte tem 24px no protótipo de design e poderá mudar com o sistema.', | 211 | 'Minha fonte tem 24px no protótipo de design e poderá mudar com o sistema.', |
| 211 | style: TextStyle( | 212 | style: TextStyle( |
-
Please register or login to post a comment