jx2cordy
Committed by GitHub

add w and h on EdgeInsets,Radius,BorderRadius,BoxConstraints (#430)

Co-authored-by: cordy <cordy@blinghour.com>
... ... @@ -57,6 +57,18 @@ extension EdgeInsetsExtension on EdgeInsets {
right: right.r,
left: left.r,
);
EdgeInsets get w => copyWith(
top: top.w,
bottom: bottom.w,
right: right.w,
left: left.w,
);
EdgeInsets get h => copyWith(
top: top.h,
bottom: bottom.h,
right: right.h,
left: left.h,
);
}
extension BorderRaduisExtension on BorderRadius {
... ... @@ -66,12 +78,26 @@ extension BorderRaduisExtension on BorderRadius {
bottomRight: bottomRight.r,
topLeft: topLeft.r,
topRight: topRight.r,
);
);
BorderRadius get w => copyWith(
bottomLeft: bottomLeft.w,
bottomRight: bottomRight.w,
topLeft: topLeft.w,
topRight: topRight.w,
);
BorderRadius get h => copyWith(
bottomLeft: bottomLeft.h,
bottomRight: bottomRight.h,
topLeft: topLeft.h,
topRight: topRight.h,
);
}
extension RaduisExtension on Radius {
/// Creates adapt Radius using r [SizeExtension].
Radius get r => Radius.elliptical(x.r, y.r);
Radius get w => Radius.elliptical(x.w, y.w);
Radius get h => Radius.elliptical(x.h, y.h);
}
extension BoxConstraintsExtension on BoxConstraints {
... ... @@ -90,4 +116,16 @@ extension BoxConstraintsExtension on BoxConstraints {
minHeight: minHeight.h,
minWidth: minWidth.w,
);
BoxConstraints get w => this.copyWith(
maxHeight: maxHeight.w,
maxWidth: maxWidth.w,
minHeight: minHeight.w,
minWidth: minWidth.w,
);
BoxConstraints get h => this.copyWith(
maxHeight: maxHeight.h,
maxWidth: maxWidth.h,
minHeight: minHeight.h,
minWidth: minWidth.h,
);
}
... ...