mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-31 08:08:19 +08:00
opt: use cascade (#812)
This commit is contained in:
committed by
GitHub
parent
877732e1e7
commit
6f69a45195
@@ -30,8 +30,7 @@ class FavArticleController extends CommonListController {
|
||||
Future<void> onRemove(index, id) async {
|
||||
final res = await UserHttp.communityAction(opusId: id, action: 4);
|
||||
if (res['status']) {
|
||||
List list = (loadingState.value as Success).response;
|
||||
list.removeAt(index);
|
||||
loadingState.value.data!.removeAt(index);
|
||||
loadingState.refresh();
|
||||
SmartDialog.showToast('已取消收藏');
|
||||
} else {
|
||||
|
||||
@@ -57,9 +57,7 @@ class FavPgcController
|
||||
Future bangumiDel(index, seasonId) async {
|
||||
var result = await VideoHttp.bangumiDel(seasonId: seasonId);
|
||||
if (result['status']) {
|
||||
List<BangumiListItemModel> list =
|
||||
(loadingState.value as Success).response;
|
||||
list.removeAt(index);
|
||||
loadingState.value.data!.removeAt(index);
|
||||
loadingState.refresh();
|
||||
}
|
||||
SmartDialog.showToast(result['msg']);
|
||||
@@ -82,9 +80,8 @@ class FavPgcController
|
||||
try {
|
||||
final ctr = Get.find<FavPgcController>(tag: '$type$followStatus');
|
||||
if (ctr.loadingState.value is Success) {
|
||||
List<BangumiListItemModel> list =
|
||||
(ctr.loadingState.value as Success).response;
|
||||
list.insertAll(0, updateList.map((item) => item..checked = null));
|
||||
ctr.loadingState.value.data!
|
||||
.insertAll(0, updateList.map((item) => item..checked = null));
|
||||
ctr.loadingState.refresh();
|
||||
ctr.allSelected.value = false;
|
||||
}
|
||||
@@ -108,9 +105,7 @@ class FavPgcController
|
||||
try {
|
||||
final ctr = Get.find<FavPgcController>(tag: '$type$followStatus');
|
||||
if (ctr.loadingState.value is Success) {
|
||||
List<BangumiListItemModel> list =
|
||||
(ctr.loadingState.value as Success).response;
|
||||
list.insert(0, item);
|
||||
ctr.loadingState.value.data!.insert(0, item);
|
||||
ctr.loadingState.refresh();
|
||||
ctr.allSelected.value = false;
|
||||
}
|
||||
|
||||
@@ -85,10 +85,7 @@ class _FavVideoPageState extends State<FavVideoPage>
|
||||
},
|
||||
);
|
||||
if (res == true) {
|
||||
List<FavFolderItemData> list =
|
||||
(_favController.loadingState.value as Success)
|
||||
.response;
|
||||
list.removeAt(index);
|
||||
_favController.loadingState.value.data!.removeAt(index);
|
||||
_favController.loadingState.refresh();
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user