import 'package:cpt_form/modules/form/form_types.dart';
import 'package:cs_resources/generated/l10n.dart';
import 'package:cs_resources/theme/app_colors_theme.dart';
import 'package:domain/entity/form_list_entity.dart';
import 'package:flutter/material.dart';
import 'package:widgets/ext/ex_widget.dart';
import 'package:widgets/my_load_image.dart';
import 'package:widgets/my_text_view.dart';
import 'package:widgets/utils/dark_theme_util.dart';

///  设施的Active的Item
class FormApplyItem extends StatelessWidget {
  final int index;
  final FormListEntity item;

  const FormApplyItem({
    required this.index,
    required this.item,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      height: 80,
      margin: const EdgeInsets.only(left: 15, right: 15, top: 5, bottom: 5),
      padding: const EdgeInsets.symmetric(horizontal: 20),
      decoration: BoxDecoration(
        color: context.appColors.whiteBG,
        borderRadius: BorderRadius.circular(6.0), // 圆角
      ),
      child: Row(
        mainAxisSize: MainAxisSize.max,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          MyAssetImage(
            FormTypes.iconMap[item.typeId]?['icon_path'],
            width: FormTypes.iconMap[item.typeId]?['width'],
            height: FormTypes.iconMap[item.typeId]?['height'],
            color: DarkThemeUtil.multiColors(context, AppColorsTheme.colorPrimary, darkColor: Colors.white),
          ),
          MyTextView(
            FormTypes.iconMap[item.typeId]?['name'],
            marginLeft: 17,
            fontSize: 15,
            textColor: context.appColors.textBlack,
            isFontMedium: true,
          ).expanded(),
        ],
      ),
    );
  }
}
