gaol 1 周之前
父節點
當前提交
bc18818557
共有 1 個文件被更改,包括 60 次插入37 次删除
  1. 60 37
      packages/cpt_community/lib/modules/newsfeed/newsfeed_page.dart

+ 60 - 37
packages/cpt_community/lib/modules/newsfeed/newsfeed_page.dart

@@ -13,6 +13,7 @@ import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/my_load_image.dart';
 import 'package:widgets/my_text_view.dart';
 import 'package:widgets/widget_export.dart';
+import 'package:widgets/my_button.dart';
 
 import '../../components/newfeed_card_header.dart';
 import '../../router/page/community_page_router.dart';
@@ -90,49 +91,71 @@ class NewsfeedPage extends HookConsumerWidget {
   Widget _buildNewsItem(BuildContext context, WidgetRef ref, item, vm){
     return Container(
       width: double.infinity,
-      // padding: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
-        color: Colors.yellow,
-      child: Container(
-        margin: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
-        color: Colors.white,
-        padding: const EdgeInsets.only(left: 15, right: 15,top: 17,bottom: 17),
-        height: 280,
-        child: Column(
-          mainAxisAlignment: MainAxisAlignment.center,
-          crossAxisAlignment: CrossAxisAlignment.start,
-          children: [
-            // 卡片头部(头像 标题 时间)
-            NewsFeedCardHeader(
-              title: item['title'],
-              avator: item['avator'],
-              time: item['time'],
+      //   color: Colors.yellow,
+      child: Stack(
+        children: [
+          Container(
+            margin: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
+            color: Colors.white,
+            padding: const EdgeInsets.only(left: 15, right: 15,top: 17,bottom: 17),
+            height: 280,
+            child: Column(
+                mainAxisAlignment: MainAxisAlignment.center,
+                crossAxisAlignment: CrossAxisAlignment.start,
+                children: [
+                  // 卡片头部(头像 标题 时间)
+                  NewsFeedCardHeader(
+                    title: item['title'],
+                    avator: item['avator'],
+                    time: item['time'],
+                  ),
+                  const SizedBox(height: 15),
+                  // 卡片中间 (文字和图片)
+                  Expanded(
+                    child: NewsFeedCardContent(
+                      content: item['content'],
+                      imageUrls: item['imageUrls'],
+                    ),
+                  ),
+                  const SizedBox(height: 26),
+                  // // 卡片底部 (点赞 评论 分享)
+                  NewsFeedCardFooter(
+                    isLike: item['isLike'],
+                  ),
+                ]
             ),
-            const SizedBox(height: 15),
-            // 卡片中间 (文字和图片)
-            Expanded(
-              child: NewsFeedCardContent(
-                content: item['content'],
-                imageUrls: item['imageUrls'],
+          ),
+          // 右上角 关注/取消关注 按钮
+          Positioned(
+            right: 20,
+            top: 20,
+            child: Container(
+              width: 100,
+              alignment: Alignment.center,
+              decoration: BoxDecoration(
+                color: item['isFollow'] ? ColorUtils.string2Color('#FFEBEE') : ColorUtils.string2Color('#F2F3F6'),
+                borderRadius: BorderRadius.circular(15),
               ),
-            ),
-            const SizedBox(height: 26),
-            // // 卡片底部 (点赞 评论 分享)
-            NewsFeedCardFooter(
-              isLike: item['isLike'],
-            ),
-          ]
-        ),
-      )
+              child: MyButton(
+                text: item['isFollow'] ? 'Following' : 'Follow',
+                textColor: item['isFollow'] ? ColorUtils.string2Color('#FF0000') : ColorUtils.string2Color('#000000'),
+                backgroundColor: item['isFollow'] ? ColorUtils.string2Color('#F2F3F6') : ColorUtils.string2Color('#FFEBEE'),
+                radius: 0,
+                minHeight: 50,
+                fontWeight: FontWeight.w500,
+                fontSize: 14,
+                onPressed: (){
+                  // Navigator.pop(context);
+                },
+              ),
+            )
+          )
+        ],
+      ),
     );
   }
 
   Widget _buildNesFeedList(BuildContext context, WidgetRef ref, vm){
-    // return Container(
-    //   height: 100,
-    //   color: Colors.blue,
-    // );
-    // List items = List.generate(20, (index) => "Item $index");
-    // List items = _vm.state.list.fromMap();
     final itemList = vm.state.list?? [];
     if(itemList.isEmpty){
       return const Center(child: Text('No Data'));