feat(app): 展示真实点赞与评论计数

This commit is contained in:
Zhou Weidong committed 2026-10-19 23:56:12 +08:00
1 parent 7b927c794e
commit dfc650456a
9 files changed
+123 -8

No files matched your search

+11 -3
View File
@@ -337,6 +337,7 @@ class _PlayerPageState extends State<PlayerPage> with WidgetsBindingObserver {
drama: drama,
episode: episode,
liked: interactions.isLiked(drama.id),
likeCount: interactions.likeCount(drama.id),
saved: context.watch<FavoriteController>().isSaved(drama.id),
onLike: () async {
if (await ensureSignedIn(context)) {
@@ -388,6 +389,7 @@ class _PlayerPageState extends State<PlayerPage> with WidgetsBindingObserver {
episode: episode,
controller: ready ? videoPort!.controller : null,
liked: interactions.isLiked(drama.id),
likeCount: interactions.likeCount(drama.id),
// 收藏以服务端为准(FavoriteController 由 app 注入,登录后自动加载)
saved: context.watch<FavoriteController>().isSaved(drama.id),
onBack: widget.embedded
@@ -506,9 +508,7 @@ class _PlayerPageState extends State<PlayerPage> with WidgetsBindingObserver {
final l10n = AppLocalizations.of(context)!;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
errorText(l10n, logic.unlockError, l10n.unlockFailed),
),
content: Text(errorText(l10n, logic.unlockError, l10n.unlockFailed)),
),
);
}
@@ -688,6 +688,7 @@ class _PlaybackOverlay extends StatefulWidget {
required this.episode,
required this.controller,
required this.liked,
this.likeCount,
required this.saved,
required this.playing,
required this.playbackSpeed,
@@ -714,6 +715,7 @@ class _PlaybackOverlay extends StatefulWidget {
final Episode episode;
final VideoPlayerController? controller;
final bool liked;
final int? likeCount;
final bool saved;
final bool playing;
final double playbackSpeed;
@@ -985,6 +987,12 @@ class _PlaybackOverlayState extends State<_PlaybackOverlay> {
color: widget.liked ? AppColors.blue : AppColors.muted,
),
title: Text(widget.l10n.like),
trailing: widget.likeCount == null
? null
: Text(
'${widget.likeCount}',
key: const Key('player-more-like-count'),
),
onTap: () {
Navigator.pop(sheetContext);
widget.onLike();