import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:get/get_core/src/get_main.dart';

import '../../../../models/entities/NewsInformationModel.dart';

import 'package:intl/intl.dart';
import '../../../ArticleInfo/ArticleInfo.dart';

class Information extends StatefulWidget {
  final NewsInformationModel item;
  const Information({Key? key, required this.item}) : super(key: key);

  @override
  State<Information> createState() => _InformationState(item);
  // getNewsList
}

class _InformationState extends State<Information> {
  final NewsInformationModel item;


  _InformationState(this.item);


  @override
  Widget build(BuildContext context) {
    return Container(
      child:   Column(
        children: [
          // ListTile用不好
          GestureDetector(
            child: Container(
                padding: EdgeInsets.fromLTRB(0, 30, 0, 30),
                decoration: const BoxDecoration(
                    border: Border(
                        bottom: BorderSide(width: 0.5, color: Color(0x20000000)
                          // 0x17000000
                        ))),
                child: Row(
                  children: [
                    Container(
                      margin: EdgeInsets.fromLTRB(15, 0, 11, 0),
                      width: 100,
                      height: 100,
                      decoration: BoxDecoration(
                        image: DecorationImage(
                          image: NetworkImage(item.thumb.toString()),
                          fit: BoxFit.cover,
                        ),
                        borderRadius: BorderRadius.circular(12),
                      ),
                    ),
                    Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Container(
                          width: 240.w,
                          padding: EdgeInsets.fromLTRB(0, 0, 0, 30),
                          child: Text(item.title!.toString(),
                              softWrap: true,
                              maxLines: 2,
                              textAlign: TextAlign.left,
                              overflow: TextOverflow.ellipsis,
                              style: TextStyle(
                                fontSize: 17.sp,
                                fontWeight: FontWeight.bold,
                              )),
                        ),
                        Container(
                          child: Text(
                              item.createDate!=null? DateFormat("yyyy-MM-dd").format(DateTime.parse(item.createDate.toString())):item.createDate.toString(),),
                        )
                      ],
                    )
                  ],
                )),
            onTap: () {
              Get.to(ArticleInfo(),arguments: {'newsId':item.newsId});
            },
          ),
        ],
      ),
    );


  }
}
