123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- import 'package:cpt_community/components/newfeed_card_header.dart';
- import 'package:cs_resources/generated/assets.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter/widgets.dart';
- import 'package:flutter_hooks/flutter_hooks.dart';
- import 'package:hooks_riverpod/hooks_riverpod.dart';
- import 'package:shared/utils/color_utils.dart';
- import 'package:shared/utils/log_utils.dart';
- import 'package:widgets/ext/ex_widget.dart';
- import 'package:widgets/my_load_image.dart';
- import 'package:widgets/my_text_view.dart';
- import 'package:widgets/my_like_button.dart';
- import '../modules/community/community_page.dart';
- // 'id':1,
- // 'avator': Assets.communityCamera,
- // 'title': 'William Jefferson',
- // 'isFollow': false,
- // 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
- // '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'],
- // 'time': 'June 17,2016 at 7:23 p.m.',
- // 'likeno': 12
- class NewsFeedCardFooter extends HookConsumerWidget {
- final bool isLike;
- int? likes_count = 0;
- int? comments_count = 0;
- final VoidCallback? onLike;
- final VoidCallback? onComment;
- final VoidCallback? onShare;
- final bool showShare;
- final GlobalKey<MyLikeButtonState> likeButtonKey;
- NewsFeedCardFooter({
- Key? key,
- GlobalKey<MyLikeButtonState>? likeButtonKey,
- required this.isLike,
- this.onLike,
- this.likes_count = 0,
- this.comments_count = 0,
- this.onComment,
- this.onShare,
- this.showShare = false,
- })
- : likeButtonKey = likeButtonKey ?? GlobalKey<MyLikeButtonState>(),
- super(key: key);
- @override
- Widget build(BuildContext context, WidgetRef ref) {
- final _isLike =useState(isLike);
- final _likes_count =useState(likes_count);
- final _comments_count =useState(comments_count);
- return Container(
- height: 40,
- width: double.infinity,
- // padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Expanded(
- child: Container(
- padding: const EdgeInsets.all(10),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- MyLikeButton(
- key: likeButtonKey,
- isLiked: _isLike.value,
- isCustomIcon: true,
- onLike: () {
- Log.d('点击了like button');
- onLike?.call();
- },
- ),
- // 动态的
- MyTextView(
- 'Like (${_likes_count.value})',
- textColor: ColorUtils.string2Color('#767676'),
- fontSize: 14,
- isFontRegular: true,
- textAlign: TextAlign.left,
- marginLeft: 8,
- )
- ],
- ),
- ).onTap((){
- final state = likeButtonKey.currentState;
- state?.triggerTap();
- }),
- ),
- Expanded(
- child: Container(
- padding: const EdgeInsets.all(8),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- const MyAssetImage(Assets.communityComments, width: 16,height: 16,),
- MyTextView(
- 'Comments ($comments_count)',
- textColor: ColorUtils.string2Color('#767676'),
- fontSize: 14,
- isFontRegular: true,
- textAlign: TextAlign.left,
- marginLeft: 8,
- ),
- ],
- ),
- ).onTap((){
- // Log.d("点击了comments ${tabsRouterKey.currentState?.controller?.activeIndex}");
- // tabsRouterKey.currentState?.controller?.setActiveIndex(2);
- onComment?.call();
- }),
- ),
- if(showShare)
- Expanded(
- child: Container(
- padding: const EdgeInsets.all(8),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- const MyAssetImage(Assets.communityShare, width: 16,height: 16,),
- MyTextView(
- 'Share',
- textColor: ColorUtils.string2Color('#767676'),
- fontSize: 14,
- isFontRegular: true,
- textAlign: TextAlign.left,
- marginLeft: 8,
- ),
- ],
- ),
- ).onTap((){
- Log.d("点击了share");
- onShare?.call();
- }),
- ),
- ]
- )
- );
- }
- }
|