ugc_item.dart 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. import 'package:eye_video/bizmodule/bizwidget/follow_list_head.dart';
  2. import 'package:eye_video/bizmodule/main/community/extension/ext_community.dart';
  3. import 'package:eye_video/bizmodule/main/community/model/community_model.dart';
  4. import 'package:eye_video/framework/extension/screen_ruler.dart';
  5. import 'package:eye_video/framework/uikit/layout/nine_layout.dart';
  6. import 'package:flutter/material.dart';
  7. import 'package:eye_video/framework/extension/image_compress.dart';
  8. class UgcFollowItem extends StatelessWidget {
  9. final HeaderData header;
  10. final CommunityData content;
  11. const UgcFollowItem({Key key, this.header, this.content}) : super(key: key);
  12. @override
  13. Widget build(BuildContext context) {
  14. List<Widget> children = [];
  15. var headerItem = FollowListHead(
  16. title: header.issuerName,
  17. avatarUrl: header.icon.compress_value(),
  18. description: "${prettyTime(content.releaseTime)}发布",
  19. );
  20. children.add(headerItem);
  21. if (content.description != null && content.description.isNotEmpty) {
  22. var contentItem = Padding(
  23. padding: EdgeInsets.only(left: 16),
  24. child: Text(
  25. content.description,
  26. style: TextStyle(
  27. fontSize: 15,
  28. fontFamily: 'NotoSansHans-Regular',
  29. color: Color(0xff333333),
  30. ),
  31. ),
  32. );
  33. children.add(contentItem);
  34. }
  35. if (content.urls != null || content.urls.isNotEmpty) {
  36. var nineImages = Padding(
  37. padding: EdgeInsets.only(left: 8, top: 10, bottom: 10),
  38. child: NineLayout(
  39. width: MediaQuery.of(context).size.width - 34,
  40. children: content.urls.map((url) {
  41. return Container(
  42. decoration: ShapeDecoration(
  43. image: DecorationImage(
  44. image: NetworkImage(url.compress_value()),
  45. fit: BoxFit.cover,
  46. ),
  47. shape: RoundedRectangleBorder(
  48. borderRadius: BorderRadius.circular(5),
  49. ),
  50. ));
  51. }).toList(),
  52. count: content.urls.length,
  53. gap: 1,
  54. ),
  55. );
  56. children.add(nineImages);
  57. }
  58. if (content.tags != null && content.tags.isNotEmpty) {
  59. var tagItems = Container(
  60. padding: EdgeInsets.only(left: 10, top: 10),
  61. child: Wrap(
  62. children: content.tags
  63. .map((tag) => Container(
  64. decoration: BoxDecoration(
  65. color: Color(0xfff0f0f0),
  66. borderRadius: BorderRadius.all(Radius.circular(15)),
  67. ),
  68. padding:
  69. EdgeInsets.only(top: 2, bottom: 2, left: 10, right: 10),
  70. child: Text(
  71. tag.name,
  72. style: TextStyle(
  73. color: Colors.blue,
  74. fontSize: 12,
  75. ),
  76. ),
  77. ))
  78. .toList(),
  79. ),
  80. );
  81. children.add(tagItems);
  82. }
  83. if (content.consumption != null) {
  84. var consumptionItem = Padding(
  85. padding: EdgeInsets.only(top: 10, left: 15),
  86. child: Row(
  87. children: [
  88. Row(
  89. mainAxisAlignment: MainAxisAlignment.start,
  90. children: [
  91. Image.asset(
  92. 'assets/images/biz_app_icon_collection.png',
  93. width: 20,
  94. height: 20,
  95. ),
  96. Padding(
  97. padding: EdgeInsets.only(left: 3),
  98. child: Text("${content.consumption.realCollectionCount}"),
  99. ),
  100. ],
  101. ),
  102. Padding(
  103. padding: EdgeInsets.only(left: 30),
  104. child: Row(
  105. mainAxisAlignment: MainAxisAlignment.start,
  106. children: [
  107. Image.asset(
  108. 'assets/images/biz_app_icon_reply.png',
  109. width: 20,
  110. height: 20,
  111. ),
  112. Padding(
  113. padding: EdgeInsets.only(left: 3),
  114. child: Text("${content.consumption.replyCount}"),
  115. ),
  116. ],
  117. ),
  118. ),
  119. Padding(
  120. padding: EdgeInsets.only(left: 30),
  121. child: Row(
  122. mainAxisAlignment: MainAxisAlignment.start,
  123. children: [
  124. Image.asset(
  125. 'assets/images/biz_app_icon_share.png',
  126. width: 20,
  127. height: 20,
  128. ),
  129. Padding(
  130. padding: EdgeInsets.only(left: 3),
  131. child: Text("${content.consumption.shareCount}"),
  132. ),
  133. ],
  134. ),
  135. )
  136. ],
  137. ),
  138. );
  139. children.add(consumptionItem);
  140. }
  141. return Container(
  142. padding: EdgeInsets.all(10),
  143. child: Column(
  144. mainAxisAlignment: MainAxisAlignment.start,
  145. crossAxisAlignment: CrossAxisAlignment.start,
  146. children: children,
  147. ),
  148. );
  149. }
  150. }