borderRadius method
Implementation
IrCorners? borderRadius(DartValue? v) {
final d = deref(v);
if (d is! ObjectValue) return null;
if (d.type != 'BorderRadius' && d.type != 'BorderRadiusDirectional') {
return null;
}
double r(DartValue? x) => radius(x) ?? 0;
switch (d.constructor) {
case 'circular':
return IrCorners.all(number(d.arg(0)) ?? 0);
case 'all':
return IrCorners.all(r(d.arg(0)));
case 'only':
return IrCorners(
topLeft: r(d['topLeft'] ?? d['topStart']),
topRight: r(d['topRight'] ?? d['topEnd']),
bottomRight: r(d['bottomRight'] ?? d['bottomEnd']),
bottomLeft: r(d['bottomLeft'] ?? d['bottomStart']),
);
case 'vertical':
final top = r(d['top']), bottom = r(d['bottom']);
return IrCorners(
topLeft: top,
topRight: top,
bottomLeft: bottom,
bottomRight: bottom,
);
case 'horizontal':
final left = r(d['left'] ?? d['start']);
final right = r(d['right'] ?? d['end']);
return IrCorners(
topLeft: left,
bottomLeft: left,
topRight: right,
bottomRight: right,
);
case 'zero':
return IrCorners.zero;
}
return null;
}