expressionToPadding static method

List<double?> expressionToPadding(
  1. List<Expression>? lengths
)

Implementation

static List<double?> expressionToPadding(List<css.Expression>? lengths) {
  double? left;
  double? right;
  double? top;
  double? bottom;
  if (lengths != null && lengths.isNotEmpty) {
    top = expressionToPaddingLength(lengths.first);
    if (lengths.length == 4) {
      right = expressionToPaddingLength(lengths[1]);
      bottom = expressionToPaddingLength(lengths[2]);
      left = expressionToPaddingLength(lengths.last);
    }
    if (lengths.length == 3) {
      left = expressionToPaddingLength(lengths[1]);
      right = expressionToPaddingLength(lengths[1]);
      bottom = expressionToPaddingLength(lengths.last);
    }
    if (lengths.length == 2) {
      bottom = expressionToPaddingLength(lengths.first);
      left = expressionToPaddingLength(lengths.last);
      right = expressionToPaddingLength(lengths.last);
    }
    if (lengths.length == 1) {
      bottom = expressionToPaddingLength(lengths.first);
      left = expressionToPaddingLength(lengths.first);
      right = expressionToPaddingLength(lengths.first);
    }
  }
  return [left, right, top, bottom];
}