resolve static method
Resolves rounded values from TwStyle and TwConfig into BorderRadius
Implementation
static BorderRadius resolve(BuildContext context, TwStyle style) {
final config = TwConfig.of(context);
final borderRadius = config.borderRadius;
// Calculate border radius values
double topLeft = 0;
double topRight = 0;
double bottomLeft = 0;
double bottomRight = 0;
// Apply uniform border radius
final uniformValue = style.rounded;
if (uniformValue != null) {
final value = _getRoundedValue(borderRadius, uniformValue, 'uniform');
topLeft = topRight = bottomLeft = bottomRight = value;
}
// Apply directional border radius (these override uniform border radius)
final topValue = style.roundedT;
if (topValue != null) {
final value = _getRoundedValue(borderRadius, topValue, 'top');
topLeft = topRight = value;
}
final rightValue = style.roundedR;
if (rightValue != null) {
final value = _getRoundedValue(borderRadius, rightValue, 'right');
topRight = bottomRight = value;
}
final bottomValue = style.roundedB;
if (bottomValue != null) {
final value = _getRoundedValue(borderRadius, bottomValue, 'bottom');
bottomLeft = bottomRight = value;
}
final leftValue = style.roundedL;
if (leftValue != null) {
final value = _getRoundedValue(borderRadius, leftValue, 'left');
topLeft = bottomLeft = value;
}
// Apply individual corner border radius (these override directional border radius)
final topLeftValue = style.roundedTl;
if (topLeftValue != null) {
topLeft = _getRoundedValue(borderRadius, topLeftValue, 'top-left');
}
final topRightValue = style.roundedTr;
if (topRightValue != null) {
topRight = _getRoundedValue(borderRadius, topRightValue, 'top-right');
}
final bottomLeftValue = style.roundedBl;
if (bottomLeftValue != null) {
bottomLeft = _getRoundedValue(borderRadius, bottomLeftValue, 'bottom-left');
}
final bottomRightValue = style.roundedBr;
if (bottomRightValue != null) {
bottomRight = _getRoundedValue(borderRadius, bottomRightValue, 'bottom-right');
}
return BorderRadius.only(
topLeft: Radius.circular(topLeft),
topRight: Radius.circular(topRight),
bottomLeft: Radius.circular(bottomLeft),
bottomRight: Radius.circular(bottomRight),
);
}