onMarkup method

  1. @override
HypertextSpan onMarkup(
  1. List<HypertextSpan>? children,
  2. MarkupContext ctx
)
override

Implementation

@override
HypertextSpan onMarkup(List<HypertextSpan>? children, MarkupContext ctx) {
  final onLongPress = enableLongPress
      ? () => ctx.fireEvent(MarkupLongPressEvent.from(ctx))
      : null;
  final onTap = enableTap || onLongPress == null
      ? () => ctx.fireEvent(MarkupTapEvent.from(ctx))
      : null;

  Widget child = GestureDetector(
    onTap: onTap,
    onLongPress: onLongPress,
    child: Text.rich(HypertextTextSpan(children: children, style: style)),
  );
  if (tooltip != null) {
    child = Tooltip(message: tooltip, child: child);
  }
  if (cursor != null) {
    child = MouseRegion(cursor: cursor!, child: child);
  }

  final effectiveAlignment = alignment ?? PlaceholderAlignment.baseline;
  final effectiveBaseline =
      baseline ?? (alignment == null ? TextBaseline.alphabetic : null);

  return HypertextWidgetSpan(
    alignment: effectiveAlignment,
    baseline: effectiveBaseline,
    child: child,
  );
}