import 'package:cpt_main/modules/feedback/feedback_page.dart';
import 'package:cs_resources/theme/app_colors_theme.dart';
import 'package:domain/entity/home_list_entity.dart';
import 'package:flutter/material.dart';
import 'package:shared/utils/util.dart';
import 'package:widgets/ext/ex_widget.dart';
import 'package:widgets/my_load_image.dart';
import 'package:widgets/my_text_view.dart';

class LastTransItem extends StatelessWidget {
  HomeListLatestTransactions lastTrans;

  LastTransItem({required this.lastTrans});

  @override
  Widget build(BuildContext context) {
    return Row(
      mainAxisSize: MainAxisSize.max,
      crossAxisAlignment: CrossAxisAlignment.center,
      mainAxisAlignment: MainAxisAlignment.start,
      children: [
        Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            MyTextView(
              lastTrans.title ?? "",
              fontSize: 15,
              textColor: context.appColors.textBlack,
              isFontMedium: true,
            ),

            MyTextView(
              lastTrans.price ?? "",
              fontSize: 15,
              marginTop: 5,
              backgroundColor: context.appColors.lightBlueBg,
              cornerRadius: 6.5,
              paddingLeft: 12,
              paddingRight: 12,
              paddingTop: 3,
              paddingBottom: 3,
              textColor: context.appColors.textBlack,
              isFontMedium: true,
            ),
          ],
        ).expanded(),
        Container(
          margin: const EdgeInsets.only(left: 10),
          padding: const EdgeInsets.symmetric(horizontal: 5),
          height: 45,
          decoration: BoxDecoration(
            color: context.appColors.lightBlueDarkBg,
            borderRadius: BorderRadius.circular(5.0), // 5个圆角
          ),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              MyTextView(
                "\$${lastTrans.price ?? "-"}",
                fontSize: 17,
                textColor: context.appColors.textBlack,
                isFontMedium: true,
              ),
              //单元，每个月或者没有单元
              // Visibility(
              //     visible: Utils.isNotEmpty(lastTrans['unit']),
              //     child: MyTextView(
              //       lastTrans['unit'],
              //       fontSize: 12,
              //       textColor: context.appColors.textBlack,
              //       isFontRegular: true,
              //     ))
            ],
          ),
        ).constrained(minWidth: 92),
      ],
    );
  }
}
