feat: 稍后再看&收藏夹播放全部

This commit is contained in:
guozhigq
2024-09-21 15:14:38 +08:00
parent 3088fd599b
commit 3dcce42309
11 changed files with 859 additions and 18 deletions

View File

@ -6,6 +6,7 @@ import 'package:pilipala/http/user.dart';
import 'package:pilipala/models/model_hot_video_item.dart';
import 'package:pilipala/models/user/info.dart';
import 'package:pilipala/utils/storage.dart';
import 'package:pilipala/utils/utils.dart';
class LaterController extends GetxController {
final ScrollController scrollController = ScrollController();
@ -48,7 +49,7 @@ class LaterController extends GetxController {
aid != null ? '即将移除该视频,确定是否移除' : '即将删除所有已观看视频,此操作不可恢复。确定是否删除?'),
actions: [
TextButton(
onPressed: () => SmartDialog.dismiss(),
onPressed: SmartDialog.dismiss,
child: Text(
'取消',
style: TextStyle(color: Theme.of(context).colorScheme.outline),
@ -87,7 +88,7 @@ class LaterController extends GetxController {
content: const Text('确定要清空你的稍后再看列表吗?'),
actions: [
TextButton(
onPressed: () => SmartDialog.dismiss(),
onPressed: SmartDialog.dismiss,
child: Text(
'取消',
style: TextStyle(color: Theme.of(context).colorScheme.outline),
@ -109,4 +110,19 @@ class LaterController extends GetxController {
},
);
}
// 稍后再看播放全部
Future toViewPlayAll() async {
final HotVideoItemModel firstItem = laterList.first;
final String heroTag = Utils.makeHeroTag(firstItem.bvid);
Get.toNamed(
'/video?bvid=${firstItem.bvid}&cid=${firstItem.cid}',
arguments: {
'videoItem': firstItem,
'heroTag': heroTag,
'sourceType': 'watchLater',
'count': laterList.length,
},
);
}
}

View File

@ -128,6 +128,15 @@ class _LaterPageState extends State<LaterPage> {
)
],
),
floatingActionButton: Obx(
() => _laterController.laterList.isNotEmpty
? FloatingActionButton.extended(
onPressed: _laterController.toViewPlayAll,
label: const Text('播放全部'),
icon: const Icon(Icons.playlist_play),
)
: const SizedBox(),
),
);
}
}