3.8 KiB
3.8 KiB
[已处理] 2026-10-20 | K42-A 收藏页/观看历史页 UI 重做 + 观看历史刷新卡 loading 修复(仅 App 端)
用户指令(2026-10-20,原文):
「现在改收藏页和观看历史页面 ui 重新做 观看历史页面下拉刷新后一直loading修复下」
一、观看历史「一直 loading」根因与修复(必须先修)
lib/core/data/services/watch_records_controller.dart:
load()每次都用_uniqueRecords()重建列表,新记录不带 drama 且 detailLoading 默认为 true;_hydrate()会跳过_detailCache已存在的 id,导致刷新后这些行既没有 drama、也不会再被 hydrate → 卡片一直转圈(首次进入正常,第二次下拉刷新必现)。- 修复:
_uniqueRecords()直接回填缓存:命中_detailCache的记录带drama且detailLoading: false;未命中才为 true;_hydrate()中缓存命中的 id 也要回填到当前 records(不能只跳过);- 刷新失败保留旧
records,只在列表为空时展示整页错误; - 刷新期间不清空列表、不整页 loading。
- 新增测试:连续两次
load()(第二次详情已缓存)后所有记录detailLoading == false且drama != null。
二、观看历史页 UI 重做(lib/pages/watch_records/watch_records_page.dart)
- 改用统一二级页头:
AppSubpageHeader(title: l10n.watchHistory),返回 Keywatch-records-back;页面 Keywatch-records-page;去掉PlainPageScaffold。 - 顶部统计行:左侧「共 N 条」(12 号 muted),右侧「清空」文字按钮(图标 delete_sweep + 主色字,Key
watch-records-clear)。 - 列表卡片重做(Key
watch-record-<id>保留):- 白卡、圆角 14、阴影
AppTheme.cardShadow、内边距 10; - 封面 72×96 圆角 10;标题 15 w700
AppColors.onSurface(修复原白色不可见)、最多 2 行; - 集数 12 muted;进度条 4px 圆角、主题色、底色
AppColors.border; - 进度文案
x:xx / y:yy11 muted;更新时间 11 subtle(有值才显示); - 右上角 28 圆形浅灰删除按钮(Key
watch-record-remove-<id>保留)。
- 白卡、圆角 14、阴影
- 下拉刷新改为紧凑样式:20px、
strokeWidth 2、主题色,RefreshIndicator(color: AppColors.blue, backgroundColor: AppColors.card, strokeWidth: 2);列表保持AlwaysScrollableScrollPhysics,空列表也能下拉。 - 空态/错误态沿用
EmptyState,Key 不变。
三、收藏页 UI 重做(lib/pages/favorites/favorites_page.dart)
- 改用统一二级页头:
AppSubpageHeader(title: l10n.myFavorites),返回 Keyfavorites-back,页面 Keyfavorites-page。 - 顶部统计行:「共 N 部」(12 muted)+ 右侧弱化提示「长按卡片可取消收藏」11 subtle。
- 卡片替换为自定义
_FavoriteCard(Keyfavorite-card-<id>保留):- 白卡圆角 14、阴影、内边距 10;封面 80×106 圆角 10;右上角实心粉色爱心按钮 28(Key
favorite-remove-<id>保留,点击取消收藏 + 轻震动); - 右侧:标题 15 w700 onSurface 最多 2 行、题材标签 1 行(最多 2 个灰底 11 号)、底部火焰 +
formatInteractionCount(viewCount)+ 共 N 集; - 点击进详情页。
- 白卡圆角 14、阴影、内边距 10;封面 80×106 圆角 10;右上角实心粉色爱心按钮 28(Key
- 下拉刷新同为紧凑样式;空态/错误态 Key 不变。
测试/门禁
- 控制器:二次刷新后无残留 detailLoading;
- 两页:页头 Key、统计文案、卡片标题为
AppColors.onSurface、删除按钮可点击; dart analyze lib test零告警 +flutter test全过 +flutter build apk --debug。
流程:从 develop 拉 feature/flutter-k42-library-pages;作者 Zhou Weidong <502333560@qq.com>;--no-ff 合回 develop 并 push;PROGRESS 留痕;真机验收由用户执行。