mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-30 23:58:13 +08:00
opt play all
Closes #1383 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -85,6 +85,8 @@ class FavDetailController
|
|||||||
|
|
||||||
AccountService accountService = Get.find<AccountService>();
|
AccountService accountService = Get.find<AccountService>();
|
||||||
|
|
||||||
|
late final RxBool isPlayAll = true.obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
@@ -206,16 +208,18 @@ class FavDetailController
|
|||||||
cid: item.ugc!.firstCid!,
|
cid: item.ugc!.firstCid!,
|
||||||
cover: item.cover,
|
cover: item.cover,
|
||||||
title: item.title,
|
title: item.title,
|
||||||
extraArguments: {
|
extraArguments: isPlayAll.value
|
||||||
'sourceType': SourceType.fav,
|
? {
|
||||||
'mediaId': folder.id,
|
'sourceType': SourceType.fav,
|
||||||
'oid': item.id,
|
'mediaId': folder.id,
|
||||||
'favTitle': folder.title,
|
'oid': item.id,
|
||||||
'count': folder.mediaCount,
|
'favTitle': folder.title,
|
||||||
'desc': true,
|
'count': folder.mediaCount,
|
||||||
if (index != null) 'isContinuePlaying': index != 0,
|
'desc': true,
|
||||||
'isOwner': isOwner,
|
if (index != null) 'isContinuePlaying': index != 0,
|
||||||
},
|
'isOwner': isOwner,
|
||||||
|
}
|
||||||
|
: null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,10 +60,27 @@ class _FavDetailPageState extends State<FavDetailPage> with GridMixin {
|
|||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
floatingActionButton: Obx(
|
floatingActionButton: Obx(
|
||||||
() => _favDetailController.folderInfo.value.mediaCount > 0
|
() => _favDetailController.folderInfo.value.mediaCount > 0
|
||||||
? FloatingActionButton.extended(
|
? AnimatedSlide(
|
||||||
onPressed: _favDetailController.toViewPlayAll,
|
offset: _favDetailController.isPlayAll.value
|
||||||
label: const Text('播放全部'),
|
? Offset.zero
|
||||||
icon: const Icon(Icons.playlist_play),
|
: const Offset(0.75, 0),
|
||||||
|
duration: const Duration(milliseconds: 120),
|
||||||
|
child: GestureDetector(
|
||||||
|
onHorizontalDragUpdate: (details) =>
|
||||||
|
_favDetailController.isPlayAll.value =
|
||||||
|
details.delta.dx < 0,
|
||||||
|
child: FloatingActionButton.extended(
|
||||||
|
onPressed: () {
|
||||||
|
if (_favDetailController.isPlayAll.value) {
|
||||||
|
_favDetailController.toViewPlayAll();
|
||||||
|
} else {
|
||||||
|
_favDetailController.isPlayAll.value = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
label: const Text('播放全部'),
|
||||||
|
icon: const Icon(Icons.playlist_play),
|
||||||
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: const SizedBox.shrink(),
|
: const SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -8,4 +8,6 @@ class LaterBaseController extends GetxController {
|
|||||||
RxMap<LaterViewType, int> counts = {
|
RxMap<LaterViewType, int> counts = {
|
||||||
for (final item in LaterViewType.values) item: -1,
|
for (final item in LaterViewType.values) item: -1,
|
||||||
}.obs;
|
}.obs;
|
||||||
|
|
||||||
|
late final RxBool isPlayAll = true.obs;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ import 'package:PiliPlus/http/loading_state.dart';
|
|||||||
import 'package:PiliPlus/models/common/later_view_type.dart';
|
import 'package:PiliPlus/models/common/later_view_type.dart';
|
||||||
import 'package:PiliPlus/models/common/video/source_type.dart';
|
import 'package:PiliPlus/models/common/video/source_type.dart';
|
||||||
import 'package:PiliPlus/models_new/later/list.dart';
|
import 'package:PiliPlus/models_new/later/list.dart';
|
||||||
|
import 'package:PiliPlus/pages/later/base_controller.dart';
|
||||||
import 'package:PiliPlus/pages/later/controller.dart';
|
import 'package:PiliPlus/pages/later/controller.dart';
|
||||||
import 'package:PiliPlus/pages/later/widgets/video_card_h_later.dart';
|
import 'package:PiliPlus/pages/later/widgets/video_card_h_later.dart';
|
||||||
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
import 'package:PiliPlus/utils/grid.dart';
|
import 'package:PiliPlus/utils/grid.dart';
|
||||||
import 'package:PiliPlus/utils/page_utils.dart';
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -29,6 +31,7 @@ class _LaterViewChildPageState extends State<LaterViewChildPage>
|
|||||||
LaterController(widget.laterViewType),
|
LaterController(widget.laterViewType),
|
||||||
tag: widget.laterViewType.type.toString(),
|
tag: widget.laterViewType.type.toString(),
|
||||||
);
|
);
|
||||||
|
late final _baseCtr = Get.putOrFind(LaterBaseController.new);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -75,17 +78,19 @@ class _LaterViewChildPageState extends State<LaterViewChildPage>
|
|||||||
cid: cid,
|
cid: cid,
|
||||||
cover: videoItem.pic,
|
cover: videoItem.pic,
|
||||||
title: videoItem.title,
|
title: videoItem.title,
|
||||||
extraArguments: {
|
extraArguments: _baseCtr.isPlayAll.value
|
||||||
'oid': videoItem.aid,
|
? {
|
||||||
'sourceType': SourceType.watchLater,
|
'oid': videoItem.aid,
|
||||||
'count': _laterController
|
'sourceType': SourceType.watchLater,
|
||||||
.baseCtr
|
'count': _laterController
|
||||||
.counts[LaterViewType.all],
|
.baseCtr
|
||||||
'favTitle': '稍后再看',
|
.counts[LaterViewType.all],
|
||||||
'mediaId': _laterController.accountService.mid,
|
'favTitle': '稍后再看',
|
||||||
'desc': false,
|
'mediaId': _laterController.accountService.mid,
|
||||||
'isContinuePlaying': index != 0,
|
'desc': false,
|
||||||
},
|
'isContinuePlaying': index != 0,
|
||||||
|
}
|
||||||
|
: null,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -73,10 +73,26 @@ class _LaterPageState extends State<LaterPage>
|
|||||||
appBar: _buildAppbar(enableMultiSelect),
|
appBar: _buildAppbar(enableMultiSelect),
|
||||||
floatingActionButton: Obx(
|
floatingActionButton: Obx(
|
||||||
() => currCtr().loadingState.value.isSuccess
|
() => currCtr().loadingState.value.isSuccess
|
||||||
? FloatingActionButton.extended(
|
? AnimatedSlide(
|
||||||
onPressed: currCtr().toViewPlayAll,
|
offset: _baseCtr.isPlayAll.value
|
||||||
label: const Text('播放全部'),
|
? Offset.zero
|
||||||
icon: const Icon(Icons.playlist_play),
|
: const Offset(0.75, 0),
|
||||||
|
duration: const Duration(milliseconds: 120),
|
||||||
|
child: GestureDetector(
|
||||||
|
onHorizontalDragUpdate: (details) =>
|
||||||
|
_baseCtr.isPlayAll.value = details.delta.dx < 0,
|
||||||
|
child: FloatingActionButton.extended(
|
||||||
|
onPressed: () {
|
||||||
|
if (_baseCtr.isPlayAll.value) {
|
||||||
|
currCtr().toViewPlayAll();
|
||||||
|
} else {
|
||||||
|
_baseCtr.isPlayAll.value = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
label: const Text('播放全部'),
|
||||||
|
icon: const Icon(Icons.playlist_play),
|
||||||
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: const SizedBox.shrink(),
|
: const SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user