lizhuoyuan

参数同时支持传入 int / double 或者是var size = 100 , var size = 100.0

@@ -93,7 +93,7 @@ class ScreenUtil { @@ -93,7 +93,7 @@ class ScreenUtil {
93 /// Adapted to the device width of the UI Design. 93 /// Adapted to the device width of the UI Design.
94 /// Height can also be adapted according to this to ensure no deformation , 94 /// Height can also be adapted according to this to ensure no deformation ,
95 /// if you want a square 95 /// if you want a square
96 - setWidth(double width) => width * scaleWidth; 96 + setWidth(num width) => width * scaleWidth;
97 97
98 /// 根据UI设计的设备高度适配 98 /// 根据UI设计的设备高度适配
99 /// 当发现UI设计中的一屏显示的与当前样式效果不符合时, 99 /// 当发现UI设计中的一屏显示的与当前样式效果不符合时,
@@ -103,14 +103,14 @@ class ScreenUtil { @@ -103,14 +103,14 @@ class ScreenUtil {
103 /// It is recommended to use this method to achieve a high degree of adaptation 103 /// It is recommended to use this method to achieve a high degree of adaptation
104 /// when it is found that one screen in the UI design 104 /// when it is found that one screen in the UI design
105 /// does not match the current style effect, or if there is a difference in shape. 105 /// does not match the current style effect, or if there is a difference in shape.
106 - setHeight(double height) => height * scaleHeight; 106 + setHeight(num height) => height * scaleHeight;
107 107
108 ///字体大小适配方法 108 ///字体大小适配方法
109 ///@param [fontSize] UI设计上字体的大小,单位px. 109 ///@param [fontSize] UI设计上字体的大小,单位px.
110 ///Font size adaptation method 110 ///Font size adaptation method
111 ///@param [fontSize] The size of the font on the UI design, in px. 111 ///@param [fontSize] The size of the font on the UI design, in px.
112 ///@param [allowFontScaling] 112 ///@param [allowFontScaling]
113 - setSp(double fontSize) => allowFontScaling 113 + setSp(num fontSize) => allowFontScaling
114 ? setWidth(fontSize) 114 ? setWidth(fontSize)
115 : setWidth(fontSize) / _textScaleFactor; 115 : setWidth(fontSize) / _textScaleFactor;
116 } 116 }