import 'package:cpt_main/modules/feedback/feedback_page.dart';
import 'package:cs_resources/theme/app_colors_theme.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 {
  final Map<String, dynamic> 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,
              textColor: context.appColors.textBlack,
              isFontMedium: true,
            ),
          ],
        ).expanded(),

        Container(
          width: 91.5,
          margin: const EdgeInsets.only(left: 10),
          height: 45,
          decoration: BoxDecoration(
            color: context.appColors.lightPurpleBg,
            borderRadius: BorderRadius.circular(5.0), // 5个圆角
          ),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              MyTextView(
               "\$${lastTrans['total']}",
                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,
                  ))
            ],
          ),
        ),
      ],
    );
  }
}
