build method

  1. @override
Widget build(
  1. BuildContext context,
  2. String text,
  3. TextStyle? style,
  4. TextDirection textDirection,
  5. void onLinkTab(
    1. String url,
    2. String title
    )?,
)
override

Implementation

@override
Widget build(
  BuildContext context,
  String text,
  TextStyle? style,
  TextDirection textDirection,
  final void Function(String url, String title)? onLinkTab,
) {
  var match = exp.firstMatch(text.trim());
  return Text.rich(
    TextSpan(
      children: [
        WidgetSpan(
          child: TexText(
            "${match?[2]}",
            textDirection: textDirection,
            style: [
              Theme.of(context)
                  .textTheme
                  .headlineLarge
                  ?.copyWith(color: style?.color),
              Theme.of(context)
                  .textTheme
                  .headlineMedium
                  ?.copyWith(color: style?.color),
              Theme.of(context)
                  .textTheme
                  .headlineSmall
                  ?.copyWith(color: style?.color),
              Theme.of(context)
                  .textTheme
                  .titleLarge
                  ?.copyWith(color: style?.color),
              Theme.of(context)
                  .textTheme
                  .titleMedium
                  ?.copyWith(color: style?.color),
              Theme.of(context)
                  .textTheme
                  .titleSmall
                  ?.copyWith(color: style?.color),
            ][match![1]!.length - 1],
            // textDirection: textDirection,
          ),
        ),
        if (match[1]!.length == 1) ...[
          const TextSpan(
            text: "\n ",
            style: TextStyle(fontSize: 0, height: 0),
          ),
          WidgetSpan(
            child: CustomDivider(
              height: 2,
              color: style?.color ?? Theme.of(context).colorScheme.outline,
            ),
          ),
        ],
      ],
    ),
    textDirection: textDirection,
  );
}