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