新增:帖子详情页真实数据整页替换——四态/真九宫格大图/评论区/关注双态,Feed 导航与互动全接线,demo 详情退役(T3-15/16)
CI / flutter-gates (push) Failing after 20s

- post_detail_page 整页重写:内存副本先渲染 + getPost 拉新、四态
 (loading/error+重试/ready/40403 提示后返回 Feed 并刷新);媒体全量
  ——单图原比例(高度钳制 [0.75w,1.33w])、多图真九宫格(D11 轮播
  弃用,本单裁定)+ InteractiveViewer 全屏大图(03 号拍板 E)
- 评论区:游标列表触底补页 + 底部输入条创建(幂等键在数据层)+
  仅本人评论渲染删除入口(40301/40404 服务端兜底);成败埋点对
 (durationMs 取输入会话起点、attemptSeq 会话内递增);CommentTile
  升共享组件(@ 回复前缀呈现、降级作者「宠友」占位)
- 关注双态钮(tonal +关注 / Outlined 已关注 + 取关确认)乐观翻转、
  回滚零动画 + SnackBar,user_followed/unfollowed(post_detail) 挂接;
  本人帖不渲染
- Feed 接通:整卡与评论钮导航详情(T3-14 占位提示移除)、点赞/收藏
  接共享 ToggleSync(详情与卡片同一实例跨页一致)、toggleError
  一次性 SnackBar 消费
- 主壳/装配:openPost 按 postId push;create demo 流不再导航已退役的
  demo 详情(发布页真实化留 T3-17);AppState 在 post_detail/Feed 面
  消费清零
- compose 冒烟(env 门控默认跳过):真链路发帖/点赞幂等/收藏/评论/
  删评一轮 + 断网点赞回滚(生产 ApiClient 异常链)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-09 13:39:10 +08:00
parent 92524da8e2
commit f873acf9a3
10 changed files with 2160 additions and 249 deletions
+77 -15
View File
@@ -76,13 +76,15 @@ Map<String, dynamic> sampleFeedCardJson({
Map<String, dynamic> sampleCommentJson({
String id = 'c-1',
Map<String, dynamic>? author,
Map<String, dynamic>? replyToUser,
String content = '好可爱!',
}) => {
'id': id,
'postId': 'p-1',
'author': sampleAuthorJson(),
'author': author ?? sampleAuthorJson(),
'replyToUser': replyToUser,
'content': '好可爱!',
'content': content,
'createdAt': '2026-09-08T11:00:00.000Z',
};
@@ -131,6 +133,42 @@ CursorPage<FeedCard> feedPage(
bool hasMore = false,
}) => CursorPage(items: items, nextCursor: nextCursor, hasMore: hasMore);
Post samplePost({
String id = 'p-1',
bool likedByMe = false,
int likeCount = 6,
bool bookmarkedByMe = false,
int bookmarkCount = 2,
}) => Post.fromJson(
samplePostJson(
id: id,
likedByMe: likedByMe,
likeCount: likeCount,
bookmarkedByMe: bookmarkedByMe,
bookmarkCount: bookmarkCount,
),
);
PostComment sampleComment({
String id = 'c-1',
Map<String, dynamic>? author,
Map<String, dynamic>? replyToUser,
String content = '好可爱!',
}) => PostComment.fromJson(
sampleCommentJson(
id: id,
author: author,
replyToUser: replyToUser,
content: content,
),
);
CursorPage<PostComment> commentPage(
List<PostComment> items, {
String? nextCursor,
bool hasMore = false,
}) => CursorPage(items: items, nextCursor: nextCursor, hasMore: hasMore);
/// 假仓库:controller 测试注入行为并记录调用(Completer 控时序)。
/// 未注入 handler 的方法一律 UnimplementedError(误触发即测试失败)。
class FakeCommunityRepository implements CommunityRepository {
@@ -141,6 +179,13 @@ class FakeCommunityRepository implements CommunityRepository {
Future<LikeState> Function(String postId, bool target)? onLikeToggle;
Future<BookmarkState> Function(String postId, bool target)? onBookmarkToggle;
Future<Post> Function(String postId)? onGetPost;
Future<CursorPage<PostComment>> Function(String postId, String? cursor)?
onListComments;
Future<PostComment> Function(String postId, CreateCommentRequest request)?
onCreateComment;
Future<void> Function(String commentId)? onDeleteComment;
Future<FollowState> Function(String userId, bool target)? onFollowToggle;
Future<FollowStats> Function(String userId)? onGetFollowStats;
Future<MediaUploadCredentials> Function(CreateMediaUploadRequest request)?
onCreateMediaUpload;
Future<MediaAsset> Function(String assetId)? onCompleteMediaUpload;
@@ -218,28 +263,45 @@ class FakeCommunityRepository implements CommunityRepository {
String postId, {
int? limit,
String? cursor,
}) => throw UnimplementedError();
}) {
calls.add('comments:$postId:cursor=$cursor');
return onListComments!(postId, cursor);
}
@override
Future<PostComment> createComment(
String postId,
CreateCommentRequest request,
) => throw UnimplementedError();
) {
calls.add('createComment:$postId:${request.content}');
return onCreateComment!(postId, request);
}
@override
Future<void> deleteComment(String commentId) => throw UnimplementedError();
Future<void> deleteComment(String commentId) {
calls.add('deleteComment:$commentId');
return onDeleteComment!(commentId);
}
@override
Future<FollowState> followUser(String userId) {
calls.add('follow:$userId');
return onFollowToggle!(userId, true);
}
@override
Future<FollowState> unfollowUser(String userId) {
calls.add('unfollow:$userId');
return onFollowToggle!(userId, false);
}
@override
Future<FollowStats> getFollowStats(String userId) {
calls.add('followStats:$userId');
return onGetFollowStats!(userId);
}
@override
Future<CursorPage<FeedCard>> listMyBookmarks({int? limit, String? cursor}) =>
throw UnimplementedError();
@override
Future<FollowState> followUser(String userId) => throw UnimplementedError();
@override
Future<FollowState> unfollowUser(String userId) => throw UnimplementedError();
@override
Future<FollowStats> getFollowStats(String userId) =>
throw UnimplementedError();
}