toWidget method

  1. @override
Widget toWidget(
  1. RenderContext context
)
override

Implementation

@override
Widget toWidget(RenderContext context) {
  texStr = parseMathRecursive(element, r'');
  return Container(
    width: context.parser.shrinkWrap ? null : MediaQuery.of(context.buildContext).size.width,
    child: Math.tex(
      texStr ?? '',
      mathStyle: MathStyle.display,
      textStyle: context.style.generateTextStyle(),
      onErrorFallback: (FlutterMathException e) {
        if (context.parser.onMathError != null) {
          return context.parser.onMathError!.call(texStr ?? '', e.message, e.messageWithType);
        } else {
          return Text(e.message);
        }
      },
    )
  );
}