newsfeed_card_footer.dart 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. import 'package:cpt_community/components/newfeed_card_header.dart';
  2. import 'package:cs_resources/generated/assets.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:flutter/widgets.dart';
  5. import 'package:shared/utils/color_utils.dart';
  6. import 'package:shared/utils/log_utils.dart';
  7. import 'package:widgets/ext/ex_widget.dart';
  8. import 'package:widgets/my_load_image.dart';
  9. import 'package:widgets/my_text_view.dart';
  10. import 'package:widgets/my_like_button.dart';
  11. import '../modules/community/community_page.dart';
  12. // 'id':1,
  13. // 'avator': Assets.communityCamera,
  14. // 'title': 'William Jefferson',
  15. // 'isFollow': false,
  16. // 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
  17. // 'imageUrls': ['https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500','https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500','https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500'],
  18. // 'time': 'June 17,2016 at 7:23 p.m.',
  19. // 'likeno': 12
  20. class NewsFeedCardFooter extends StatelessWidget {
  21. final bool isLike;
  22. final VoidCallback? onLike;
  23. final VoidCallback? onComment;
  24. final VoidCallback? onShare;
  25. final bool showShare;
  26. final GlobalKey<MyLikeButtonState> likeButtonKey;
  27. NewsFeedCardFooter({
  28. Key? key,
  29. GlobalKey<MyLikeButtonState>? likeButtonKey,
  30. required this.isLike,
  31. this.onLike,
  32. this.onComment,
  33. this.onShare,
  34. this.showShare = false,
  35. })
  36. : likeButtonKey = likeButtonKey ?? GlobalKey<MyLikeButtonState>(),
  37. super(key: key);
  38. @override
  39. Widget build(BuildContext context) {
  40. return Container(
  41. height: 40,
  42. width: double.infinity,
  43. // padding: const EdgeInsets.symmetric(horizontal: 16),
  44. child: Row(
  45. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  46. crossAxisAlignment: CrossAxisAlignment.center,
  47. children: [
  48. Expanded(
  49. child: Container(
  50. padding: const EdgeInsets.all(10),
  51. child: Row(
  52. mainAxisAlignment: MainAxisAlignment.center,
  53. children: [
  54. MyLikeButton(
  55. key: likeButtonKey,
  56. isLiked: false,
  57. isCustomIcon: true,
  58. onLike: () {
  59. Log.d('点击了like button');
  60. },
  61. ),
  62. MyTextView(
  63. 'Like',
  64. textColor: ColorUtils.string2Color('#767676'),
  65. fontSize: 14,
  66. isFontRegular: true,
  67. textAlign: TextAlign.left,
  68. marginLeft: 8,
  69. )
  70. ],
  71. ),
  72. ).onTap((){
  73. final state = likeButtonKey.currentState;
  74. state?.triggerTap();
  75. }),
  76. ),
  77. Expanded(
  78. child: Container(
  79. padding: const EdgeInsets.all(8),
  80. child: Row(
  81. mainAxisAlignment: MainAxisAlignment.center,
  82. children: [
  83. const MyAssetImage(Assets.communityComments, width: 16,height: 16,),
  84. MyTextView(
  85. 'Comments',
  86. textColor: ColorUtils.string2Color('#767676'),
  87. fontSize: 14,
  88. isFontRegular: true,
  89. textAlign: TextAlign.left,
  90. marginLeft: 8,
  91. ),
  92. ],
  93. ),
  94. ).onTap((){
  95. // Log.d("点击了comments ${tabsRouterKey.currentState?.controller?.activeIndex}");
  96. // tabsRouterKey.currentState?.controller?.setActiveIndex(2);
  97. onComment?.call();
  98. }),
  99. ),
  100. if(showShare)
  101. Expanded(
  102. child: Container(
  103. padding: const EdgeInsets.all(8),
  104. child: Row(
  105. mainAxisAlignment: MainAxisAlignment.center,
  106. children: [
  107. const MyAssetImage(Assets.communityShare, width: 16,height: 16,),
  108. MyTextView(
  109. 'Share',
  110. textColor: ColorUtils.string2Color('#767676'),
  111. fontSize: 14,
  112. isFontRegular: true,
  113. textAlign: TextAlign.left,
  114. marginLeft: 8,
  115. ),
  116. ],
  117. ),
  118. ).onTap((){
  119. Log.d("点击了share");
  120. onShare?.call();
  121. }),
  122. ),
  123. ]
  124. )
  125. );
  126. }
  127. }