import 'package:cs_resources/theme/app_colors_theme.dart';
import 'package:domain/entity/property_news_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';

///  首页新闻News 的Item
class ListNewsItem extends StatelessWidget {
  final int index;
  final PropertyNewsList item;

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

  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      height: 117.5,
      margin: const EdgeInsets.only(left: 15, right: 15, top: 5, bottom: 5),
      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,
        children: [
          MyLoadImage(
            item.coverImage ?? "",
            width: 100,
            height: 117.5,
          ).marginOnly(right: 18),
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              MyTextView(
                item.title ?? "",
                marginTop: 12,
                fontSize: 16,
                maxLines: 3,
                textColor: context.appColors.textBlack,
                isFontMedium: true,
              ).expanded(),
              MyTextView(
                item.createdAt ?? "",
                fontSize: 12,
                marginBottom: 12,
                marginTop: 12,
                textColor: context.appColors.textBlack,
                isFontRegular: true,
              ),
            ],
          ).expanded(),
        ],
      ),
    );
  }
}
