mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-30 23:58:13 +08:00
opt handle res
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -35,7 +35,7 @@ class FavNoteController
|
||||
}
|
||||
|
||||
Future<void> onRemove() async {
|
||||
List<FavNoteModel> dataList = (loadingState.value as Success).response;
|
||||
List<FavNoteModel> dataList = loadingState.value.data!;
|
||||
Set<FavNoteModel> removeList =
|
||||
dataList.where((item) => item.checked == true).toSet();
|
||||
final res = await VideoHttp.delNote(
|
||||
|
||||
@@ -76,7 +76,7 @@ class _FavNotePageState extends State<FavNotePage>
|
||||
// TextButton(
|
||||
// style: TextButton.styleFrom(
|
||||
// foregroundColor: theme.colorScheme.onSurfaceVariant,
|
||||
// visualDensity: const VisualDensity(horizontal: -2, vertical: -2),
|
||||
// visualDensity: VisualDensity.compact,
|
||||
// tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
// ),
|
||||
// onPressed: () async {
|
||||
@@ -85,10 +85,8 @@ class _FavNotePageState extends State<FavNotePage>
|
||||
// if (favNoteController.enableMultiSelect.value) {
|
||||
// favNoteController.onDisable();
|
||||
// } else {
|
||||
// if (favNoteController.loadingState.value is Success &&
|
||||
// ((favNoteController.loadingState.value as Success)
|
||||
// .response as List?)
|
||||
// ?.isNotEmpty ==
|
||||
// if (favNoteController.loadingState.value.isSuccess &&
|
||||
// favNoteController.loadingState.value.data?.isNotEmpty ==
|
||||
// true) {
|
||||
// favNoteController.enableMultiSelect.value = true;
|
||||
// }
|
||||
|
||||
@@ -65,8 +65,7 @@ class FavPgcController
|
||||
}
|
||||
|
||||
Future<void> onUpdateList(followStatus) async {
|
||||
List<BangumiListItemModel> dataList =
|
||||
(loadingState.value as Success).response as List<BangumiListItemModel>;
|
||||
List<BangumiListItemModel> dataList = loadingState.value.data!;
|
||||
Set<BangumiListItemModel> updateList =
|
||||
dataList.where((item) => item.checked == true).toSet();
|
||||
final res = await VideoHttp.bangumiUpdate(
|
||||
@@ -80,7 +79,7 @@ class FavPgcController
|
||||
enableMultiSelect.value = false;
|
||||
try {
|
||||
final ctr = Get.find<FavPgcController>(tag: '$type$followStatus');
|
||||
if (ctr.loadingState.value is Success) {
|
||||
if (ctr.loadingState.value.isSuccess) {
|
||||
ctr.loadingState.value.data!
|
||||
.insertAll(0, updateList.map((item) => item..checked = null));
|
||||
ctr.loadingState.refresh();
|
||||
@@ -99,13 +98,12 @@ class FavPgcController
|
||||
status: followStatus,
|
||||
);
|
||||
if (result['status']) {
|
||||
List<BangumiListItemModel> list =
|
||||
(loadingState.value as Success).response;
|
||||
List<BangumiListItemModel> list = loadingState.value.data!;
|
||||
final item = list.removeAt(index);
|
||||
loadingState.refresh();
|
||||
try {
|
||||
final ctr = Get.find<FavPgcController>(tag: '$type$followStatus');
|
||||
if (ctr.loadingState.value is Success) {
|
||||
if (ctr.loadingState.value.isSuccess) {
|
||||
ctr.loadingState.value.data!.insert(0, item);
|
||||
ctr.loadingState.refresh();
|
||||
ctr.allSelected.value = false;
|
||||
|
||||
@@ -74,7 +74,7 @@ class _FavVideoPageState extends State<FavVideoPage>
|
||||
heroTag: heroTag,
|
||||
favFolderItem: item,
|
||||
onTap: () async {
|
||||
dynamic res = await Get.toNamed(
|
||||
var res = await Get.toNamed(
|
||||
'/favDetail',
|
||||
arguments: item,
|
||||
parameters: {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models/common/fav_type.dart';
|
||||
import 'package:PiliPlus/models/user/fav_folder.dart';
|
||||
import 'package:PiliPlus/pages/fav/article/controller.dart';
|
||||
@@ -60,11 +59,10 @@ class _FavPageState extends State<FavPage> with SingleTickerProviderStateMixin {
|
||||
onPressed: () => Get.toNamed('/createFav')?.then(
|
||||
(data) {
|
||||
if (data != null) {
|
||||
List<FavFolderItemData> list = _favController
|
||||
.loadingState.value is Success
|
||||
? (_favController.loadingState.value as Success)
|
||||
.response
|
||||
: <FavFolderItemData>[];
|
||||
List<FavFolderItemData> list =
|
||||
_favController.loadingState.value.isSuccess
|
||||
? _favController.loadingState.value.data!
|
||||
: <FavFolderItemData>[];
|
||||
list.insert(list.isNotEmpty ? 1 : 0, data);
|
||||
_favController.loadingState.refresh();
|
||||
}
|
||||
@@ -94,12 +92,10 @@ class _FavPageState extends State<FavPage> with SingleTickerProviderStateMixin {
|
||||
() => _showVideoFavMenu.value
|
||||
? IconButton(
|
||||
onPressed: () {
|
||||
if (_favController.loadingState.value is Success) {
|
||||
if (_favController.loadingState.value.isSuccess) {
|
||||
try {
|
||||
final item =
|
||||
(_favController.loadingState.value as Success)
|
||||
.response
|
||||
.first;
|
||||
_favController.loadingState.value.data!.first;
|
||||
Get.toNamed(
|
||||
'/favSearch',
|
||||
arguments: {
|
||||
|
||||
Reference in New Issue
Block a user