glglove 3 months ago
parent
commit
08de8d33c3

+ 2 - 0
packages/cpt_community/lib/components/newsfeed_card_content.dart

@@ -99,7 +99,9 @@ class NewsFeedCardContent extends StatelessWidget {
                       MyLoadImage(
                         imageUrls[index],
                         height: 87,
+                        width: maxWidth/imageCount - 16,
                         fit: BoxFit.cover,
+                        // fit:BoxFit.fitWidth,
                         cornerRadius: 5,
                         onClick: (){
                           if(isPreviewImage){

+ 2 - 3
packages/cpt_community/lib/components/newsfeed_card_footer.dart

@@ -53,11 +53,10 @@ class NewsFeedCardFooter extends StatelessWidget {
         children: [
           Expanded(
             child: Container(
-              padding: const EdgeInsets.all(8),
+              padding: const EdgeInsets.all(10),
               child: Row(
                 mainAxisAlignment: MainAxisAlignment.center,
                 children: [
-                  // const MyAssetImage(Assets.communityLike, width: 16,height: 16,),
                   MyLikeButton(
                     key: likeButtonKey,
                     isLiked: false,
@@ -73,7 +72,7 @@ class NewsFeedCardFooter extends StatelessWidget {
                     isFontRegular: true,
                     textAlign: TextAlign.left,
                     marginLeft: 8,
-                  ),
+                  )
                 ],
               ),
             ).onTap((){

+ 38 - 48
packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_page.dart

@@ -251,7 +251,7 @@ class NewsfeedDetailPage extends HookConsumerWidget {
           // 分割线
           Container(
             height: 1,
-            color: ColorUtils.string2Color("#E6E6E6"),
+            color: context.appColors.dividerDefault,
           ),
 
           Padding(
@@ -357,7 +357,7 @@ class NewsfeedDetailPage extends HookConsumerWidget {
         child: Container(
             height: 60,
             width: MediaQuery.of(context).size.width,
-            color: ColorUtils.string2Color("#4161D0"),
+            color: context.appColors.textPrimary,
             child: Row(
                 mainAxisAlignment: MainAxisAlignment.spaceBetween,
                 crossAxisAlignment: CrossAxisAlignment.center,
@@ -367,48 +367,37 @@ class NewsfeedDetailPage extends HookConsumerWidget {
                       mainAxisAlignment: MainAxisAlignment.center,
                       crossAxisAlignment: CrossAxisAlignment.center,
                       children: [
-                        InkWell(
-                            onTap: () async {
-                              // bool result = await vm.handlerLikeClick();
-                              // if(result){
-                              //   // 接口调用成功 修改 点赞的图标
-                              //
-                              // }
-                            },
-                            child: Wrap(
-                              children: [
-                                // MyLoadImage(
-                                //   Assets.communityNewsfeedDetailLike,
-                                //   width: 19,
-                                //   height: 18,
-                                // ),
-
-                                MyLikeButton(
-                                  key: _likeButtonKey,
-                                  isLiked: false,
-                                  isCustomIcon: true,
-                                  customIconWidth: 20,
-                                  customIconHeight: 18,
-                                  customIconActiveAssets: Assets.communityLikeActive,
-                                  customIconUnActiveAssets: Assets.communityNewsfeedDetailLike,
-                                  onLike: () {
-                                    Log.d('点击了like button');
-                                  },
-                                ),
-                                const SizedBox(width: 10,),
+                        Container(
+                          alignment: Alignment.center,
+                          padding: const EdgeInsets.only(left: 10,right: 10),
+                          child: Wrap(
+                            children: [
+                              MyLikeButton(
+                                key: _likeButtonKey,
+                                isLiked: false,
+                                isCustomIcon: true,
+                                customIconWidth: 20,
+                                customIconHeight: 18,
+                                customIconActiveAssets: Assets.communityLikeActive,
+                                customIconUnActiveAssets: Assets.communityNewsfeedDetailLike,
+                                onLike: () {
+                                  Log.d('点击了like button');
+                                },
+                              ),
+                              const SizedBox(width: 10,),
 
-                                MyTextView(
-                                  "Like",
-                                  textColor: context.appColors.whiteBG,
-                                  fontSize: 14,
-                                  isFontRegular: true,
-                                ).onTap((){
-                                  final state = _likeButtonKey.currentState;
-                                  state?.triggerTap();
-                                }),
-                              ],
-                            )
-                        )
+                              MyTextView(
+                                "Like",
+                                textColor: context.appColors.whiteBG,
+                                fontSize: 14,
+                                isFontRegular: true,
+                              )
+                            ],
+                          ),
+                        ).onTap((){
+                          final state = _likeButtonKey.currentState;
+                          state?.triggerTap();
+                        })
                       ],
                     ),
                   ),
@@ -417,10 +406,9 @@ class NewsfeedDetailPage extends HookConsumerWidget {
                       mainAxisAlignment: MainAxisAlignment.center,
                       crossAxisAlignment: CrossAxisAlignment.center,
                       children: [
-                        InkWell(
-                          onTap: () {
-                            vm.handlerCommentClick(context);
-                          },
+                        Container(
+                          alignment: Alignment.center,
+                          padding: const EdgeInsets.only(left: 10,right: 10),
                           child: Wrap(
                             children: [
                               MyLoadImage(
@@ -437,7 +425,9 @@ class NewsfeedDetailPage extends HookConsumerWidget {
                               ),
                             ],
                           ),
-                        )
+                        ).onTap((){
+                          vm.handlerCommentClick(context);
+                        })
                       ],
                     ),
                   ),

+ 38 - 11
packages/cpt_community/lib/modules/garage/garagesale_detail/garagesale_detail_page.dart

@@ -8,8 +8,10 @@ import 'package:flutter_hooks/flutter_hooks.dart';
 import 'package:hooks_riverpod/hooks_riverpod.dart';
 import 'package:router/ext/auto_router_extensions.dart';
 import 'package:shared/utils/color_utils.dart';
+import 'package:shared/utils/log_utils.dart';
 import 'package:widgets/load_state_layout.dart';
 import 'package:widgets/my_appbar.dart';
+import 'package:widgets/my_like_button.dart';
 import 'package:widgets/my_load_image.dart';
 import 'package:widgets/my_text_view.dart';
 
@@ -34,7 +36,7 @@ class GaragesaleDetailPage extends HookConsumerWidget {
     final state = ref.watch(garagesaleDetailVmProvider);
     final vm = ref.read(garagesaleDetailVmProvider.notifier);
     final String pageTitle = (type == 'forSale') ? 'For Sale' :'For Rent';
-
+    GlobalKey _likeButtonKey = GlobalKey<MyLikeButtonState>();
     useEffect((){
       // 组件挂载时执行 - 执行接口请求
       Future.microtask(() => vm.initPageData());
@@ -78,7 +80,7 @@ class GaragesaleDetailPage extends HookConsumerWidget {
           // 底部联系信息
           Visibility(
             visible: state.loadingState == LoadState.State_Success,
-            child: _buildBottomConcatInfo(context, ref),
+            child: _buildBottomConcatInfo(context, ref, _likeButtonKey),
           )
         ],
       ),
@@ -143,7 +145,7 @@ class GaragesaleDetailPage extends HookConsumerWidget {
     );
   }
 
-  Widget _buildBottomConcatInfo(BuildContext context, WidgetRef ref) {
+  Widget _buildBottomConcatInfo(BuildContext context, WidgetRef ref, likeButtonKey) {
     final state = ref.watch(garagesaleDetailVmProvider);
     String publisher = state.datas!['publisher'] ?? '';
     String contactType = state.datas!['contactType'] ?? '';
@@ -185,15 +187,40 @@ class GaragesaleDetailPage extends HookConsumerWidget {
               mainAxisAlignment: MainAxisAlignment.end,
               crossAxisAlignment: CrossAxisAlignment.center,
               children: [
-                const MyAssetImage(Assets.communityCollection, width: 18,height: 18,),
-                MyTextView(
-                  "$collectionNum",
-                  fontSize: 18,
-                  textColor: Colors.white,
-                  isFontRegular: true,
-                  marginLeft: 5,
-                  marginRight: 15,
+                Container(
+                  alignment: Alignment.center,
+                  padding: const EdgeInsets.only(left:5, right: 0,top:5,bottom: 5),
+                  child: Row(
+                    mainAxisAlignment: MainAxisAlignment.center,
+                    children: [
+                      MyLikeButton(
+                        key: likeButtonKey,
+                        isLiked: false,
+                        isCustomIcon: true,
+                        customIconUnActiveAssets: Assets.communityCollection,
+                        customIconActiveAssets: Assets.communityLikeActive,
+                        // customIconWidth: 18,
+                        // customIconHeight: 18,
+                        onLike: () {
+                          Log.d('点击了like button');
+                        },
+                      ),
+                      MyTextView(
+                        "$collectionNum",
+                        fontSize: 18,
+                        textColor: Colors.white,
+                        isFontRegular: true,
+                        marginLeft: 5,
+                        marginRight: 15,
+                        onClick: (){
+                          final state = likeButtonKey.currentState;
+                          state?.triggerTap();
+                        },
+                      ),
+                    ],
+                  ),
                 ),
+                // const MyAssetImage(Assets.communityCollection, width: 18,height: 18,),
                 Visibility(
                   visible: contactType == 'Mobile Phone',
                   child: const Row(

+ 4 - 1
packages/cpt_community/lib/modules/my_posts/my_posts_newsfeed/my_posts_newsfeed_page.dart

@@ -199,7 +199,10 @@ class MyPostsNewsfeedPage extends HookConsumerWidget {
             ),
           ],
         ),
-      );
+      ).onTap((){
+        // 跳转到 详情页
+        vm.handlerGotoDetail(item['id']);
+      });
     }).toList();
   }
 }

+ 1 - 2
packages/cs_widgets/lib/my_like_button.dart

@@ -89,8 +89,7 @@ class MyLikeButtonState extends State<MyLikeButton> with SingleTickerProviderSta
                 widget.isLiked ? widget.customIconActiveAssets??'': widget.customIconUnActiveAssets??'',
                 width: widget.customIconWidth,
                 height: widget.customIconHeight,
-              ) :
-            Icon(
+              ) : Icon(
               widget.isLiked ? widget.activeIcon : widget.unActiveIcon,
               size: widget.size,
               color: widget.isLiked ? widget.likedColor : widget.unlikedColor,