setShorthandBackground static method

void setShorthandBackground(
  1. Map<String, String?> properties,
  2. String shorthandValue
)

Implementation

static void setShorthandBackground(Map<String, String?> properties, String shorthandValue) {
  List<String?>? values = _getBackgroundValues(shorthandValue);
  if (values == null) return;

  properties[BACKGROUND_COLOR] = values[0];
  properties[BACKGROUND_IMAGE] = values[1];
  properties[BACKGROUND_REPEAT] = values[2];
  properties[BACKGROUND_ATTACHMENT] = values[3];
  String? backgroundPosition = values[4];
  if (backgroundPosition != null) {
    List<String> positions = CSSPosition.parsePositionShorthand(backgroundPosition);
    properties[BACKGROUND_POSITION_X] = positions[0];
    properties[BACKGROUND_POSITION_Y] = positions[1];
  }
  properties[BACKGROUND_SIZE] = values[5];
}