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:widgets/ext/ex_widget.dart';
import 'package:widgets/my_load_image.dart';
import 'package:widgets/my_text_view.dart';

class LastNewsItem extends StatelessWidget {
  final Map<String, dynamic> lastNews;

  LastNewsItem({required this.lastNews});

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      mainAxisAlignment: MainAxisAlignment.start,
      children: [
        MyTextView(
          lastNews['category_name'],
          marginLeft: 9,
          marginTop: 9,
          fontSize: 14,
          isFontMedium: true,
          textColor: context.appColors.tabTextUnSelectedPrimary,
        ),
        const Spacer(),
        Row(
          mainAxisAlignment: MainAxisAlignment.end, // 对齐到右侧
          children: [
            Padding(
              padding: EdgeInsets.only(right: lastNews['margin_right']), // 控制边距
              child: MyAssetImage(
                lastNews['category_icon'],
                width: (lastNews['icon_width'] as num).toDouble(),
                height: (lastNews['icon_height'] as num).toDouble(),
                fit: BoxFit.cover, // 调整 fit 参数
              ),
            ),
          ],
        ),
      ],
      // ),
    )
        .decorated(
          color: context.appColors.whiteBG,
          borderRadius: BorderRadius.circular(5.0), // 5个圆角
          boxShadow: [
            BoxShadow(
              color: const Color(0xFF656565).withOpacity(0.1), // 阴影颜色，并且设置透明度
              offset: const Offset(0, 1.5), // 阴影的偏移量
              blurRadius: 2.5, // 模糊半径
              spreadRadius: 1.5, // 扩散半径
            ),
          ],
        )
        .marginOnly(right: 5)
        .constrained(width: 86.5, height: 78.5);
  }
}
