import 'package:cs_resources/generated/l10n.dart';
import 'package:cs_resources/theme/app_colors_theme.dart';
import 'package:domain/entity/payment_page_entity.dart';
import 'package:flutter/material.dart';
import 'package:widgets/ext/ex_widget.dart';
import 'package:widgets/my_text_view.dart';

/// Payment 的History的Item
class HistoryListItem extends StatelessWidget {
  final int index;
  final PaymentPageList item;

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

  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      margin: const EdgeInsets.only(left: 15, right: 15, top: 5, bottom: 5),
      padding: const EdgeInsets.only(left: 20, right: 15, top: 18, bottom: 23),
      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: [
          //标题
          MyTextView(
            item.title ?? "",
            fontSize: 16,
            maxLines: 3,
            textColor: context.appColors.textBlack,
            isFontMedium: true,
          ),

          //付款人
          MyTextView(
            S.current.booked_by_someone(item.account?.name ?? ""),
            fontSize: 14,
            marginTop: 3,
            textColor: context.appColors.textBlack,
            isFontRegular: true,
          ),

          //日期
          MyTextView(
            item.paidAt ?? "",
            fontSize: 14,
            marginTop: 16,
            marginBottom: 8,
            textColor: context.appColors.textBlack,
            isFontRegular: true,
          ),

          //标签
          Row(
            children: [
              MyTextView(
                "Fee Paid",
                textColor: context.appColors.textPrimary,
                fontSize: 13,
                isFontRegular: true,
                backgroundColor: context.appColors.lightBlueDarkBg,
                cornerRadius: 3,
                paddingLeft: 7,
                marginRight: 6,
                paddingRight: 7,
                paddingTop: 3,
                paddingBottom: 3,
              ),

              Visibility(
                  visible: item.refundStatus != 0,
                  child: MyTextView(
                    "Deposit Released",
                    textColor: context.appColors.textPrimary,
                    fontSize: 13,
                    isFontRegular: true,
                    backgroundColor: context.appColors.lightBlueDarkBg,
                    cornerRadius: 3,
                    paddingLeft: 7,
                    marginRight: 6,
                    paddingRight: 7,
                    paddingTop: 3,
                    paddingBottom: 3,
                  ))
            ],
          )
        ],
      ),
    );
  }
}
