opt change episode

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-08-05 19:56:22 +08:00
parent 170b2aa6d9
commit 80a4c8c24d
10 changed files with 79 additions and 81 deletions

View File

@@ -76,6 +76,7 @@ class _LaterViewChildPageState extends State<LaterViewChildPage>
}
var videoItem = response[index];
return VideoCardHLater(
index: index,
videoItem: videoItem,
ctr: _laterController,
onViewLater: (cid) {
@@ -97,12 +98,6 @@ class _LaterViewChildPageState extends State<LaterViewChildPage>
},
);
},
onRemove: () => _laterController.toViewDel(
context,
index,
videoItem.aid,
onSuccess: () => _laterController.updateLength?.call(1),
),
);
},
childCount: response!.length,

View File

@@ -22,7 +22,7 @@ mixin BaseLaterController
CommonListController<LaterData, LaterItemModel>,
CommonMultiSelectMixin<LaterItemModel>,
DeleteItemMixin<LaterData, LaterItemModel> {
ValueChanged<int>? updateLength;
ValueChanged<int>? updateCount;
@override
void onRemove() {
@@ -37,7 +37,7 @@ mixin BaseLaterController
aids: removeList.map((item) => item.aid).join(','),
);
if (res['status']) {
updateLength?.call(removeList.length);
updateCount?.call(removeList.length);
afterDelete(removeList);
}
SmartDialog.dismiss();
@@ -50,9 +50,8 @@ mixin BaseLaterController
void toViewDel(
BuildContext context,
int index,
int? aid, {
VoidCallback? onSuccess,
}) {
int? aid,
) {
showDialog(
context: context,
builder: (context) {
@@ -75,7 +74,7 @@ mixin BaseLaterController
loadingState
..value.data!.removeAt(index)
..refresh();
onSuccess?.call();
updateCount?.call(1);
}
SmartDialog.showToast(res['msg']);
},
@@ -169,9 +168,6 @@ class LaterController extends MultiSelectController<LaterData, LaterItemModel>
if (item.cid == null || item.pgcLabel?.isNotEmpty == true) {
continue;
} else {
if (item.bvid != list.first.bvid) {
SmartDialog.showToast('已跳过不支持播放的视频');
}
PageUtils.toVideoPage(
bvid: item.bvid,
cid: item.cid!,
@@ -192,7 +188,7 @@ class LaterController extends MultiSelectController<LaterData, LaterItemModel>
}
@override
ValueChanged<int>? get updateLength =>
ValueChanged<int>? get updateCount =>
(count) => baseCtr.counts[laterViewType] =
baseCtr.counts[laterViewType]! - count;

View File

@@ -21,14 +21,14 @@ class VideoCardHLater extends StatelessWidget {
const VideoCardHLater({
super.key,
required this.ctr,
required this.index,
required this.videoItem,
this.onViewLater,
required this.onRemove,
required this.onViewLater,
});
final int index;
final BaseLaterController ctr;
final LaterItemModel videoItem;
final ValueChanged<int>? onViewLater;
final VoidCallback onRemove;
final ValueChanged<int> onViewLater;
@override
Widget build(BuildContext context) {
@@ -72,7 +72,7 @@ class VideoCardHLater extends StatelessWidget {
bvid: videoItem.bvid,
);
if (cid != null) {
onViewLater!(cid);
onViewLater(cid);
}
} catch (err) {
SmartDialog.showToast(err.toString());
@@ -192,7 +192,7 @@ class VideoCardHLater extends StatelessWidget {
iconButton(
tooltip: '移除',
context: context,
onPressed: onRemove,
onPressed: () => ctr..toViewDel(context, index, videoItem.aid),
icon: Icons.clear,
iconColor: theme.colorScheme.outline,
bgColor: Colors.transparent,