refactor(class): 优化接口请求与页面细节

1. 统一处理后端统一包结构,自动解析data字段
2. 新增点赞评论栏显示控制参数,详情页隐藏该栏
3. 简化详情页数据更新逻辑,对齐Vue版本实现
4. 重构确认弹窗组件,优化样式与弹窗尺寸
5. 为评论项添加水平边距,优化列表排版
This commit is contained in:
崔宝新
2026-09-07 16:02:14 +08:00
parent 7175bf3054
commit d5f73cfbb5
4 changed files with 72 additions and 64 deletions
@@ -28,6 +28,7 @@ class PostCard extends StatelessWidget {
required this.onComment,
this.showCommentComposer = true,
this.hasCardBackground = true,
this.showLikeCommentBar = true,
});
final UserPostDto post;
@@ -40,6 +41,9 @@ class PostCard extends StatelessWidget {
/// 是否显示白色卡片背景(列表页 true;详情页与留言区共用一张大卡片 → false)
final bool hasCardBackground;
/// 是否显示点赞/评论标记栏(列表页 true;详情页不需要 → false)
final bool showLikeCommentBar;
String get _avatar {
final url = ImgUrl.build(post.avatar);
return url.isEmpty
@@ -96,12 +100,13 @@ class PostCard extends StatelessWidget {
AlbumGrid(urls: post.urls.map(ImgUrl.build).toList()),
],
SizedBox(height: 10.h),
LikeCommentBar(
post: post,
onLike: onLike,
onComment: onComment,
showComposer: showCommentComposer,
),
if (showLikeCommentBar)
LikeCommentBar(
post: post,
onLike: onLike,
onComment: onComment,
showComposer: showCommentComposer,
),
],
),
),