Showing
2 changed files
with
63 additions
and
10 deletions
@@ -227,18 +227,31 @@ class ScreenUtil { | @@ -227,18 +227,31 @@ class ScreenUtil { | ||
227 | double setSp(num fontSize) => | 227 | double setSp(num fontSize) => |
228 | fontSizeResolver?.call(fontSize, _instance) ?? fontSize * scaleText; | 228 | fontSizeResolver?.call(fontSize, _instance) ?? fontSize * scaleText; |
229 | 229 | ||
230 | - Widget setVerticalSpacing(num height) => SizedBox(height: setHeight(height)); | 230 | + SizedBox setVerticalSpacing(num height) => |
231 | + SizedBox(height: setHeight(height)); | ||
231 | 232 | ||
232 | - Widget setVerticalSpacingFromWidth(num height) => | 233 | + SizedBox setVerticalSpacingFromWidth(num height) => |
233 | SizedBox(height: setWidth(height)); | 234 | SizedBox(height: setWidth(height)); |
234 | 235 | ||
235 | - Widget setHorizontalSpacing(num width) => SizedBox(width: setWidth(width)); | 236 | + SizedBox setHorizontalSpacing(num width) => SizedBox(width: setWidth(width)); |
236 | 237 | ||
237 | - Widget setHorizontalSpacingRadius(num width) => | 238 | + SizedBox setHorizontalSpacingRadius(num width) => |
238 | SizedBox(width: radius(width)); | 239 | SizedBox(width: radius(width)); |
239 | 240 | ||
240 | - Widget setVerticalSpacingRadius(num height) => | 241 | + SizedBox setVerticalSpacingRadius(num height) => |
241 | SizedBox(height: radius(height)); | 242 | SizedBox(height: radius(height)); |
243 | + | ||
244 | + SizedBox setHorizontalSpacingDiameter(num width) => | ||
245 | + SizedBox(width: diameter(width)); | ||
246 | + | ||
247 | + SizedBox setVerticalSpacingDiameter(num height) => | ||
248 | + SizedBox(height: diameter(height)); | ||
249 | + | ||
250 | + SizedBox setHorizontalSpacingDiagonal(num width) => | ||
251 | + SizedBox(width: diagonal(width)); | ||
252 | + | ||
253 | + SizedBox setVerticalSpacingDiagonal(num height) => | ||
254 | + SizedBox(height: diagonal(height)); | ||
242 | } | 255 | } |
243 | 256 | ||
244 | extension on MediaQueryData? { | 257 | extension on MediaQueryData? { |
@@ -14,6 +14,12 @@ extension SizeExtension on num { | @@ -14,6 +14,12 @@ extension SizeExtension on num { | ||
14 | ///[ScreenUtil.radius] | 14 | ///[ScreenUtil.radius] |
15 | double get r => ScreenUtil().radius(this); | 15 | double get r => ScreenUtil().radius(this); |
16 | 16 | ||
17 | + ///[ScreenUtil.diagonal] | ||
18 | + double get dg => ScreenUtil().diagonal(this); | ||
19 | + | ||
20 | + ///[ScreenUtil.diameter] | ||
21 | + double get dm => ScreenUtil().diameter(this); | ||
22 | + | ||
17 | ///[ScreenUtil.setSp] | 23 | ///[ScreenUtil.setSp] |
18 | double get sp => ScreenUtil().setSp(this); | 24 | double get sp => ScreenUtil().setSp(this); |
19 | 25 | ||
@@ -36,22 +42,38 @@ extension SizeExtension on num { | @@ -36,22 +42,38 @@ extension SizeExtension on num { | ||
36 | double get sh => ScreenUtil().screenHeight * this; | 42 | double get sh => ScreenUtil().screenHeight * this; |
37 | 43 | ||
38 | ///[ScreenUtil.setHeight] | 44 | ///[ScreenUtil.setHeight] |
39 | - Widget get verticalSpace => ScreenUtil().setVerticalSpacing(this); | 45 | + SizedBox get verticalSpace => ScreenUtil().setVerticalSpacing(this); |
40 | 46 | ||
41 | ///[ScreenUtil.setVerticalSpacingFromWidth] | 47 | ///[ScreenUtil.setVerticalSpacingFromWidth] |
42 | - Widget get verticalSpaceFromWidth => | 48 | + SizedBox get verticalSpaceFromWidth => |
43 | ScreenUtil().setVerticalSpacingFromWidth(this); | 49 | ScreenUtil().setVerticalSpacingFromWidth(this); |
44 | 50 | ||
45 | ///[ScreenUtil.setWidth] | 51 | ///[ScreenUtil.setWidth] |
46 | - Widget get horizontalSpace => ScreenUtil().setHorizontalSpacing(this); | 52 | + SizedBox get horizontalSpace => ScreenUtil().setHorizontalSpacing(this); |
47 | 53 | ||
48 | ///[ScreenUtil.radius] | 54 | ///[ScreenUtil.radius] |
49 | - Widget get horizontalSpaceRadius => | 55 | + SizedBox get horizontalSpaceRadius => |
50 | ScreenUtil().setHorizontalSpacingRadius(this); | 56 | ScreenUtil().setHorizontalSpacingRadius(this); |
51 | 57 | ||
52 | ///[ScreenUtil.radius] | 58 | ///[ScreenUtil.radius] |
53 | - Widget get verticalSpacingRadius => | 59 | + SizedBox get verticalSpacingRadius => |
54 | ScreenUtil().setVerticalSpacingRadius(this); | 60 | ScreenUtil().setVerticalSpacingRadius(this); |
61 | + | ||
62 | + ///[ScreenUtil.diameter] | ||
63 | + SizedBox get horizontalSpaceDiameter => | ||
64 | + ScreenUtil().setHorizontalSpacingDiameter(this); | ||
65 | + | ||
66 | + ///[ScreenUtil.diameter] | ||
67 | + SizedBox get verticalSpacingDiameter => | ||
68 | + ScreenUtil().setVerticalSpacingDiameter(this); | ||
69 | + | ||
70 | + ///[ScreenUtil.diagonal] | ||
71 | + SizedBox get horizontalSpaceDiagonal => | ||
72 | + ScreenUtil().setHorizontalSpacingDiagonal(this); | ||
73 | + | ||
74 | + ///[ScreenUtil.diagonal] | ||
75 | + SizedBox get verticalSpacingDiagonal => | ||
76 | + ScreenUtil().setVerticalSpacingDiagonal(this); | ||
55 | } | 77 | } |
56 | 78 | ||
57 | extension EdgeInsetsExtension on EdgeInsets { | 79 | extension EdgeInsetsExtension on EdgeInsets { |
@@ -63,6 +85,20 @@ extension EdgeInsetsExtension on EdgeInsets { | @@ -63,6 +85,20 @@ extension EdgeInsetsExtension on EdgeInsets { | ||
63 | left: left.r, | 85 | left: left.r, |
64 | ); | 86 | ); |
65 | 87 | ||
88 | + EdgeInsets get dm => copyWith( | ||
89 | + top: top.dm, | ||
90 | + bottom: bottom.dm, | ||
91 | + right: right.dm, | ||
92 | + left: left.dm, | ||
93 | + ); | ||
94 | + | ||
95 | + EdgeInsets get dg => copyWith( | ||
96 | + top: top.dg, | ||
97 | + bottom: bottom.dg, | ||
98 | + right: right.dg, | ||
99 | + left: left.dg, | ||
100 | + ); | ||
101 | + | ||
66 | EdgeInsets get w => copyWith( | 102 | EdgeInsets get w => copyWith( |
67 | top: top.w, | 103 | top: top.w, |
68 | bottom: bottom.w, | 104 | bottom: bottom.w, |
@@ -106,6 +142,10 @@ extension RaduisExtension on Radius { | @@ -106,6 +142,10 @@ extension RaduisExtension on Radius { | ||
106 | /// Creates adapt Radius using r [SizeExtension]. | 142 | /// Creates adapt Radius using r [SizeExtension]. |
107 | Radius get r => Radius.elliptical(x.r, y.r); | 143 | Radius get r => Radius.elliptical(x.r, y.r); |
108 | 144 | ||
145 | + Radius get dm => Radius.elliptical(x.dm, y.dm); | ||
146 | + | ||
147 | + Radius get dg => Radius.elliptical(x.dg, y.dg); | ||
148 | + | ||
109 | Radius get w => Radius.elliptical(x.w, y.w); | 149 | Radius get w => Radius.elliptical(x.w, y.w); |
110 | 150 | ||
111 | Radius get h => Radius.elliptical(x.h, y.h); | 151 | Radius get h => Radius.elliptical(x.h, y.h); |
-
Please register or login to post a comment