import 'package:cs_resources/generated/assets.dart';
import 'package:cs_resources/generated/l10n.dart';
import 'package:cs_resources/theme/app_colors_theme.dart';
import 'package:domain/entity/feedback_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';

class FeedbackItem extends StatelessWidget {
  final int index;
  final FeedbackItemEntity item;

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

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: const EdgeInsets.only(left: 15, right: 15, top: 5, bottom: 5),
      padding: const EdgeInsets.symmetric(vertical: 19, horizontal: 18.5),
      decoration: BoxDecoration(
        color: context.appColors.whiteBG,
        borderRadius: BorderRadius.circular(6.0), // 圆角
        boxShadow: [
          BoxShadow(
            color: context.appColors.itemBGShadow, // 阴影颜色
            offset: const Offset(0, 3), // 阴影的偏移量
            blurRadius: 8.0, // 模糊半径
            spreadRadius: 3.0, // 扩散半径
          ),
        ],
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            children: [
               MyAssetImage(
                Assets.mainFeedbackItemIcon,
                width: 42.5,
                height: 44,
                color: DarkThemeUtil.multiColors(context, AppColorsTheme.colorPrimary, darkColor: Colors.white),
              ),
              Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  MyTextView(
                    item.title ?? "",
                    fontSize: 16,
                    textColor: context.appColors.textBlack,
                    isFontMedium: true,
                  ),
                  MyTextView(
                    item.content ?? "",
                    fontSize: 14,
                    maxLines: 2,
                    marginTop: 5,
                    textColor: context.appColors.textBlack,
                    isFontRegular: true,
                  ),
                ],
              ).marginOnly(left: 11).expanded(),
            ],
          ),

          //备注
          MyTextView(
            "${item.createdAt}  |  ${item.category?.name ?? ""}  |  ${item.status == 1 ? S.current.in_progress : S.current.replied}",
            fontSize: 12,
            marginTop: 10,
            textColor: context.appColors.textDarkGray,
            isFontRegular: true,
          ),
        ],
      ),
    );
  }
}
