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_load_image.dart';
import 'package:widgets/my_text_view.dart';
import 'package:widgets/utils/dark_theme_util.dart';

import 'payment_list_types.dart';

/// Condo Active 的 Item 布局
class PaymentListItem extends StatelessWidget {
  final int index;
  final PaymentPageList item;

  const PaymentListItem({
    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), // 圆角
        boxShadow: [
          BoxShadow(
            color: context.appColors.itemBGShadow, // 阴影颜色
            offset: const Offset(0, 3), // 阴影的偏移量
            blurRadius: 8.0, // 模糊半径
            spreadRadius: 3.0, // 扩散半径
          ),
        ],
      ),
      child: Row(
        mainAxisSize: MainAxisSize.max,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          MyAssetImage(
            PaymentListTypes.iconMap[item.type]?['icon_path'],
            width: PaymentListTypes.iconMap[item.type]?['width'],
            height: PaymentListTypes.iconMap[item.type]?['height'],
            color: DarkThemeUtil.multiColors(context, AppColorsTheme.colorPrimary,darkColor: Colors.white),
          ),

          MyTextView(
            PaymentListTypes.iconMap[item.type]?['name'],
            marginLeft: 17,
            fontSize: 16,
            textColor: context.appColors.textBlack,
            isFontMedium: true,
          ).expanded(),
        ],
      ),
    );
  }
}
