newsfeed_card_footer.dart 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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(8),
  51. child: Row(
  52. mainAxisAlignment: MainAxisAlignment.center,
  53. children: [
  54. // const MyAssetImage(Assets.communityLike, width: 16,height: 16,),
  55. MyLikeButton(
  56. key: likeButtonKey,
  57. isLiked: false,
  58. isCustomIcon: true,
  59. onLike: () {
  60. Log.d('点击了like button');
  61. },
  62. ),
  63. MyTextView(
  64. 'Like',
  65. textColor: ColorUtils.string2Color('#767676'),
  66. fontSize: 14,
  67. isFontRegular: true,
  68. textAlign: TextAlign.left,
  69. marginLeft: 8,
  70. ),
  71. ],
  72. ),
  73. ).onTap((){
  74. final state = likeButtonKey.currentState;
  75. state?.triggerTap();
  76. }),
  77. ),
  78. Expanded(
  79. child: Container(
  80. padding: const EdgeInsets.all(8),
  81. child: Row(
  82. mainAxisAlignment: MainAxisAlignment.center,
  83. children: [
  84. const MyAssetImage(Assets.communityComments, width: 16,height: 16,),
  85. MyTextView(
  86. 'Comments',
  87. textColor: ColorUtils.string2Color('#767676'),
  88. fontSize: 14,
  89. isFontRegular: true,
  90. textAlign: TextAlign.left,
  91. marginLeft: 8,
  92. ),
  93. ],
  94. ),
  95. ).onTap((){
  96. // Log.d("点击了comments ${tabsRouterKey.currentState?.controller?.activeIndex}");
  97. // tabsRouterKey.currentState?.controller?.setActiveIndex(2);
  98. onComment?.call();
  99. }),
  100. ),
  101. if(showShare)
  102. Expanded(
  103. child: Container(
  104. padding: const EdgeInsets.all(8),
  105. child: Row(
  106. mainAxisAlignment: MainAxisAlignment.center,
  107. children: [
  108. const MyAssetImage(Assets.communityShare, width: 16,height: 16,),
  109. MyTextView(
  110. 'Share',
  111. textColor: ColorUtils.string2Color('#767676'),
  112. fontSize: 14,
  113. isFontRegular: true,
  114. textAlign: TextAlign.left,
  115. marginLeft: 8,
  116. ),
  117. ],
  118. ),
  119. ).onTap((){
  120. Log.d("点击了share");
  121. onShare?.call();
  122. }),
  123. ),
  124. ]
  125. )
  126. );
  127. }
  128. }