borderRadiusScaled method
BorderRadius
borderRadiusScaled({
- double? all,
- double? left,
- double? right,
- double? top,
- double? bottom,
- double? leftTop,
- double? leftBottom,
- double? rightTop,
- double? rightBottom,
- Radius createRadius()?,
inherited
Implementation
BorderRadius borderRadiusScaled({
double? all,
double? left,
double? right,
double? top,
double? bottom,
double? leftTop,
double? leftBottom,
double? rightTop,
double? rightBottom,
Radius Function(double)? createRadius,
}) {
// by default, the radius is half the margin.
final base = size2;
var lt = base;
var lb = lt;
var rt = lt;
var rb = lt;
if(all != null) {
lt = base * all;
lb = base * all;
rt = base * all;
rb = base * all;
}
if(left != null) {
lt = base * left;
lb = base * left;
}
if(right != null) {
rt = base * right;
rb = base * right;
}
if(top != null) {
lt = base * top;
rt = base * top;
}
if(bottom != null) {
lb = base * bottom;
rb = base * bottom;
}
if(leftTop != null) {
lt = base * leftTop;
}
if(leftBottom != null) {
lb = base * leftBottom;
}
if(rightTop != null) {
rt = base * rightTop;
}
if(rightBottom != null) {
rb = base * rightBottom;
}
createRadius ??= radiusCircular;
return BorderRadius.only(
topLeft: createRadius(lt),
bottomLeft: createRadius(lb),
topRight: createRadius(rt),
bottomRight: createRadius(rb)
);
}