import 'package:cs_resources/constants/color_constants.dart';
import 'package:cs_resources/generated/assets.dart';
import 'package:domain/entity/home_module.dart';
import 'package:domain/entity/response/labour_request_list_entity.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:widgets/ext/ex_widget.dart';
import 'package:widgets/my_load_image.dart';
import 'package:widgets/my_text_view.dart';

/*
 * Item布局
 */
class AgencyCategoryItem extends StatelessWidget {
  final HomeModule item;
  final VoidCallback? onClickAction;

  AgencyCategoryItem({
    required this.item,
    this.onClickAction,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 15),
      margin: const EdgeInsets.only(left: 15, right: 15, top: 5, bottom: 5),
      decoration: BoxDecoration(
        color: const Color(0xFF4DCFF6).withOpacity(0.2), // 设置背景颜色和不透明度
        borderRadius: BorderRadius.circular(5), // 设置圆角
      ),
      child: Row(
        children: [
          //图标
          MyAssetImage(
            item.moduleIconPath,
            width: item.iconWidth,
            height: item.iconHeight,
          ),

          //名称
          MyTextView(
            item.moduleName,
            isFontRegular: true,
            marginLeft: 10,
            textColor: ColorConstants.textGrayAECAE5,
            fontSize: 14,
          ),

          const Spacer(),

          //箭头
          const MyAssetImage(
            Assets.mainItemMoreIcon,
            width: 7.5,
            height: 13.5,
          ),
        ],
      ),
    ).onTap(() {
      onClickAction?.call();
    });
  }
}
