feat(player): 剧名与选集合并为同一个弹窗
点剧名默认停在详情页签,选集入口直接停在选集页签,不再跳详情页; 详情页签补上简介、标签、收藏与相似推荐,原选集弹窗合并进来后删除。
This commit is contained in:
1 parent
ad7aba3daf
commit
79463e65c2
4 files changed
+596
-174
No files matched your search
@@ -35,12 +35,11 @@ import '../../core/theme/app_colors.dart';
|
||||
import '../../core/navigation/fade_page_route.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import '../discover/search_page.dart';
|
||||
import '../drama_detail/drama_detail_view.dart';
|
||||
import '../mine/mine_types.dart';
|
||||
import '../mine/mine_view.dart';
|
||||
import 'player_view.dart';
|
||||
import 'widgets/drama_comments_sheet.dart';
|
||||
import 'widgets/episode_picker_sheet.dart';
|
||||
import 'widgets/drama_info_sheet.dart';
|
||||
|
||||
typedef _PlaybackSnapshot = ({
|
||||
Duration position,
|
||||
@@ -1294,10 +1293,7 @@ class PlayerLogic extends ChangeNotifier {
|
||||
}
|
||||
// 上一条进度写盘与续看点拉取互不依赖,并行等,少一个网络往返的首帧延迟。
|
||||
// 服务端每剧只记一条:只有"记录里的那一集"才定位,其它集从头播
|
||||
await Future.wait([
|
||||
pendingWrite,
|
||||
if (!resumeLoaded) loadResumePoint(),
|
||||
]);
|
||||
await Future.wait([pendingWrite, if (!resumeLoaded) loadResumePoint()]);
|
||||
if (resumePositionFor(episode.id) == null) {
|
||||
final dramaId = _dramaIdForEpisode(episode.id);
|
||||
final cached = dramaId == null
|
||||
@@ -1836,22 +1832,9 @@ class PlayerLogic extends ChangeNotifier {
|
||||
if (context.mounted) Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
Future<void> openDetail(BuildContext context) async {
|
||||
session.setOverlayOpen(true);
|
||||
await saveCurrentProgress();
|
||||
try {
|
||||
if (!context.mounted) return;
|
||||
await Navigator.of(context).push(
|
||||
FadePageRoute<void>(
|
||||
builder: (_) =>
|
||||
DramaDetailPage(drama: queue.entryAt(session.currentIndex).drama),
|
||||
),
|
||||
);
|
||||
} finally {
|
||||
session.setOverlayOpen(false);
|
||||
}
|
||||
await saveCurrentProgress();
|
||||
}
|
||||
/// 剧名与选集共用同一个弹窗:点剧名默认停在详情页签。
|
||||
Future<void> openDetail(BuildContext context) =>
|
||||
_showDramaSheet(context, DramaInfoTab.detail);
|
||||
|
||||
String? _dramaIdForEpisode(String episodeId) {
|
||||
for (final entry in queue.entries) {
|
||||
@@ -1887,13 +1870,21 @@ class PlayerLogic extends ChangeNotifier {
|
||||
await resumeAfterFullPlayer();
|
||||
}
|
||||
|
||||
Future<void> showEpisodes(BuildContext context) async {
|
||||
/// 选集入口:同一个弹窗,直接停在选集页签。
|
||||
Future<void> showEpisodes(BuildContext context) =>
|
||||
_showDramaSheet(context, DramaInfoTab.episodes);
|
||||
|
||||
Future<void> _showDramaSheet(
|
||||
BuildContext context,
|
||||
DramaInfoTab initialTab,
|
||||
) async {
|
||||
final entry = queue.entryAt(session.currentIndex);
|
||||
final drama = await _withFullEpisodes(context, entry.drama);
|
||||
if (!context.mounted) return;
|
||||
final homeFeed = feedDramas != null;
|
||||
final currentNumber = entry.episode.number;
|
||||
session.setOverlayOpen(true);
|
||||
await saveCurrentProgress();
|
||||
await session.playbackSettled;
|
||||
if (!context.mounted) {
|
||||
session.setOverlayOpen(false);
|
||||
@@ -1904,16 +1895,20 @@ class PlayerLogic extends ChangeNotifier {
|
||||
context: context,
|
||||
backgroundColor: AppColors.transparent,
|
||||
isScrollControlled: true,
|
||||
builder: (_) => EpisodePickerSheet(
|
||||
builder: (_) => DramaInfoSheet(
|
||||
drama: drama,
|
||||
currentNumber: currentNumber,
|
||||
onSelect: (index) =>
|
||||
initialTab: initialTab,
|
||||
onSelectEpisode: (index) =>
|
||||
_selectFromSheet(context, drama, index, homeFeed, currentNumber),
|
||||
onOpenRelated: (related) =>
|
||||
unawaited(openSeriesAt(context, related, 0)),
|
||||
),
|
||||
);
|
||||
} finally {
|
||||
session.setOverlayOpen(false);
|
||||
}
|
||||
await saveCurrentProgress();
|
||||
}
|
||||
|
||||
/// 列表卡片只带一集可播预览,需要完整剧集时补一次详情;
|
||||
|
||||
Reference in new issue
Block a user