build method

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

Implementation

@override
Widget build(
  BuildContext context,
  String text,
  TextStyle? style,
  final void Function(String url, String title)? onLinkTab,
) {
  var match = exp.firstMatch(text.trim());
  return Text.rich(TextSpan(
    children: [
      WidgetSpan(
        child: TexText("${match?[2]}",
            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]),
      ),
      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,
          ),
        ),
      ],
    ],
  ));
}