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: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';

///  Condo的Manage的Item
class ManageItem extends StatelessWidget {
  final int index;
  final bool item;
  final VoidCallback deleteAction;

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

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: const EdgeInsets.only(top: 1),
      color: context.appColors.whiteBG,
      width: double.infinity,
      padding: const EdgeInsets.only(left: 20, right: 23, top: 20, bottom: 20),
      child: Row(
        mainAxisSize: MainAxisSize.max,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          //选中
          MyAssetImage(
            item ? Assets.baseServiceRadioChecked : Assets.baseServiceRadioUncheck,
            color: DarkThemeUtil.multiColors(context, AppColorsTheme.colorPrimary, darkColor: Colors.white),
            width: 25,
            height: 25,
          ),

          const MyAssetImage(
            Assets.facilityAddCardMaster,
            height: 38,
          ).marginOnly(left: 9, right: 9),

          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              MyTextView(
                "Wu Bing Bing's Card",
                textColor: context.appColors.textBlack,
                fontSize: 13.5,
                isFontRegular: true,
              ),
              MyTextView(
                "Ending 9423",
                textColor: context.appColors.textBlack,
                fontSize: 13.5,
                isFontRegular: true,
              ),
              MyTextView(
                item ? S.current.primary_card : S.current.set_primary_card,
                textColor: context.appColors.textPrimary,
                fontSize: 12,
                marginTop: 3,
                fontWeight: FontWeight.w600,
              ),
            ],
          ).expanded(),

          MyTextView(
            S.current.delete,
            textColor: Colors.white,
            backgroundColor: context.appColors.orangeBG,
            cornerRadius: 7,
            marginLeft: 9,
            paddingTop: 9,
            onClick: deleteAction,
            marginTop: 15,
            paddingBottom: 9,
            textAlign: TextAlign.center,
            boxWidth: 60,
          )
        ],
      ),
    );
  }
}
