李卓原

5.3.1

  1 +# 5.3.1
  2 +- add num.verticalSpacingRadius
  3 + num.horizontalSpaceRadius
  4 + num.setVerticalSpacingFromWidth
  5 +- update num.horizontalSpace
  6 +
1 # 5.3.0 7 # 5.3.0
2 - For the size, use the context to get it first, which needs to provide the Context 8 - For the size, use the context to get it first, which needs to provide the Context
3 More rigorous context checking 9 More rigorous context checking
@@ -122,11 +122,16 @@ class ScreenUtil { @@ -122,11 +122,16 @@ class ScreenUtil {
122 ///- [fontSize] The size of the font on the UI design, in dp. 122 ///- [fontSize] The size of the font on the UI design, in dp.
123 double setSp(num fontSize) => fontSize * scaleText; 123 double setSp(num fontSize) => fontSize * scaleText;
124 124
125 - Widget setVerticalSpacing(num height) => SizedBox(  
126 - height: height * scaleHeight,  
127 - ); 125 + Widget setVerticalSpacing(num height) => SizedBox(height: setHeight(height));
128 126
129 - Widget setHorizontalSpacing(num width) => SizedBox(  
130 - width: width * scaleHeight,  
131 - ); 127 + Widget setVerticalSpacingFromWidth(num height) =>
  128 + SizedBox(height: setWidth(height));
  129 +
  130 + Widget setHorizontalSpacing(num width) => SizedBox(width: setWidth(width));
  131 +
  132 + Widget setHorizontalSpacingRadius(num width) =>
  133 + SizedBox(width: radius(width));
  134 +
  135 + Widget setVerticalSpacingRadius(num height) =>
  136 + SizedBox(height: radius(height));
132 } 137 }
@@ -26,9 +26,21 @@ extension SizeExtension on num { @@ -26,9 +26,21 @@ extension SizeExtension on num {
26 ///Multiple of screen height 26 ///Multiple of screen height
27 double get sh => ScreenUtil().screenHeight * this; 27 double get sh => ScreenUtil().screenHeight * this;
28 28
29 - ///[ScreenUtil.setWidth] 29 + ///[ScreenUtil.setHeight]
30 Widget get verticalSpace => ScreenUtil().setVerticalSpacing(this); 30 Widget get verticalSpace => ScreenUtil().setVerticalSpacing(this);
31 31
32 - ///[ScreenUtil.setHeight] 32 + ///[ScreenUtil.setVerticalSpacingFromWidth]
  33 + Widget get verticalSpaceFromWidth =>
  34 + ScreenUtil().setVerticalSpacingFromWidth(this);
  35 +
  36 + ///[ScreenUtil.setWidth]
33 Widget get horizontalSpace => ScreenUtil().setHorizontalSpacing(this); 37 Widget get horizontalSpace => ScreenUtil().setHorizontalSpacing(this);
  38 +
  39 + ///[ScreenUtil.radius]
  40 + Widget get horizontalSpaceRadius =>
  41 + ScreenUtil().setHorizontalSpacingRadius(this);
  42 +
  43 + ///[ScreenUtil.radius]
  44 + Widget get verticalSpacingRadius =>
  45 + ScreenUtil().setVerticalSpacingRadius(this);
34 } 46 }