onMarkup method

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

Implementation

@override
HypertextSpan onMarkup(List<HypertextSpan>? children, MarkupContext ctx) {
  final color = optColor(ctx, enableTagAttr: false);
  final bgColor = optBgColor(ctx, enableTagAttr: false);
  final size = optFontSize(ctx, enableTagAttr: false);
  final font = optFontFamily(ctx, enableTagAttr: false);
  final fontWeight = optFontWeight(ctx, enableTagAttr: false);
  final fontStyle = optFontStyle(ctx, enableTagAttr: false);
  final decor = optTextDecoration(
    ctx,
    attrPrefix: 'decor-',
    enableTagAttr: false,
  );

  TextStyle? style;
  if (color != null ||
      bgColor != null ||
      size != null ||
      font != null ||
      fontWeight != null ||
      fontStyle != null ||
      decor != null) {
    style = TextStyle(
      color: color,
      fontSize: size,
      fontFamily: font,
      fontWeight: fontWeight,
      fontStyle: fontStyle,
      backgroundColor: bgColor,
      decoration: decor?.decoration,
      decorationColor: decor?.color,
      decorationStyle: decor?.style,
      decorationThickness: decor?.thickness,
    );
  }

  return HypertextTextSpan(children: children, style: style);
}