span method

  1. @override
InlineSpan span(
  1. BuildContext context,
  2. String text,
  3. GptMarkdownConfig config
)
override

Implementation

@override
InlineSpan span(
  BuildContext context,
  String text,
  final GptMarkdownConfig config,
) {
  var match = exp.firstMatch(text.trim());
  var conf = config.copyWith(
    style: config.style?.copyWith(
          fontWeight: FontWeight.bold,
          background: Paint()
            ..color = Theme.of(context).colorScheme.onInverseSurface
            ..strokeCap = StrokeCap.round
            ..strokeJoin = StrokeJoin.round,
        ) ??
        TextStyle(
          fontWeight: FontWeight.bold,
          background: Paint()
            ..color = Theme.of(context).colorScheme.surfaceContainerHighest
            ..strokeCap = StrokeCap.round
            ..strokeJoin = StrokeJoin.round,
        ),
  );
  return TextSpan(
    text: match?[1],
    style: conf.style,
  );
}