feat: play all member archives

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-12-27 12:50:11 +08:00
parent 329eb31387
commit 64672dbdf9
9 changed files with 190 additions and 129 deletions

View File

@@ -244,11 +244,16 @@ class VideoDetailController extends GetxController
}
// 页面来源 稍后再看 收藏夹
RxString sourceType = 'normal'.obs;
String sourceType = 'normal';
late RxList<MediaVideoItemModel> mediaList = <MediaVideoItemModel>[].obs;
late RxString watchLaterTitle = ''.obs;
bool get isPlayAll =>
sourceType.value == 'watchLater' || sourceType.value == 'fav';
late String watchLaterTitle = '';
bool get isPlayAll => ['watchLater', 'fav', 'archive'].contains(sourceType);
int get _mediaType => switch (sourceType) {
'archive' => 1,
'watchLater' => 2,
'fav' => 3,
_ => -1,
};
@override
void onInit() {
@@ -258,23 +263,24 @@ class VideoDetailController extends GetxController
if (keys.isNotEmpty) {
if (keys.contains('videoItem')) {
var args = Get.arguments['videoItem'];
if (args.pic != null && args.pic != '') {
videoItem['pic'] = args.pic;
}
try {
if (args.pic != null && args.pic != '') {
videoItem['pic'] = args.pic;
} else if (args.cover != null && args.cover != '') {
videoItem['pic'] = args.cover;
}
} catch (_) {}
}
if (keys.contains('pic')) {
videoItem['pic'] = Get.arguments['pic'];
}
}
sourceType.value = Get.arguments['sourceType'] ?? 'normal';
sourceType = Get.arguments['sourceType'] ?? 'normal';
if (sourceType.value == 'watchLater') {
watchLaterTitle.value = '稍后再看';
fetchMediaList();
} else if (sourceType.value == 'fav') {
watchLaterTitle.value = Get.arguments['favTitle'];
queryFavVideoList();
if (sourceType != 'normal') {
watchLaterTitle = Get.arguments['favTitle'];
getMediaList();
}
bool defaultShowComment =
@@ -322,31 +328,17 @@ class VideoDetailController extends GetxController
}
}
// 获取稍后再看列表
Future fetchMediaList() async {
var count = Get.arguments['count'];
var res = await UserHttp.getMediaList(
type: 2,
bizId: userInfo.mid,
ps: count,
);
if (res['status']) {
mediaList = res['data'].reversed.toList();
} else {
SmartDialog.showToast(res['msg']);
}
}
void loadMoreMedia() async {
void getMediaList() async {
if (mediaList.length >= Get.arguments['count']) {
return;
}
var res = await UserHttp.getMediaList(
type: 3,
type: _mediaType,
bizId: Get.arguments['mediaId'] ?? -1,
ps: 20,
oid: mediaList.last.id,
otype: mediaList.last.type ?? 2,
oid: mediaList.isEmpty ? null : mediaList.last.id,
otype: mediaList.isEmpty ? null : mediaList.last.type,
desc: _mediaType == 2 ? false : true,
);
if (res['status']) {
if (res['data'].isNotEmpty) {
@@ -364,10 +356,10 @@ class VideoDetailController extends GetxController
(context) => MediaListPanel(
mediaList: mediaList,
changeMediaList: changeMediaList,
panelTitle: watchLaterTitle.value,
panelTitle: watchLaterTitle,
bvid: bvid,
count: Get.arguments['count'],
loadMoreMedia: loadMoreMedia,
loadMoreMedia: getMediaList,
),
);
}
@@ -402,20 +394,6 @@ class VideoDetailController extends GetxController
} catch (_) {}
}
// 获取收藏夹视频列表
Future queryFavVideoList() async {
var mediaId = Get.arguments['mediaId'];
var oid = Get.arguments['oid'];
var res = await UserHttp.parseFavVideo(
mediaId: mediaId,
oid: oid,
bvid: bvid,
);
if (res['status']) {
mediaList.value = res['data'];
}
}
int? _lastPos;
double? _blockLimit;
List<Pair<SegmentType, SkipType>>? _blockSettings;

View File

@@ -95,7 +95,13 @@ class VideoIntroController extends GetxController
preRender = true;
var args = Get.arguments['videoItem'];
var keys = Get.arguments.keys.toList();
videoItem!['pic'] = args.pic;
try {
if (args.pic != null && args.pic != '') {
videoItem!['pic'] = args.pic;
} else if (args.cover != null && args.cover != '') {
videoItem!['pic'] = args.cover;
}
} catch (_) {}
if (args.title is String) {
videoItem!['title'] = args.title;
} else {
@@ -693,7 +699,7 @@ class VideoIntroController extends GetxController
if (videoDetailController.isPlayAll &&
currentIndex == episodes.length - 2) {
videoDetailCtr.loadMoreMedia();
videoDetailCtr.getMediaList();
}
// 列表循环

View File

@@ -1415,46 +1415,44 @@ class _VideoDetailPageState extends State<VideoDetailPage>
return Stack(
children: [
introPanel(),
Obx(
() => AnimatedPositioned(
duration: const Duration(milliseconds: 400),
curve: Curves.easeInOut,
left: 12,
right: 12,
bottom: MediaQuery.of(context).padding.bottom + 12,
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: videoDetailController.showMediaListPanel,
borderRadius: const BorderRadius.all(Radius.circular(14)),
child: Container(
height: 54,
padding: const EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
.secondaryContainer
.withOpacity(0.95),
borderRadius: const BorderRadius.all(Radius.circular(14)),
),
child: Row(
children: [
const Icon(Icons.playlist_play, size: 24),
const SizedBox(width: 10),
Text(
videoDetailController.watchLaterTitle.value,
style: TextStyle(
color: Theme.of(context)
.colorScheme
.onSecondaryContainer,
fontWeight: FontWeight.bold,
letterSpacing: 0.2,
),
AnimatedPositioned(
duration: const Duration(milliseconds: 400),
curve: Curves.easeInOut,
left: 12,
right: 12,
bottom: MediaQuery.of(context).padding.bottom + 12,
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: videoDetailController.showMediaListPanel,
borderRadius: const BorderRadius.all(Radius.circular(14)),
child: Container(
height: 54,
padding: const EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
.secondaryContainer
.withOpacity(0.95),
borderRadius: const BorderRadius.all(Radius.circular(14)),
),
child: Row(
children: [
const Icon(Icons.playlist_play, size: 24),
const SizedBox(width: 10),
Text(
videoDetailController.watchLaterTitle,
style: TextStyle(
color: Theme.of(context)
.colorScheme
.onSecondaryContainer,
fontWeight: FontWeight.bold,
letterSpacing: 0.2,
),
const Spacer(),
const Icon(Icons.keyboard_arrow_up_rounded, size: 26),
],
),
),
const Spacer(),
const Icon(Icons.keyboard_arrow_up_rounded, size: 26),
],
),
),
),