mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-31 08:08:19 +08:00
opt handle res
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -38,7 +38,7 @@ class HistoryController extends MultiSelectController<HistoryData, HisListItem>
|
||||
|
||||
@override
|
||||
void onSelect(int index, [bool disableSelect = true]) {
|
||||
List<HisListItem> list = (loadingState.value as Success).response;
|
||||
List<HisListItem> list = loadingState.value.data!;
|
||||
list[index].checked = !(list[index].checked ?? false);
|
||||
baseCtr.checkedCount.value =
|
||||
list.where((item) => item.checked == true).length;
|
||||
@@ -50,8 +50,8 @@ class HistoryController extends MultiSelectController<HistoryData, HisListItem>
|
||||
|
||||
@override
|
||||
void handleSelect([bool checked = false, bool disableSelect = true]) {
|
||||
if (loadingState.value is Success) {
|
||||
List<HisListItem>? list = (loadingState.value as Success).response;
|
||||
if (loadingState.value.isSuccess) {
|
||||
List<HisListItem>? list = loadingState.value.data;
|
||||
if (list?.isNotEmpty == true) {
|
||||
for (HisListItem item in list!) {
|
||||
item.checked = checked;
|
||||
@@ -108,11 +108,9 @@ class HistoryController extends MultiSelectController<HistoryData, HisListItem>
|
||||
|
||||
// 删除已看历史记录
|
||||
void onDelHistory() {
|
||||
if (loadingState.value is Success) {
|
||||
if (loadingState.value.isSuccess) {
|
||||
List<HisListItem> list =
|
||||
((loadingState.value as Success).response as List<HisListItem>)
|
||||
.where((e) => e.progress == -1)
|
||||
.toList();
|
||||
loadingState.value.data!.where((e) => e.progress == -1).toList();
|
||||
if (list.isNotEmpty) {
|
||||
_onDelete(list);
|
||||
} else {
|
||||
@@ -126,13 +124,10 @@ class HistoryController extends MultiSelectController<HistoryData, HisListItem>
|
||||
List<String> kidList = result.map((item) {
|
||||
return '${item.history.business}_${item.kid}';
|
||||
}).toList();
|
||||
dynamic response = await UserHttp.delHistory(kidList);
|
||||
var response = await UserHttp.delHistory(kidList);
|
||||
if (response['status']) {
|
||||
List<HisListItem> remainList =
|
||||
((loadingState.value as Success).response as List<HisListItem>)
|
||||
.toSet()
|
||||
.difference(result.toSet())
|
||||
.toList();
|
||||
loadingState.value.data!.toSet().difference(result.toSet()).toList();
|
||||
if (remainList.isNotEmpty) {
|
||||
loadingState.value = Success(remainList);
|
||||
} else {
|
||||
@@ -168,9 +163,8 @@ class HistoryController extends MultiSelectController<HistoryData, HisListItem>
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
if (loadingState.value is Success) {
|
||||
_onDelete(((loadingState.value as Success).response
|
||||
as List<HisListItem>)
|
||||
if (loadingState.value.isSuccess) {
|
||||
_onDelete(loadingState.value.data!
|
||||
.where((e) => e.checked == true)
|
||||
.toList());
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@ import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/models/common/history_business_type.dart';
|
||||
import 'package:PiliPlus/models/user/history.dart';
|
||||
import 'package:PiliPlus/models/video_detail/data.dart';
|
||||
import 'package:PiliPlus/pages/common/multi_select_controller.dart';
|
||||
import 'package:PiliPlus/pages/history/base_controller.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
@@ -70,8 +70,9 @@ class HistoryItem extends StatelessWidget {
|
||||
if (bvid != null && bvid != '') {
|
||||
var result = await VideoHttp.videoIntro(bvid: bvid);
|
||||
if (result['status']) {
|
||||
String bvid = result['data'].bvid!;
|
||||
var epid = result['data'].epId;
|
||||
VideoDetailData data = result['data'];
|
||||
String bvid = data.bvid!;
|
||||
var epid = data.epId;
|
||||
if (epid != null) {
|
||||
PageUtils.viewBangumi(epId: epid);
|
||||
} else {
|
||||
@@ -140,9 +141,9 @@ class HistoryItem extends StatelessWidget {
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
src: (videoItem.cover.isNullOrEmpty
|
||||
? videoItem.covers?.firstOrNull ?? ''
|
||||
: videoItem.cover),
|
||||
src: videoItem.cover?.isNotEmpty == true
|
||||
? videoItem.cover
|
||||
: videoItem.covers?.firstOrNull ?? '',
|
||||
width: maxWidth,
|
||||
height: maxHeight,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user