glglove 2 days ago
parent
commit
1275823c9f

+ 145 - 0
packages/cpt_community/lib/components/comments_dialog.dart

@@ -0,0 +1,145 @@
+
+import 'package:flutter/material.dart';
+import 'package:cs_resources/generated/l10n.dart';
+import 'package:widgets/ext/ex_widget.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:widgets/my_text_view.dart';
+import 'package:widgets/no_shadow_scroll_behavior.dart';
+import 'package:widgets/widget_export.dart';
+
+class CommentsDialog extends StatelessWidget {
+  String? title;
+  String? message;
+  Widget? Function(BuildContext)? messageBuilder;
+  VoidCallback confirmAction;
+  VoidCallback? cancelAction;
+  bool isShowCancelBtn;
+  bool isShowConfirmBtn;
+  String? confirmTxt;
+  String? cancelTxt;
+  double? height = 0.0;
+  double? minHeight = 0.0;
+  double? maxHeight = 300.0;
+
+  CommentsDialog({
+    this.title,
+    this.message,
+    Widget Function(BuildContext)? this.messageBuilder,
+    required this.confirmAction,
+    this.cancelAction,
+    this.isShowCancelBtn = true,
+    this.isShowConfirmBtn = true,
+    this.confirmTxt,
+    this.cancelTxt,
+    height,
+    minHeight,
+    maxHeight,
+    Key? key,
+  }): height = height?? 0.0,
+        minHeight = minHeight?? 0.0,
+        maxHeight = maxHeight?? 5000,
+        super(key:key);
+
+  @override
+  Widget build(BuildContext context) {
+    return Container(
+      width: double.infinity,
+      padding: const EdgeInsets.only(top: 30),
+      constraints: BoxConstraints(
+        minHeight: minHeight!,
+        maxHeight: maxHeight!,
+      ),
+      decoration: BoxDecoration(
+        color: context.appColors.whiteSecondBG,
+        borderRadius: const BorderRadius.only(
+          topLeft: Radius.circular(0),
+          topRight: Radius.circular(0),
+        ),
+      ),
+      child: SizedBox(
+        height: height!,
+        child: Column(
+          crossAxisAlignment: CrossAxisAlignment.center,
+          children: [
+            Expanded(
+              child: Scrollbar(
+                child: ScrollConfiguration(
+                  behavior: NoShadowScrollBehavior(),
+                  child: SingleChildScrollView(
+                    child: messageBuilder?.call(context) ??
+                        MyTextView(
+                          message!,
+                          fontSize: 18,
+                          textColor: context.appColors.textBlack,
+                          isFontRegular: true,
+                          textAlign: TextAlign.center,
+                          paddingLeft: 30,
+                          paddingRight: 30,
+                        ),
+                  ),
+                ),
+              ).constrained(maxHeight: maxHeight! - 60),
+            ),
+            Row(
+              children: [
+                const SizedBox(width: 18),
+                Visibility(
+                  visible: isShowCancelBtn,
+                  child: Expanded(
+                      flex: 1,
+                      child: InkWell(
+                        onTap: () {
+                          onCancel();
+                          cancelAction?.call();
+                        },
+                        child: MyTextView(
+                          cancelTxt ?? S.current.no,
+                          fontSize: 16,
+                          isFontMedium: true,
+                          paddingTop: 13,
+                          marginRight: 15,
+                          paddingBottom: 13,
+                          textAlign: TextAlign.center,
+                          textColor: Colors.white,
+                          backgroundColor: context.appColors.orangeBG,
+                          cornerRadius: 7,
+                        ),
+                      )),
+                ),
+                Expanded(
+                    flex: 1,
+                    child: Visibility(
+                      visible: isShowConfirmBtn,
+                      child: InkWell(
+                        onTap: () async {
+                          onCancel();
+                          confirmAction();
+                        },
+                        child: MyTextView(
+                          confirmTxt ?? S.current.yes,
+                          fontSize: 16,
+                          paddingTop: 13,
+                          paddingBottom: 13,
+                          isFontMedium: true,
+                          textAlign: TextAlign.center,
+                          textColor: Colors.white,
+                          backgroundColor: context.appColors.btnBgDefault,
+                          cornerRadius: 7,
+                        ),
+                      ),
+                    )),
+                const SizedBox(width: 18),
+              ],
+            ).marginOnly(bottom: 30, top: 28),
+          ],
+        ),
+      ),
+    );
+  }
+
+  //取消弹框
+  void onCancel() async {
+    SmartDialog.dismiss();
+  }
+
+}

+ 8 - 8
packages/cpt_community/lib/modules/community/news/news_vm.dart

@@ -21,18 +21,18 @@ class NewsVm extends _$NewsVm {
       list: [
           {
             'id':1,
-            'avator': Assets.communityCamera,
+            'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
             '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.',
-              'isLike': true,
+            'isLike': true,
             'likeno': 12
           },
           {
             'id':2,
-            'avator': Assets.communityCamera,
+            'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
             'title': 'William fdsaf的飞洒发生的',
             'isFollow': true,
             'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
@@ -43,7 +43,7 @@ class NewsVm extends _$NewsVm {
           },
           {
             'id':3,
-            'avator': Assets.communityCamera,
+            'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
             'title': 'Fsjfkds  dfsk',
             'isFollow': false,
             'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
@@ -54,7 +54,7 @@ class NewsVm extends _$NewsVm {
           },
           {
             'id':4,
-            'avator': Assets.communityCamera,
+            'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
             'title': 'Fsjfkds  dfsk',
             'isFollow': false,
             'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
@@ -65,7 +65,7 @@ class NewsVm extends _$NewsVm {
           },
           {
             'id':5,
-            'avator': Assets.communityCamera,
+            'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
             'title': 'Fsjfkds  dfsk',
             'isFollow': false,
             'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
@@ -76,7 +76,7 @@ class NewsVm extends _$NewsVm {
           },
           {
             'id':6,
-            'avator': Assets.communityCamera,
+            'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
             'title': 'Fsjfkds  dfsk',
             'isFollow': false,
             'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
@@ -87,7 +87,7 @@ class NewsVm extends _$NewsVm {
           },
           {
             'id':7,
-            'avator': Assets.communityCamera,
+            'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
             'title': '放大发大水',
             'isFollow': false,
             'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',

+ 95 - 0
packages/cpt_community/lib/modules/community/newsfeed_detail/comments_input.dart

@@ -0,0 +1,95 @@
+import 'package:cpt_community/modules/community/newsfeed_detail/newsfeed_detail_vm.dart';
+import 'package:cs_resources/generated/l10n.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_hooks/flutter_hooks.dart';
+import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:shared/utils/log_utils.dart';
+import 'package:widgets/my_text_view.dart';
+
+/// 多行输入框
+
+class CommentsTextareaInput extends HookConsumerWidget {
+  bool showCounter = true;
+  CommentsTextareaInput({Key? key,this.showCounter = true}): super(key: key);
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    final state = ref.watch(newsfeedDetailVmProvider);
+    final vm = ref.read(newsfeedDetailVmProvider.notifier);
+    final noteCount = useState(0);
+    return _buildTextAreaLayout(context, ref, state, vm, noteCount);
+  }
+
+  Widget _buildTextAreaLayout(BuildContext context, ref, state, vm , noteCount){
+    Log.d("----898989----${state.commentFieldInfo}-----");
+    // return Text('角度看是否 ${state.commentFieldInfo['hintText']}');
+    return Stack(
+      children: [
+        Text("发的时刻减肥的"),
+      ]
+    );
+      // Row(
+      // mainAxisSize: MainAxisSize.max,
+      // children: [
+      //   Expanded(
+      //     child: Stack(
+      //         children: [
+      //           TextField(
+      //             cursorColor: context.appColors.authFiledText,
+      //             cursorWidth: 1.5,
+      //             autofocus: false,
+      //             enabled: true,
+      //             maxLines: null,
+      //             focusNode: state.commentFieldInfo['focusNode'],
+      //             controller: state.commentFieldInfo!['controller'],
+      //             decoration: InputDecoration(
+      //               isDense: true,
+      //               isCollapsed: true,
+      //               border: InputBorder.none,
+      //               hintText: state.commentFieldInfo!['hintText'],
+      //               hintStyle: TextStyle(
+      //                 color: context.appColors.authFiledHint,
+      //                 fontSize: 16.0,
+      //                 fontWeight: FontWeight.w500,
+      //               ),
+      //             ),
+      //             style: TextStyle(
+      //               color: context.appColors.authFiledText,
+      //               fontSize: 16.0,
+      //               fontWeight: FontWeight.w500,
+      //             ),
+      //             textInputAction: TextInputAction.done,
+      //             onSubmitted: (value) {
+      //               // FocusScope.of(context).unfocus();
+      //             },
+      //             expands: true,
+      //             onChanged: (text) {
+      //               // 当文本改变时,更新字符数量
+      //               if(showCounter){
+      //                 noteCount.value = text.length;
+      //               }
+      //             },
+      //           ),
+      //           Visibility(
+      //               visible: showCounter,
+      //               child: Positioned(
+      //                 bottom: 0.0,
+      //                 right: 0.0,
+      //                 child: Text(
+      //                   S.current.characters(noteCount.value),
+      //                   style: TextStyle(
+      //                     color: context.appColors.textBlack,
+      //                     fontSize: 15.0,
+      //                   ),
+      //                 ),
+      //               ),
+      //           ),
+      //         ]
+      //     ),
+      //   ),
+      // ],
+    // );
+  }
+}
+

+ 86 - 56
packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_page.dart

@@ -99,62 +99,7 @@ class NewsfeedDetailPage extends HookConsumerWidget {
                   ),
                 ),
               ),
-              SafeArea(
-                child: Visibility(
-                  visible: state.loadingState == LoadState.State_Success,
-                  child: Container(
-                    height: 60,
-                    width: MediaQuery.of(context).size.width,
-                    color: ColorUtils.string2Color("#4161D0"),
-                    child: Row(
-                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
-                        crossAxisAlignment: CrossAxisAlignment.center,
-                        children: [
-                          Expanded(
-                                child: Row(
-                                  mainAxisAlignment: MainAxisAlignment.center,
-                                  crossAxisAlignment: CrossAxisAlignment.center,
-                                  children: [
-                                    MyLoadImage(
-                                      Assets.communityLike,
-                                      width: 16.5,
-                                      height: 16.5,
-                                    ),
-                                    const SizedBox(width: 10,),
-                                    MyTextView(
-                                      "Like",
-                                      textColor: context.appColors.whiteBG,
-                                      fontSize: 14,
-                                      isFontRegular: true,
-                                    ),
-                                  ],
-                                ),
-                          ),
-                          Expanded(
-                            child: Row(
-                              mainAxisAlignment: MainAxisAlignment.center,
-                              crossAxisAlignment: CrossAxisAlignment.center,
-                              children: [
-                                MyLoadImage(
-                                  Assets.communityComments,
-                                  width: 17.5,
-                                  height: 16.5,
-                                ),
-                                const SizedBox(width: 10,),
-                                MyTextView(
-                                  "Comment",
-                                  textColor: context.appColors.whiteBG,
-                                  fontSize: 14,
-                                  isFontRegular: true,
-                                ),
-                              ],
-                            ),
-                          ),
-                        ]
-                    )
-                  ),
-                ),
-              )
+              _buildBottomActionSection(context, ref,),
           ]
       )
     );
@@ -380,4 +325,89 @@ class NewsfeedDetailPage extends HookConsumerWidget {
       ),
     );
   }
+
+
+  Widget _buildBottomActionSection(BuildContext context, WidgetRef ref ){
+    final state = ref.watch(newsfeedDetailVmProvider);
+    final vm = ref.read(newsfeedDetailVmProvider.notifier);
+    bool isLike = state.detailInfo['isLike'];
+    return SafeArea(
+      child: Visibility(
+        visible: state.loadingState == LoadState.State_Success,
+        child: Container(
+            height: 60,
+            width: MediaQuery.of(context).size.width,
+            color: ColorUtils.string2Color("#4161D0"),
+            child: Row(
+                mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                crossAxisAlignment: CrossAxisAlignment.center,
+                children: [
+                  Expanded(
+                    child: Row(
+                      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,
+                                ),
+                                const SizedBox(width: 10,),
+                                MyTextView(
+                                  "Like",
+                                  textColor: context.appColors.whiteBG,
+                                  fontSize: 14,
+                                  isFontRegular: true,
+                                ),
+                              ],
+                            )
+                        )
+                      ],
+                    ),
+                  ),
+                  Expanded(
+                    child: Row(
+                      mainAxisAlignment: MainAxisAlignment.center,
+                      crossAxisAlignment: CrossAxisAlignment.center,
+                      children: [
+                        InkWell(
+                          onTap: () {
+                            vm.handlerCommentClick(context);
+                          },
+                          child: Wrap(
+                            children: [
+                              MyLoadImage(
+                                Assets.communityNewsfeedDetailComment,
+                                width: 17.5,
+                                height: 16.5,
+                              ),
+                              const SizedBox(width: 10,),
+                              MyTextView(
+                                "Comment",
+                                textColor: context.appColors.whiteBG,
+                                fontSize: 14,
+                                isFontRegular: true,
+                              ),
+                            ],
+                          ),
+                        )
+                      ],
+                    ),
+                  ),
+                ]
+            )
+        ),
+      ),
+    );
+  }
 }

+ 11 - 1
packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_state.dart

@@ -8,6 +8,10 @@ class NewsfeedDetailState {
   int? curPage;
   int? pageSize = 10;
   int? filterCount = 1;
+
+  // 评论框信息
+  Map<String, dynamic>? commentFieldInfo;
+
   Map<String, dynamic> detailInfo;
   List<Map<String, dynamic>> list; // 评论列表
 
@@ -17,9 +21,11 @@ class NewsfeedDetailState {
     this.curPage = 1,
     this.pageSize = 10,
     this.filterCount = 1,
+    Map<String, dynamic>? commentFieldInfo,
     required this.detailInfo,
     required this.list,
-  });
+  }): commentFieldInfo = commentFieldInfo ?? {},
+      errorMessage = errorMessage?? '';
 
   NewsfeedDetailState copyWith({
     LoadState? loadingState,
@@ -28,6 +34,7 @@ class NewsfeedDetailState {
     int? pageSize,
     int? filterCount,
     Map<String, dynamic>? detailInfo,
+    Map<String, dynamic>? commentFieldInfo,
     List<Map<String, dynamic>>? list,
   }) {
     return NewsfeedDetailState(
@@ -36,6 +43,7 @@ class NewsfeedDetailState {
       curPage: curPage ?? this.curPage,
       pageSize: pageSize ?? this.pageSize,
       filterCount: filterCount ?? this.filterCount,
+      commentFieldInfo: commentFieldInfo ?? this.commentFieldInfo,
       detailInfo: detailInfo ?? this.detailInfo,
       list: list ?? this.list,
     );
@@ -48,6 +56,7 @@ class NewsfeedDetailState {
       'curPage': this.curPage,
       'pageSize': this.pageSize,
       'filterCount': this.filterCount,
+      'commentFieldInfo': this.commentFieldInfo,
       'detailInfo': this.detailInfo,
       'list': this.list,
     };
@@ -60,6 +69,7 @@ class NewsfeedDetailState {
       curPage: map['curPage'] as int,
       pageSize: map['pageSize'] as int,
       filterCount: map['filterCount'] as int,
+      commentFieldInfo: map['commentFieldInfo'] as Map<String, dynamic>,
       detailInfo: map['detailInfo'] as Map<String, dynamic>,
       list: map['list'] as List<Map<String, dynamic>>,
     );

+ 75 - 4
packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_vm.dart

@@ -1,12 +1,19 @@
 
 import 'package:cs_resources/generated/assets.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:plugin_platform/engine/dialog/dialog_engine.dart';
 import 'package:plugin_platform/engine/toast/toast_engine.dart';
 import 'package:riverpod_annotation/riverpod_annotation.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_text_view.dart';
 import 'package:widgets/widget_export.dart';
+import '../../../components/comments_dialog.dart';
 
+import 'comments_input.dart';
 import 'newsfeed_detail_state.dart';
 import 'newsfeed_detail_page.dart';
 
@@ -14,6 +21,17 @@ part 'newsfeed_detail_vm.g.dart';
 
 @riverpod
 class NewsfeedDetailVm extends _$NewsfeedDetailVm {
+
+  // 评论框信息
+  final Map<String, dynamic> _textFieldInfo= {
+    'value': '',
+    'controller': TextEditingController(),
+    'hintText': 'What\'s on your mind?',
+    'focusNode': FocusNode(),
+    'obsecure': false,
+  };
+
+
   bool _needShowPlaceholder = true; //是否展示LoadingView
 
   // Refresh 控制器
@@ -26,7 +44,7 @@ class NewsfeedDetailVm extends _$NewsfeedDetailVm {
     return NewsfeedDetailState(
       detailInfo: {
         'id':1,
-        'avator': Assets.communityCamera,
+        'avator': 'https://p4.itc.cn/q_70/images03/20231121/ab826c4a7efe4c9aa93ca6e00f9e0986.jpeg',
         'title': 'William Jefferson',
         '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'],
@@ -40,7 +58,7 @@ class NewsfeedDetailVm extends _$NewsfeedDetailVm {
             {
                 'userId': 1,
                 'userName': 'William Jefferson',
-                'avator': Assets.communityCamera,
+                'avator': 'https://iknow-pic.cdn.bcebos.com/d439b6003af33a87f27f0584d45c10385343b519',
                 'time': 'June 17,2016 at 7:23 p.m.',
                 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]'
             },
@@ -51,11 +69,18 @@ class NewsfeedDetailVm extends _$NewsfeedDetailVm {
         {
           'userId': 1,
           'userName': 'William Jefferson',
-          'avator': Assets.communityCamera,
+          'avator': 'https://iknow-pic.cdn.bcebos.com/d439b6003af33a87f27f0584d45c10385343b519',
           'time': 'June 17,2016 at 7:23 p.m.',
           'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]'
         },
       ],
+      commentFieldInfo: {
+        'value': '',
+        'controller': TextEditingController(),
+        'hintText': 'What\'s on your mind?',
+        'focusNode': FocusNode(),
+        'obsecure': false,
+      }
     );
   }
 
@@ -157,12 +182,20 @@ class NewsfeedDetailVm extends _$NewsfeedDetailVm {
       {
         'userId': 1,
         'userName': 'William Jefferson',
-        'avator': Assets.communityCamera,
+        'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
+        'time': 'June 17,2016 at 7:23 p.m.',
+        'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]'
+      },
+      {
+        'userId': 2,
+        'userName': 'Ander Jackson',
+        'avator': 'https://iknow-pic.cdn.bcebos.com/d439b6003af33a87f27f0584d45c10385343b519',
         'time': 'June 17,2016 at 7:23 p.m.',
         'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]'
       },
     ];
 
+
     if (state.curPage == 1) {
       //刷新的方式
       state = state.copyWith(list: listData);
@@ -181,5 +214,43 @@ class NewsfeedDetailVm extends _$NewsfeedDetailVm {
     _needShowPlaceholder = false;
   }
 
+
+  // 点击了 comment 按钮
+  handlerCommentClick(BuildContext context) async{
+    BuildContext contextPage = context;
+    Log.d("点击了评论按钮");
+    await DialogEngine.show(
+      tag: "newsfeedcomments",
+      position: DialogPosition.bottom,
+      widget: CommentsDialog(
+        isShowConfirmBtn: false,
+        isShowCancelBtn: false,
+        height: 300.0,
+        confirmAction: (){},
+        cancelAction: null,
+        messageBuilder: (context) {
+          return Row(
+            mainAxisAlignment: MainAxisAlignment.start,
+            children: [
+              // Container(
+              //   color: Colors.red,
+              //   padding: const EdgeInsets.only(left: 15,right: 15),
+              //   child: Text("fdjsjfdks", textAlign: TextAlign.left,),
+              // ),
+              Expanded(
+                  child: CommentsTextareaInput( showCounter:false,),
+              ),
+            ]
+          );
+        },
+      ),
+    );
+  }
+
+  // 点击了 Like 按钮
+  bool handlerLikeClick(){
+    Log.d("点击了点赞按钮");
+    return true;
+  }
 }
 

+ 3 - 3
packages/cpt_community/lib/modules/garage/for_rent/for_rent_vm.dart

@@ -27,7 +27,7 @@ class ForrentVm extends _$ForrentVm {
             'collection_num': 12,
             'publisher': 'William Jefferson',
             'publish_time': 'June 17,2016 at 7:23 p.m.',
-            'publisrher_avator': Assets.communityCamera
+            'publisrher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
           },
           {
             'id':2,
@@ -38,7 +38,7 @@ class ForrentVm extends _$ForrentVm {
             'collection_num': 12,
             'publisher': 'William Jefferson',
             'publish_time': 'June 17,2016 at 7:23 p.m.',
-            'publisher_avator': Assets.communityCamera
+            'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
           },
           {
             'id':3,
@@ -49,7 +49,7 @@ class ForrentVm extends _$ForrentVm {
             'collection_num': 12,
             'publisher': 'William Jefferson',
             'publish_time': 'June 17,2016 at 7:23 p.m.',
-            'publisher_avator': Assets.communityCamera
+            'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
           },
         ]
     );

+ 6 - 6
packages/cpt_community/lib/modules/garage/for_sale/for_sale_vm.dart

@@ -133,7 +133,7 @@ class ForsaleVm extends _$ForsaleVm {
         'collection_num': 12,
         'publisher': 'William Jefferson',
         'publish_time': 'June 17,2016 at 7:23 p.m.',
-        'publisher_avator': Assets.communityCamera
+        'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
       },
       {
         'id':2,
@@ -144,7 +144,7 @@ class ForsaleVm extends _$ForsaleVm {
         'collection_num': 12,
         'publisher': 'William Jefferson',
         'publish_time': 'June 17,2016 at 7:23 p.m.',
-        'publisher_avator': Assets.communityCamera
+        'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
       },
       {
         'id':3,
@@ -155,7 +155,7 @@ class ForsaleVm extends _$ForsaleVm {
         'collection_num': 12,
         'publisher': 'William Jefferson',
         'publish_time': 'June 17,2016 at 7:23 p.m.',
-        'publisher_avator': Assets.communityCamera
+        'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
       },
       {
         'id':4,
@@ -166,7 +166,7 @@ class ForsaleVm extends _$ForsaleVm {
         'collection_num': 12,
         'publisher': 'William Jefferson',
         'publish_time': 'June 17,2016 at 7:23 p.m.',
-        'publisher_avator': Assets.communityCamera
+        'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
       },
       {
         'id':5,
@@ -177,7 +177,7 @@ class ForsaleVm extends _$ForsaleVm {
         'collection_num': 12,
         'publisher': 'William Jefferson',
         'publish_time': 'June 17,2016 at 7:23 p.m.',
-        'publisher_avator': Assets.communityCamera
+        'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
       },
       {
         'id':6,
@@ -188,7 +188,7 @@ class ForsaleVm extends _$ForsaleVm {
         'collection_num': 12,
         'publisher': 'William Jefferson',
         'publish_time': 'June 17,2016 at 7:23 p.m.',
-        'publisher_avator': Assets.communityCamera
+        'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
       },
     ];
 

+ 77 - 35
packages/cpt_community/lib/modules/garage/garagesale_detail/garagesale_detail_page.dart

@@ -1,5 +1,6 @@
 import 'package:cpt_community/modules/garage/garagesale_detail/garagesale_detail_vm.dart';
 import 'package:cpt_community/router/page/community_page_router.dart';
+import 'package:cs_resources/generated/assets.dart';
 import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
@@ -52,18 +53,26 @@ class GaragesaleDetailPage extends HookConsumerWidget {
       body: Column(
         children: [
           Expanded(
-            child: LoadStateLayout(
-              state: state.loadingState,
-              errorMessage: state.errorMessage,
-              errorRetry: () {
-                vm.retryRequest();
-              },
-              successWidget: SingleChildScrollView(
-                scrollDirection: Axis.vertical,
-                physics: const BouncingScrollPhysics(),
-                clipBehavior: Clip.none,
-                child: _buildContentBox(context, ref),
-              ),
+            child: Stack(
+              children:[
+                LoadStateLayout(
+                  state: state.loadingState,
+                  errorMessage: state.errorMessage,
+                  errorRetry: () {
+                    vm.retryRequest();
+                  },
+                  successWidget: SingleChildScrollView(
+                    scrollDirection: Axis.vertical,
+                    physics: const BouncingScrollPhysics(),
+                    clipBehavior: Clip.none,
+                    child: _buildContentBox(context, ref),
+                  ),
+                ),
+                Visibility(
+                  visible: state.loadingState == LoadState.State_Success,
+                  child: _buildWhatsApp(context, ref),
+                ),
+              ]
             ),
           ),
           // 底部联系信息
@@ -76,6 +85,20 @@ class GaragesaleDetailPage extends HookConsumerWidget {
     );
   }
 
+  Widget _buildWhatsApp(BuildContext context, WidgetRef ref) {
+    final vm = ref.read(garagesaleDetailVmProvider.notifier);
+    return Positioned(
+      right: 15.5,
+      bottom: 42,
+      child: InkWell(
+        onTap: () {
+          // 跳转 WhatsApp
+          vm.gotoWhatsApp();
+        },
+        child: const MyAssetImage(Assets.communityWhatsAPP, width: 57,height: 57,),
+      ),
+    );
+  }
 
   Widget _buildContentBox(BuildContext context, WidgetRef ref) {
     final vm = ref.read(garagesaleDetailVmProvider.notifier);
@@ -129,31 +152,50 @@ class GaragesaleDetailPage extends HookConsumerWidget {
       height: 50,
       color: ColorUtils.string2Color('#4161D0'),
       child: Row(
-        mainAxisAlignment: MainAxisAlignment.spaceAround,
+        mainAxisAlignment: MainAxisAlignment.center,
         children: [
-          Row(
-            children: [
-              MyLoadImage(
-                publisherAvatar,
-                width: 29,
-                height: 29,
-                isCircle: true,
-              ),
-              Column(
-                children: [
-                  MyTextView(publisher, fontSize:12, textColor: context.appColors.textWhite,)
-                ],
-              ),
-            ],
+          Expanded(
+            child: Row(
+              crossAxisAlignment: CrossAxisAlignment.center,
+              children: [
+                SizedBox.fromSize(size: const Size(15, 0)),
+                MyLoadImage(
+                  publisherAvatar,
+                  width: 29,
+                  height: 29,
+                  isCircle: true,
+                ),
+                SizedBox.fromSize(size: const Size(10, 0)),
+                Column(
+                  crossAxisAlignment: CrossAxisAlignment.start,
+                  mainAxisAlignment: MainAxisAlignment.center,
+                  children: [
+                    MyTextView(publisher, fontSize:12, textColor: context.appColors.textWhite, isFontMedium: true,),
+                    MyTextView(publisherTime, fontSize:10, textColor: context.appColors.textWhite, isFontRegular: true, marginTop: 4,)
+                  ],
+                ),
+              ],
+            ),
           ),
-          Row(),
-
-          const SizedBox(width: 10,),
-          MyTextView(
-            "Request a Quote",
-            fontSize: 16,
-            textColor: Colors.white,
-            isFontMedium: true,
+          Expanded(
+            child: Row(
+              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,
+                ),
+                const SizedBox(width: 4,),
+                const MyAssetImage(Assets.communityPhone, width: 21.5,height: 18,),
+                const SizedBox(width: 15,),
+              ],
+            ),
           ),
         ],
       ),

+ 7 - 1
packages/cpt_community/lib/modules/garage/garagesale_detail/garagesale_detail_vm.dart

@@ -81,7 +81,7 @@ class GaragesaleDetailVm extends _$GaragesaleDetailVm {
       'goods_img': 'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
       'title': 'Electronic keyboard',
       'price': '\$66',
-      'description':'Electronic keyboards for sale. I will attend together with the booth.\$10 per day usage Negotiable',
+      'description':'Electronic keyboards for sale. I will attend together with the booth.\$10 per day usage Negotiable usage',
       'isCollection': true,
       'collection_num': 12,
       'publisher': 'William Jefferson',
@@ -98,4 +98,10 @@ class GaragesaleDetailVm extends _$GaragesaleDetailVm {
     // 最后赋值
     _needShowPlaceholder = false;
   }
+
+
+  // 去whatsapp
+  gotoWhatsApp(){
+    // 跳转 WhatsApp
+  }
 }

BIN
packages/cs_resources/assets/community/newsfeed_detail_comment.png


BIN
packages/cs_resources/assets/community/newsfeed_detail_like.png


+ 2 - 0
packages/cs_resources/lib/generated/assets.dart

@@ -51,6 +51,8 @@ class Assets {
   static const String communityLike = 'assets/community/like.webp';
   static const String communityLikeActive = 'assets/community/like_active.webp';
   static const String communityNesFeed = 'assets/community/nes_feed.webp';
+  static const String communityNewsfeedDetailComment = 'assets/community/newsfeed_detail_comment.png';
+  static const String communityNewsfeedDetailLike = 'assets/community/newsfeed_detail_like.png';
   static const String communityPhone = 'assets/community/phone.png';
   static const String communityShare = 'assets/community/share.webp';
   static const String communityWhatsAPP = 'assets/community/WhatsAPP.png';