opt: LoadingState (#1776)

This commit is contained in:
My-Responsitories
2025-12-13 12:43:32 +08:00
committed by GitHub
parent 3741fe54ff
commit 17883eb77e
82 changed files with 832 additions and 887 deletions

View File

@@ -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();
}
}
}

View File

@@ -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(