build method

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

Optional CSS class (unused by default).

Implementation

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

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

  return Padding(
    padding: const EdgeInsets.symmetric(vertical: 8),
    child: Html(
      data: _htmlContent,
      style: {
        // Optionally apply styling based on tag types
        'h1': Style(fontSize: FontSize.xxLarge),
        'p': Style(fontSize: FontSize.medium),
        'hr': Style(margin: Margins.only(top: 12, bottom: 12)),
      },
    ),
  );
}