import 'package:flutter/material.dart';

import '../../../../../core/i18n/translations.g.dart';
import '../../../../../core/styles/my_dimensions.dart';
import '../../../../../domain/entities/product/product_data.dart';
import '../../../../widgets/ipm_html.dart';
import '../../../../widgets/ipm_title_text.dart';

class ProductContractForm extends StatelessWidget {
  final ProductData data;

  const ProductContractForm(this.data, {Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    late final String name;

    if (data.contractType == null || data.contractType!.isEmpty) {
      return Container();
    }

    if (data.contractType != null && data.contractType!.length > 0) {
      name = data.contractType!
          .substring(0, data.contractType!.length - 1)
          .toString();
    }

    return Container(
      padding: EdgeInsets.only(
        top: MyDimens.dimen10,
        left: MyDimens.dimen16,
        right: MyDimens.dimen16,
        bottom: MyDimens.dimen16,
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          IPMTitleText(
            title1: AppLocalizations.products.contract_form,
          ),
          IPMHtml(name, ''),
        ],
      ),
    );
  }
}
