fix(player): 修复首次双击点赞状态刷新

This commit is contained in:
Zhou Weidong committed 2026-10-26 19:17:14 +08:00
1 parent 978c309cd7
commit 1b50a73bfc
3 files changed
+165 -13

No files matched your search

+31
View File
@@ -519,9 +519,22 @@ class _PlayerPageState extends State<PlayerPage>
Episode episode,
) {
_lastDoubleTapAt = DateTime.now();
if (kDebugMode) {
debugPrint(
'[player-like] phase=double-tap-callback '
'episodeId=${episode.id} '
'busy=${interactions.isEpisodeBusy(episode.id)} '
'liked=${interactions.isEpisodeLiked(episode.id)}',
);
}
unawaited(_toggleLike(context, interactions, episode, likeOnly: true));
}
void _refreshLikeState() {
if (!mounted) return;
setState(() {});
}
/// 收藏状态确认后同步右侧计数(总数没有独立计数接口,按 ±1 跟随)。
void _applyFavoriteDelta(String dramaId, {required bool nowSaved}) {
setState(() {
@@ -978,6 +991,9 @@ class _PlayerPageState extends State<PlayerPage>
'index=$index top=1 rail=1 progress=1',
);
}
if (widget.homeMode && !_presentationActive && !theater) {
_logRailLikeState('home', episode.id, interactions);
}
return Stack(
fit: StackFit.expand,
@@ -1209,6 +1225,7 @@ class _PlayerPageState extends State<PlayerPage>
logic.session.preparedPlayerAt(index);
final videoPort = port is VideoPlayerPort ? port : null;
final videoReady = videoPort?.controller.value.isInitialized ?? false;
_logRailLikeState('player', episode.id, interactions);
return PlayerPlaybackOverlay(
data: PlayerOverlayData(
l10n: l10n,
@@ -1270,6 +1287,20 @@ class _PlayerPageState extends State<PlayerPage>
);
}
void _logRailLikeState(
String surface,
String episodeId,
InteractionController interactions,
) {
if (!kDebugMode) return;
debugPrint(
'[player-like] phase=rail-state surface=$surface '
'episodeId=$episodeId '
'liked=${interactions.isEpisodeLiked(episodeId)} '
'count=${interactions.episodeLikeCount(episodeId)}',
);
}
Future<void> _presentFullPlayer(BuildContext context, int index) async {
if (_presentationActive ||
_preparingFullPlayer ||