mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-24 01:58:36 +00:00
opt: LoadingState (#1776)
This commit is contained in:
committed by
GitHub
parent
3741fe54ff
commit
17883eb77e
@@ -38,15 +38,15 @@ class FavTopicController
|
||||
Future<LoadingState<FavTopicData>> customGetData() =>
|
||||
FavHttp.favTopic(page: page);
|
||||
|
||||
Future<void> onRemove(int index, int? id) async {
|
||||
Future<void> onRemove(int index, int id) async {
|
||||
var res = await FavHttp.delFavTopic(id);
|
||||
if (res['status']) {
|
||||
if (res.isSuccess) {
|
||||
loadingState
|
||||
..value.data!.removeAt(index)
|
||||
..refresh();
|
||||
SmartDialog.showToast('已取消收藏');
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
res.toast();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ class _FavTopicPageState extends State<FavTopicPage>
|
||||
void onLongPress() => showConfirmDialog(
|
||||
context: context,
|
||||
title: '确定取消收藏?',
|
||||
onConfirm: () => _controller.onRemove(index, item.id),
|
||||
onConfirm: () => _controller.onRemove(index, item.id!),
|
||||
);
|
||||
|
||||
return Material(
|
||||
|
||||
Reference in New Issue
Block a user