parseInteractableElement function

StyledElement parseInteractableElement(
  1. Element element,
  2. List<StyledElement> children
)

Implementation

StyledElement parseInteractableElement(
  dom.Element element,
  List<StyledElement> children,
) {
  switch (element.localName) {
    case "a":
      if (element.attributes.containsKey('href')) {
        return InteractableElement(
          name: element.localName!,
          children: children,
          href: element.attributes['href'],
          style: Style(
            color: Colors.blue,
            textDecoration: TextDecoration.underline,
          ),
          node: element,
          elementId: element.id,
        );
      }
      // When <a> tag have no href, it must be non clickable and without decoration.
      return StyledElement(
        name: element.localName!,
        children: children,
        style: Style(),
        node: element,
        elementId: element.id,
      );

    /// will never be called, just to suppress missing return warning
    default:
      return InteractableElement(
        name: element.localName!,
        children: children,
        node: element,
        href: '',
        style: Style(),
        elementId: "[[No ID]]",
      );
  }
}