Showing
4 changed files
with
12 additions
and
5 deletions
@@ -125,7 +125,12 @@ class ScreenUtil { | @@ -125,7 +125,12 @@ class ScreenUtil { | ||
125 | ///Font size adaptation method | 125 | ///Font size adaptation method |
126 | ///- [fontSize] The size of the font on the UI design, in dp. | 126 | ///- [fontSize] The size of the font on the UI design, in dp. |
127 | ///- [allowFontScaling] | 127 | ///- [allowFontScaling] |
128 | - double setSp(num fontSize, {bool? allowFontScalingSelf}) => allowFontScalingSelf == null | ||
129 | - ? (allowFontScaling ? (fontSize * scaleText) * _textScaleFactor : (fontSize * scaleText)) | ||
130 | - : (allowFontScalingSelf ? (fontSize * scaleText) * _textScaleFactor : (fontSize * scaleText)); | 128 | + double setSp(num fontSize, {bool? allowFontScalingSelf}) => |
129 | + allowFontScalingSelf == null | ||
130 | + ? (allowFontScaling | ||
131 | + ? (fontSize * scaleText) * _textScaleFactor | ||
132 | + : (fontSize * scaleText)) | ||
133 | + : (allowFontScalingSelf | ||
134 | + ? (fontSize * scaleText) * _textScaleFactor | ||
135 | + : (fontSize * scaleText)); | ||
131 | } | 136 | } |
1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
2 | import 'package:flutter_screenutil/screen_util.dart'; | 2 | import 'package:flutter_screenutil/screen_util.dart'; |
3 | 3 | ||
4 | - | ||
5 | class ScreenUtilInit extends StatelessWidget { | 4 | class ScreenUtilInit extends StatelessWidget { |
6 | /// A helper widget that initializes [ScreenUtil] | 5 | /// A helper widget that initializes [ScreenUtil] |
7 | ScreenUtilInit({ | 6 | ScreenUtilInit({ |
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: 5.0.0-nullsafety.7 | 3 | +version: 5.0.0-nullsafety.8 |
4 | homepage: https://github.com/OpenFlutter/flutter_screenutil | 4 | homepage: https://github.com/OpenFlutter/flutter_screenutil |
5 | 5 | ||
6 | environment: | 6 | environment: |
-
Please register or login to post a comment