mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-10 03:57:49 +08:00
opt: multiSelect (#935)
This commit is contained in:
committed by
GitHub
parent
d246462535
commit
7b51f15753
@@ -128,8 +128,7 @@ class _FavPgcChildPageState extends State<FavPgcChildPage>
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
if (_favPgcController.checkedCount.value !=
|
||||
0) {
|
||||
if (_favPgcController.checkedCount != 0) {
|
||||
_favPgcController.onUpdateList(
|
||||
item.followStatus,
|
||||
);
|
||||
|
||||
@@ -48,7 +48,7 @@ class FavPgcController
|
||||
);
|
||||
|
||||
void onDisable() {
|
||||
if (checkedCount.value != 0) {
|
||||
if (checkedCount != 0) {
|
||||
handleSelect();
|
||||
}
|
||||
enableMultiSelect.value = false;
|
||||
@@ -65,22 +65,19 @@ class FavPgcController
|
||||
SmartDialog.showToast(result['msg']);
|
||||
}
|
||||
|
||||
@override
|
||||
void onConfirm() {
|
||||
assert(false, 'call onUpdateList');
|
||||
}
|
||||
|
||||
Future<void> onUpdateList(int followStatus) async {
|
||||
List<FavPgcItemModel> dataList = loadingState.value.data!;
|
||||
Set<FavPgcItemModel> updateList = dataList
|
||||
.where((item) => item.checked == true)
|
||||
.toSet();
|
||||
final updateList = allChecked.toSet();
|
||||
final res = await VideoHttp.pgcUpdate(
|
||||
seasonId: updateList.map((item) => item.seasonId).toList(),
|
||||
status: followStatus,
|
||||
);
|
||||
if (res['status']) {
|
||||
List<FavPgcItemModel> remainList = dataList
|
||||
.toSet()
|
||||
.difference(updateList)
|
||||
.toList();
|
||||
loadingState.value = Success(remainList);
|
||||
enableMultiSelect.value = false;
|
||||
afterDelete(updateList);
|
||||
try {
|
||||
final ctr = Get.find<FavPgcController>(tag: '$type$followStatus');
|
||||
if (ctr.loadingState.value.isSuccess) {
|
||||
|
||||
@@ -18,7 +18,7 @@ class FavPgcItem extends StatelessWidget {
|
||||
});
|
||||
|
||||
final FavPgcItemModel item;
|
||||
final MultiSelectController ctr;
|
||||
final MultiSelectMixin ctr;
|
||||
final VoidCallback onSelect;
|
||||
final VoidCallback onUpdateStatus;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user