feat(library): 收藏与观看记录直接进入播放页
This commit is contained in:
1 parent
ecdff54f2e
commit
8b53adc2be
5 files changed
+140
-10
No files matched your search
@@ -19,7 +19,7 @@ import '../../core/widgets/empty_state.dart';
|
||||
import '../../core/widgets/remote_image.dart';
|
||||
import '../../core/widgets/subpage_header.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import '../drama_detail/drama_detail_view.dart';
|
||||
import '../player/open_player.dart';
|
||||
import 'favorites_binding.dart';
|
||||
|
||||
const double _pageHorizontal = 14;
|
||||
@@ -194,9 +194,7 @@ class _FavoritesBody extends StatelessWidget {
|
||||
}
|
||||
|
||||
Future<void> _open(BuildContext context, Drama drama) async {
|
||||
await Navigator.of(context).push<void>(
|
||||
MaterialPageRoute(builder: (_) => DramaDetailPage(drama: drama)),
|
||||
);
|
||||
await playDramaFromCatalog(context, drama);
|
||||
}
|
||||
|
||||
Future<void> _remove(BuildContext context, String dramaId) async {
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../core/data/models/drama.dart';
|
||||
import '../../core/data/models/watch_record.dart';
|
||||
import '../../core/data/repositories/catalog_repository.dart';
|
||||
import '../../core/data/repositories/watch_history_repository.dart';
|
||||
import '../../core/data/services/auth_controller.dart';
|
||||
@@ -19,7 +19,7 @@ import '../../core/widgets/auth_gate.dart';
|
||||
import '../../core/widgets/empty_state.dart';
|
||||
import '../../core/widgets/subpage_header.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import '../drama_detail/drama_detail_view.dart';
|
||||
import '../player/open_player.dart';
|
||||
import 'watch_records_binding.dart';
|
||||
import 'widgets/watch_record_card.dart';
|
||||
|
||||
@@ -138,7 +138,7 @@ class _WatchRecordsBodyState extends State<_WatchRecordsBody> {
|
||||
record: record,
|
||||
onRetry: () => controller.retryDetail(record.dramaId),
|
||||
onRemove: () => _remove(record.dramaId),
|
||||
onOpen: record.drama == null ? null : () => _open(record.drama!),
|
||||
onOpen: record.drama == null ? null : () => _open(record),
|
||||
),
|
||||
],
|
||||
],
|
||||
@@ -191,9 +191,12 @@ class _WatchRecordsBodyState extends State<_WatchRecordsBody> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _open(Drama drama) async {
|
||||
await Navigator.of(context).push<void>(
|
||||
MaterialPageRoute(builder: (_) => DramaDetailPage(drama: drama)),
|
||||
Future<void> _open(WatchRecord record) async {
|
||||
final episodeId = record.progress.episodeId;
|
||||
await playDramaFromCatalog(
|
||||
context,
|
||||
record.drama!,
|
||||
episodeId: episodeId.isEmpty ? null : episodeId,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user