textDecoration property

TextDecoration textDecoration

Searches the path to the root for the first occurance of a node with a text-decoration information. Returns TextDecoration.none if no information is present

Implementation

TextDecoration get textDecoration {
  NodeV2? k = this;

  while (k != null) {
    if (k.tagName == "u") return TextDecoration.underline;

    if (k.styleProperty != null) {
      StyleProperty prop = k.styleProperty!;

      dynamic weight = prop.getProperty("text-decoration");

      switch (weight) {
        case "underline":
          return TextDecoration.underline;

        case "line-through":
          return TextDecoration.lineThrough;

        case "overline":
          return TextDecoration.overline;
      }
    }

    k = k.parent;
  }

  return TextDecoration.none;
}