Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions lib/src/interactable_element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,30 @@ enum Gesture {
TAP,
}

InteractableElement parseInteractableElement(
StyledElement parseInteractableElement(
dom.Element element, List<StyledElement> children) {
switch (element.localName) {
case "a":
return InteractableElement(
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,
href: element.attributes['href'],
style: Style(
color: Colors.blue,
textDecoration: TextDecoration.underline,
),
style: Style(),
node: element,
elementId: element.id
elementId: element.id,
);
/// will never be called, just to suppress missing return warning
default:
Expand All @@ -48,4 +58,4 @@ InteractableElement parseInteractableElement(
elementId: "[[No ID]]"
);
}
}
}