item_notification.dart 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. import 'package:cs_resources/generated/assets.dart';
  2. import 'package:cs_resources/theme/app_colors_theme.dart';
  3. import 'package:domain/entity/notification_page_entity.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:widgets/ext/ex_widget.dart';
  6. import 'package:widgets/my_load_image.dart';
  7. import 'package:widgets/my_text_view.dart';
  8. import 'package:widgets/utils/dark_theme_util.dart';
  9. class NotificationItem extends StatelessWidget {
  10. final NotificationPageList item;
  11. final int index;
  12. const NotificationItem({
  13. required this.item,
  14. required this.index,
  15. });
  16. @override
  17. Widget build(BuildContext context) {
  18. return Container(
  19. width: double.infinity,
  20. color: context.appColors.whiteBG,
  21. padding: const EdgeInsets.only(left: 11, right: 15, top: 10.5),
  22. child: Column(
  23. crossAxisAlignment: CrossAxisAlignment.start,
  24. children: [
  25. Row(
  26. crossAxisAlignment: CrossAxisAlignment.start,
  27. children: [
  28. const MyAssetImage(
  29. Assets.mainNotificationItemIcon,
  30. width: 42.5,
  31. height: 42.5,
  32. ).marginOnly(right: 16),
  33. Column(
  34. children: [
  35. //标题
  36. Row(
  37. crossAxisAlignment: CrossAxisAlignment.center,
  38. children: [
  39. //未读的小圆点
  40. Visibility(
  41. visible: !item.read,
  42. child: Container(
  43. width: 6,
  44. height: 6,
  45. margin: const EdgeInsets.only(right: 8.5),
  46. decoration: BoxDecoration(
  47. shape: BoxShape.circle,
  48. color: context.appColors.tabBgSelectedPrimary,
  49. ),
  50. ),),
  51. //消息标题
  52. MyTextView(
  53. item.title??"",
  54. fontSize: 16,
  55. isFontBold: true,
  56. textColor: context.appColors.textBlack,
  57. maxLines: 2,
  58. ).expanded(),
  59. //消息时间
  60. MyTextView(
  61. item.createdAt!.split(" at ")[1],
  62. fontSize: 13,
  63. marginLeft: 10,
  64. isFontRegular: true,
  65. textColor: context.appColors.textLightPurple,
  66. ),
  67. ],
  68. ),
  69. //内容
  70. Row(
  71. children: [
  72. //文本内容
  73. MyTextView(
  74. item.body??"",
  75. fontSize: 15,
  76. marginRight: 15,
  77. isFontRegular: true,
  78. textColor: context.appColors.textBlack,
  79. ).expanded(),
  80. // //图片
  81. // MyLoadImage(
  82. // "https://img1.baidu.com/it/u=1656098746,3560654086&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=800",
  83. // width: 87.5,
  84. // height: 60.5,
  85. // ),
  86. ],
  87. ).marginOnly(top: 9),
  88. ],
  89. ).expanded(),
  90. ],
  91. ),
  92. const SizedBox(height: 17.5),
  93. Divider(
  94. height: 0.5,
  95. color: context.appColors.backgroundDark,
  96. ),
  97. ],
  98. ),
  99. );
  100. }
  101. }