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());
  if (match?[1] == null) {
    return const TextSpan();
  }
  return WidgetSpan(
    alignment: PlaceholderAlignment.middle,
    // baseline: TextBaseline.alphabetic,
    child: Padding(
      padding: const EdgeInsets.all(2),
      child: SizedBox(
        width: 20,
        height: 20,
        child: Material(
          color: Theme.of(context).colorScheme.onInverseSurface,
          shape: const OvalBorder(),
          child: FittedBox(
            fit: BoxFit.scaleDown,
            child: Text(
              "${match?[1]}",
              // style: (style ?? const TextStyle()).copyWith(),
              textDirection: config.textDirection,
            ),
          ),
        ),
      ),
    ),
  );
}