Committed by
GitHub
add w and h on EdgeInsets,Radius,BorderRadius,BoxConstraints (#430)
Co-authored-by: cordy <cordy@blinghour.com>
Showing
1 changed file
with
39 additions
and
1 deletions
| @@ -57,6 +57,18 @@ extension EdgeInsetsExtension on EdgeInsets { | @@ -57,6 +57,18 @@ extension EdgeInsetsExtension on EdgeInsets { | ||
| 57 | right: right.r, | 57 | right: right.r, |
| 58 | left: left.r, | 58 | left: left.r, |
| 59 | ); | 59 | ); |
| 60 | + EdgeInsets get w => copyWith( | ||
| 61 | + top: top.w, | ||
| 62 | + bottom: bottom.w, | ||
| 63 | + right: right.w, | ||
| 64 | + left: left.w, | ||
| 65 | + ); | ||
| 66 | + EdgeInsets get h => copyWith( | ||
| 67 | + top: top.h, | ||
| 68 | + bottom: bottom.h, | ||
| 69 | + right: right.h, | ||
| 70 | + left: left.h, | ||
| 71 | + ); | ||
| 60 | } | 72 | } |
| 61 | 73 | ||
| 62 | extension BorderRaduisExtension on BorderRadius { | 74 | extension BorderRaduisExtension on BorderRadius { |
| @@ -66,12 +78,26 @@ extension BorderRaduisExtension on BorderRadius { | @@ -66,12 +78,26 @@ extension BorderRaduisExtension on BorderRadius { | ||
| 66 | bottomRight: bottomRight.r, | 78 | bottomRight: bottomRight.r, |
| 67 | topLeft: topLeft.r, | 79 | topLeft: topLeft.r, |
| 68 | topRight: topRight.r, | 80 | topRight: topRight.r, |
| 69 | - ); | 81 | + ); |
| 82 | + BorderRadius get w => copyWith( | ||
| 83 | + bottomLeft: bottomLeft.w, | ||
| 84 | + bottomRight: bottomRight.w, | ||
| 85 | + topLeft: topLeft.w, | ||
| 86 | + topRight: topRight.w, | ||
| 87 | + ); | ||
| 88 | + BorderRadius get h => copyWith( | ||
| 89 | + bottomLeft: bottomLeft.h, | ||
| 90 | + bottomRight: bottomRight.h, | ||
| 91 | + topLeft: topLeft.h, | ||
| 92 | + topRight: topRight.h, | ||
| 93 | + ); | ||
| 70 | } | 94 | } |
| 71 | 95 | ||
| 72 | extension RaduisExtension on Radius { | 96 | extension RaduisExtension on Radius { |
| 73 | /// Creates adapt Radius using r [SizeExtension]. | 97 | /// Creates adapt Radius using r [SizeExtension]. |
| 74 | Radius get r => Radius.elliptical(x.r, y.r); | 98 | Radius get r => Radius.elliptical(x.r, y.r); |
| 99 | + Radius get w => Radius.elliptical(x.w, y.w); | ||
| 100 | + Radius get h => Radius.elliptical(x.h, y.h); | ||
| 75 | } | 101 | } |
| 76 | 102 | ||
| 77 | extension BoxConstraintsExtension on BoxConstraints { | 103 | extension BoxConstraintsExtension on BoxConstraints { |
| @@ -90,4 +116,16 @@ extension BoxConstraintsExtension on BoxConstraints { | @@ -90,4 +116,16 @@ extension BoxConstraintsExtension on BoxConstraints { | ||
| 90 | minHeight: minHeight.h, | 116 | minHeight: minHeight.h, |
| 91 | minWidth: minWidth.w, | 117 | minWidth: minWidth.w, |
| 92 | ); | 118 | ); |
| 119 | + BoxConstraints get w => this.copyWith( | ||
| 120 | + maxHeight: maxHeight.w, | ||
| 121 | + maxWidth: maxWidth.w, | ||
| 122 | + minHeight: minHeight.w, | ||
| 123 | + minWidth: minWidth.w, | ||
| 124 | + ); | ||
| 125 | + BoxConstraints get h => this.copyWith( | ||
| 126 | + maxHeight: maxHeight.h, | ||
| 127 | + maxWidth: maxWidth.h, | ||
| 128 | + minHeight: minHeight.h, | ||
| 129 | + minWidth: minWidth.h, | ||
| 130 | + ); | ||
| 93 | } | 131 | } |
-
Please register or login to post a comment