build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Optional CSS class name from Form.io (ignored in this implementation).

Implementation

// String? get _cssClass => component.raw['className'];

@override
Widget build(BuildContext context) {
  if (_content.trim().isEmpty) {
    return const SizedBox.shrink();
  }

  return Padding(
    padding: const EdgeInsets.symmetric(vertical: 8),
    child: Html(
      data: _content,
      style: {'p': Style(fontSize: FontSize.medium), 'h2': Style(fontSize: FontSize.larger, fontWeight: FontWeight.w600)},
      onLinkTap: (url, _, __) {
        if (enableLinks && url != null) {
          launchUrl(Uri.parse(url));
        }
      },
    ),
  );
}