index.dart 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. import 'package:get/get.dart';
  4. import 'package:get/get_core/src/get_main.dart';
  5. import '../../../../models/entities/NewsInformationModel.dart';
  6. import 'package:intl/intl.dart';
  7. import '../../../ArticleInfo/ArticleInfo.dart';
  8. class Information extends StatefulWidget {
  9. final NewsInformationModel item;
  10. const Information({Key? key, required this.item}) : super(key: key);
  11. @override
  12. State<Information> createState() => _InformationState(item);
  13. // getNewsList
  14. }
  15. class _InformationState extends State<Information> {
  16. final NewsInformationModel item;
  17. _InformationState(this.item);
  18. @override
  19. Widget build(BuildContext context) {
  20. return Container(
  21. child: Column(
  22. children: [
  23. // ListTile用不好
  24. GestureDetector(
  25. child: Container(
  26. padding: EdgeInsets.fromLTRB(0, 30, 0, 30),
  27. decoration: const BoxDecoration(
  28. border: Border(
  29. bottom: BorderSide(width: 0.5, color: Color(0x20000000)
  30. // 0x17000000
  31. ))),
  32. child: Row(
  33. children: [
  34. Container(
  35. margin: EdgeInsets.fromLTRB(15, 0, 11, 0),
  36. width: 100,
  37. height: 100,
  38. decoration: BoxDecoration(
  39. image: DecorationImage(
  40. image: NetworkImage(item.thumb.toString()),
  41. fit: BoxFit.cover,
  42. ),
  43. borderRadius: BorderRadius.circular(12),
  44. ),
  45. ),
  46. Column(
  47. crossAxisAlignment: CrossAxisAlignment.start,
  48. children: [
  49. Container(
  50. width: 240.w,
  51. padding: EdgeInsets.fromLTRB(0, 0, 0, 30),
  52. child: Text(item.title!.toString(),
  53. softWrap: true,
  54. maxLines: 2,
  55. textAlign: TextAlign.left,
  56. overflow: TextOverflow.ellipsis,
  57. style: TextStyle(
  58. fontSize: 17.sp,
  59. fontWeight: FontWeight.bold,
  60. )),
  61. ),
  62. Container(
  63. child: Text(
  64. item.createDate!=null? DateFormat("yyyy-MM-dd").format(DateTime.parse(item.createDate.toString())):item.createDate.toString(),),
  65. )
  66. ],
  67. )
  68. ],
  69. )),
  70. onTap: () {
  71. Get.to(ArticleInfo(),arguments: {'newsId':item.newsId});
  72. },
  73. ),
  74. ],
  75. ),
  76. );
  77. }
  78. }