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

import '../../../app.dart';

class ProductAboutWidget extends StatelessWidget {
  final ProductModel model;

  ProductAboutWidget({required this.model});
  @override
  Widget build(BuildContext context) {
    final shortDesc = model.shortDescription ?? '';
    final desc = model.description ?? '';
    final data = shortDesc + ' ' + desc;

    return SingleChildScrollView(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Padding(
            padding: EdgeInsets.symmetric(vertical: 8.h),
            child: Html(
              shrinkWrap: true,
              data: data,
              // customRender: {
              //   'table': (context, child) {
              //     return SingleChildScrollView(
              //       scrollDirection: Axis.horizontal,
              //       child: (context.tree as TableLayoutElement).toWidget(context),
              //     );
              //   },
              // },
              style: {
                // tables will have the below background color
                'table': Style(
                  backgroundColor: Colors.white,
                ),
                // some other granular customizations are also possible
                'tr': Style(
                  border: Border(bottom: BorderSide(color: ThemeColor.colorE5E5E5)),
                ),
                'th': Style(padding: HtmlPaddings.symmetric(vertical: 6)
                    // EdgeInsets.symmetric(vertical: 6),
                    ),
                'td': Style(
                  padding: HtmlPaddings.symmetric(
                    vertical: 16,
                    horizontal: 8,
                  ), //EdgeInsets.symmetric(vertical: 16, horizontal: 8),
                  // alignment: Alignment.topLeft,
                  width: Width(0.45.sw), // 0.45.sw,
                ),
              },
            ),
          ),
          SizedBox(height: 48.h)
        ],
      ),
    );
  }
}
