borderRadius static method
Implementation
static BorderRadius borderRadius(
dynamic value, {
BorderRadius? or = BorderRadius.zero,
}) {
final fallBackValue = or ?? BorderRadius.zero;
if (value == null) return fallBackValue;
if (value is List) {
return _toBorderRadiusFromList(
value.map((e) => NumUtil.toDouble(e) ?? 0).toList()) ??
fallBackValue;
}
if (value is String) {
return _toBorderRadiusFromList(
value.split(',').map((e) => NumUtil.toDouble(e) ?? 0).toList()) ??
fallBackValue;
}
if (value is num) {
return _toBorderRadiusFromList([value.toDouble()]) ?? fallBackValue;
}
if (value is JsonLike) {
return BorderRadius.only(
topLeft: toRadius(value['topLeft']),
topRight: toRadius(value['topRight']),
bottomRight: toRadius(value['bottomRight']),
bottomLeft: toRadius(value['bottomLeft']),
);
}
return fallBackValue;
}