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

Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
guozhigq
2024-09-21 15:14:38 +08:00
committed by bggRGjQaUbCoE
parent 47241897de
commit 9e8d34e0dc
13 changed files with 874 additions and 42 deletions

View File

@@ -1,6 +1,7 @@
import 'package:PiliPalaX/http/loading_state.dart';
import 'package:PiliPalaX/models/model_hot_video_item.dart';
import 'package:PiliPalaX/pages/common/multi_select_controller.dart';
import 'package:PiliPalaX/utils/utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
@@ -162,4 +163,22 @@ class LaterController extends MultiSelectController {
SmartDialog.dismiss();
SmartDialog.showToast(res['msg']);
}
// 稍后再看播放全部
Future toViewPlayAll() async {
if (loadingState.value is Success) {
final HotVideoItemModel firstItem =
(loadingState.value as Success).response.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': (loadingState.value as Success).response.length,
},
);
}
}
}

View File

@@ -95,6 +95,15 @@ class _LaterPageState extends State<LaterPage> {
],
),
),
floatingActionButton: Obx(
() => _laterController.loadingState.value is Success
? FloatingActionButton.extended(
onPressed: _laterController.toViewPlayAll,
label: const Text('播放全部'),
icon: const Icon(Icons.playlist_play),
)
: const SizedBox(),
),
body: CustomScrollView(
physics: const AlwaysScrollableScrollPhysics(),
controller: _laterController.scrollController,