import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';

import '../../core/styles/my_dimensions.dart';

class IPMHtml extends StatelessWidget {
  final String data;
  final String? checkTxt;
  const IPMHtml(this.data, this.checkTxt, {Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Html(
      data: data,
      style: {
        "p, li, *": Style(
          fontFamily: 'Prompt-Regular',
          padding: EdgeInsets.only(top: 4, right: 0, left: 0, bottom: 4),
          fontSize: FontSize(MyDimens.dimen16, units: 'px'),
          fontWeight:
              this.checkTxt == "big" ? FontWeight.w700 : FontWeight.w500,
          letterSpacing: 0.7,
          color: const Color(0xFF121212),
        ),
      },
      customRender: {
        "table": (context, child) {
          return SingleChildScrollView(
            scrollDirection: Axis.horizontal,
            child: (context.tree as TableLayoutElement).toWidget(context),
          );
        }
      },
    );
  }
}
