visitElementAfterWithContext method

  1. @override
Widget? visitElementAfterWithContext(
  1. BuildContext context,
  2. Element element,
  3. TextStyle? preferredStyle,
  4. TextStyle? parentStyle,
)

Called when an Element has been reached, after its children have been visited.

If MarkdownWidget.styleSheet has a style with this tag, it will be passed as preferredStyle.

If parent element has TextStyle set, it will be passed as parentStyle.

If a widget build isn't needed, return null.

Implementation

@override
Widget? visitElementAfterWithContext(
  BuildContext context,
  md.Element element,
  TextStyle? preferredStyle,
  TextStyle? parentStyle,
) {
  final label = element.textContent.trim();
  if (label.isEmpty) return null;
  return _MarkdownInlineLink(
    label: label,
    href: element.attributes['href'],
    title: element.attributes['title'] ?? '',
    preferredStyle: preferredStyle,
    onTapLink: onTapLink,
  );
}