import 'package:cs_resources/constants/color_constants.dart';
import 'package:cs_resources/generated/assets.dart';
import 'package:domain/entity/home_module.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';

class ReportListItem extends StatelessWidget {
  final HomeModule item;
  final VoidCallback onTap;

  ReportListItem(this.item, this.onTap);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: Container(
        margin: const EdgeInsets.only(top: 5, bottom: 5),
        padding: const EdgeInsets.only(left: 15, right: 16.5, top: 8, bottom: 8),
        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,
              textColor: ColorConstants.textGrayAECAE5,
              isTextEllipsis: true,
              maxLines: 2,
              isFontMedium: true,
              margin: 20,
              fontSize: 14,
            ).expanded(),

            const MyAssetImage(
              Assets.mainItemMoreIcon,
              width: 7.5,
              height: 13.5,
            ),
          ],
        ),
      ),
    );
  }
}
