build method

  1. @override
Widget build(
  1. BuildContext context,
  2. String text,
  3. GptMarkdownConfig config
)
override

Implementation

@override
Widget build(
  BuildContext context,
  String text,
  final GptMarkdownConfig config,
) {
  String codes = exp.firstMatch(text)?[2] ?? "";
  String name = exp.firstMatch(text)?[1] ?? "";
  codes = codes.replaceAll(r"```", "").trim();
  return Padding(
    padding: const EdgeInsets.all(16.0),
    child: config.codeBuilder != null
        ? config.codeBuilder?.call(context, name, codes)
        : CodeField(name: name, codes: codes),
  );
}