appendStyle method

void appendStyle(
  1. Object? style1, [
  2. Object? style2,
  3. Object? style3
])
inherited

Implementation

void appendStyle(Object? style1, [Object? style2, Object? style3]) {
  List<String> allStyles;

  if (style1 != null) {
    var styles1 = parseStyle(style1);
    if (style2 != null) {
      var styles2 = parseStyle(style2);
      if (style3 != null) {
        var styles3 = parseStyle(style3);
        allStyles = [...styles1, ...styles2, ...styles3];
      } else {
        allStyles = [...styles1, ...styles2];
      }
    } else {
      allStyles = styles1;
    }
  } else if (style2 != null) {
    var styles2 = parseStyle(style2);
    if (style3 != null) {
      var styles3 = parseStyle(style3);
      allStyles = [...styles2, ...styles3];
    } else {
      allStyles = styles2;
    }
  } else if (style3 != null) {
    allStyles = parseStyle(style3);
  } else {
    return;
  }

  if (allStyles.isNotEmpty) {
    var allStylesLine = allStyles.join('; ');

    final content = this.content!;

    var cssText = content.style.cssText ?? '';
    if (cssText == '') {
      cssText = allStylesLine;
    } else {
      cssText += allStylesLine;
    }

    content.style.cssText = cssText;
  }
}