mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: specify list type
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -296,9 +296,7 @@ class UserHttp {
|
||||
}
|
||||
|
||||
// 移除已观看
|
||||
static Future toViewDel({
|
||||
List? aids,
|
||||
}) async {
|
||||
static Future toViewDel({List<int?>? aids}) async {
|
||||
final Map<String, dynamic> params = {
|
||||
'jsonp': 'jsonp',
|
||||
'csrf': await Request.getCsrf(),
|
||||
@@ -352,7 +350,7 @@ class UserHttp {
|
||||
}
|
||||
|
||||
// 删除历史记录
|
||||
static Future delHistory(List kidList) async {
|
||||
static Future delHistory(List<String> kidList) async {
|
||||
var res = await Request().post(
|
||||
Api.delHistory,
|
||||
data: {
|
||||
|
||||
@@ -219,8 +219,8 @@ class BangumiIntroController
|
||||
return;
|
||||
}
|
||||
|
||||
List addMediaIdsNew = [];
|
||||
List delMediaIdsNew = [];
|
||||
List<int?> addMediaIdsNew = [];
|
||||
List<int?> delMediaIdsNew = [];
|
||||
try {
|
||||
for (var i in favFolderData.value.list!.toList()) {
|
||||
bool isFaved = favIds?.contains(i.id) == true;
|
||||
|
||||
@@ -167,8 +167,14 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
|
||||
if (widget.tabType == TabType.bangumi) {
|
||||
Get.to(PgcIndexPage());
|
||||
} else {
|
||||
List titles = const ['全部', '电影', '电视剧', '纪录片', '综艺'];
|
||||
List types = const [102, 2, 5, 3, 7];
|
||||
List<String> titles = const [
|
||||
'全部',
|
||||
'电影',
|
||||
'电视剧',
|
||||
'纪录片',
|
||||
'综艺',
|
||||
];
|
||||
List<int> types = const [102, 2, 5, 3, 7];
|
||||
Get.to(
|
||||
Scaffold(
|
||||
appBar: AppBar(title: const Text('索引')),
|
||||
|
||||
@@ -40,7 +40,7 @@ abstract class CommonController<R, T> extends GetxController
|
||||
|
||||
Future<LoadingState<R>> customGetData();
|
||||
|
||||
void handleListResponse(List dataList) {}
|
||||
void handleListResponse(List<T> dataList) {}
|
||||
|
||||
bool customHandleResponse(bool isRefresh, Success<R> response) {
|
||||
return false;
|
||||
|
||||
@@ -105,7 +105,8 @@ class FavDetailController
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
List list = ((loadingState.value as Success).response as List)
|
||||
List<FavDetailItemData> list = ((loadingState.value as Success)
|
||||
.response as List<FavDetailItemData>)
|
||||
.where((e) => e.checked == true)
|
||||
.toList();
|
||||
dynamic result = await VideoHttp.delFav(
|
||||
|
||||
@@ -102,18 +102,17 @@ class HistoryController extends MultiSelectController<HistoryData, HisListItem>
|
||||
}
|
||||
|
||||
// 删除某条历史记录
|
||||
Future delHistory(kid, business) async {
|
||||
_onDelete(((loadingState.value as Success).response as List)
|
||||
.where((e) => e.kid == kid)
|
||||
.toList());
|
||||
Future delHistory(HisListItem item) async {
|
||||
_onDelete([item]);
|
||||
}
|
||||
|
||||
// 删除已看历史记录
|
||||
void onDelHistory() {
|
||||
if (loadingState.value is Success) {
|
||||
List list = ((loadingState.value as Success).response as List)
|
||||
.where((e) => e.progress == -1)
|
||||
.toList();
|
||||
List<HisListItem> list =
|
||||
((loadingState.value as Success).response as List<HisListItem>)
|
||||
.where((e) => e.progress == -1)
|
||||
.toList();
|
||||
if (list.isNotEmpty) {
|
||||
_onDelete(list);
|
||||
} else {
|
||||
@@ -122,10 +121,10 @@ class HistoryController extends MultiSelectController<HistoryData, HisListItem>
|
||||
}
|
||||
}
|
||||
|
||||
void _onDelete(List result) async {
|
||||
void _onDelete(List<HisListItem> result) async {
|
||||
SmartDialog.showLoading(msg: '请求中');
|
||||
List kidList = result.map((item) {
|
||||
return '${item.history?.business}_${item.kid}';
|
||||
List<String> kidList = result.map((item) {
|
||||
return '${item.history.business}_${item.kid}';
|
||||
}).toList();
|
||||
dynamic response = await UserHttp.delHistory(kidList);
|
||||
if (response['status']) {
|
||||
@@ -170,7 +169,8 @@ class HistoryController extends MultiSelectController<HistoryData, HisListItem>
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
if (loadingState.value is Success) {
|
||||
_onDelete(((loadingState.value as Success).response as List)
|
||||
_onDelete(((loadingState.value as Success).response
|
||||
as List<HisListItem>)
|
||||
.where((e) => e.checked == true)
|
||||
.toList());
|
||||
}
|
||||
|
||||
@@ -294,12 +294,13 @@ class _HistoryPageState extends State<HistoryPage>
|
||||
if (index == loadingState.response!.length - 1) {
|
||||
_historyController.onLoadMore();
|
||||
}
|
||||
final item = loadingState.response![index];
|
||||
return HistoryItem(
|
||||
videoItem: loadingState.response![index],
|
||||
videoItem: item,
|
||||
ctr: _historyController.baseCtr,
|
||||
onChoose: () => _historyController.onSelect(index),
|
||||
onDelete: (kid, business) =>
|
||||
_historyController.delHistory(kid, business),
|
||||
_historyController.delHistory(item),
|
||||
);
|
||||
},
|
||||
childCount: loadingState.response!.length,
|
||||
|
||||
@@ -120,7 +120,8 @@ class LaterController extends MultiSelectController<Map, HotVideoItemModel> {
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
_onDelete(((loadingState.value as Success).response as List)
|
||||
_onDelete(((loadingState.value as Success).response
|
||||
as List<HotVideoItemModel>)
|
||||
.where((e) => e.checked == true)
|
||||
.toList());
|
||||
},
|
||||
@@ -132,9 +133,9 @@ class LaterController extends MultiSelectController<Map, HotVideoItemModel> {
|
||||
);
|
||||
}
|
||||
|
||||
void _onDelete(List result) async {
|
||||
void _onDelete(List<HotVideoItemModel> result) async {
|
||||
SmartDialog.showLoading(msg: '请求中');
|
||||
List aids = result.map((item) => item.aid).toList();
|
||||
List<int?> aids = result.map((item) => item.aid).toList();
|
||||
dynamic res = await UserHttp.toViewDel(aids: aids);
|
||||
if (res['status']) {
|
||||
Set<HotVideoItemModel> remainList =
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:async';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/pages/common/common_page.dart';
|
||||
import 'package:PiliPlus/pages/main/controller.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
||||
@@ -176,9 +177,11 @@ class _MediaPageState extends CommonPageState<MediaPage, MediaController>
|
||||
|
||||
Widget _buildBody(LoadingState loadingState) {
|
||||
if (loadingState is Success) {
|
||||
List favFolderList = loadingState.response.list;
|
||||
int favFolderCount = loadingState.response.count;
|
||||
bool flag = favFolderCount > favFolderList.length;
|
||||
List<FavFolderItemData>? favFolderList = loadingState.response.list;
|
||||
if (favFolderList.isNullOrEmpty) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
bool flag = controller.count.value > favFolderList!.length;
|
||||
return ListView.builder(
|
||||
itemCount: loadingState.response.list.length + (flag ? 1 : 0),
|
||||
itemBuilder: (context, index) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:PiliPlus/common/widgets/http_error.dart';
|
||||
import 'package:PiliPlus/models/member/seasons.dart';
|
||||
import 'package:easy_debounce/easy_throttle.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -71,7 +72,8 @@ class _MemberSeasonsPageState extends State<MemberSeasonsPage> {
|
||||
);
|
||||
}
|
||||
Map data = snapshot.data as Map;
|
||||
List list = _memberSeasonsController.seasonsList;
|
||||
List<MemberArchiveItem> list =
|
||||
_memberSeasonsController.seasonsList;
|
||||
if (data['status']) {
|
||||
return Obx(
|
||||
() => list.isNotEmpty
|
||||
|
||||
@@ -17,11 +17,11 @@ class SysMsgController
|
||||
}
|
||||
|
||||
@override
|
||||
void handleListResponse(List dataList) {
|
||||
void handleListResponse(List<SystemNotifyList> dataList) {
|
||||
if (cursor == -1) {
|
||||
msgSysUpdateCursor(dataList.first?.cursor);
|
||||
msgSysUpdateCursor(dataList.first.cursor);
|
||||
}
|
||||
cursor = dataList.last?.cursor ?? -1;
|
||||
cursor = dataList.last.cursor ?? -1;
|
||||
if (isEnd.not && dataList.length + 1 < pageSize) {
|
||||
isEnd = true;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class PlaySpeedPage extends StatefulWidget {
|
||||
class _PlaySpeedPageState extends State<PlaySpeedPage> {
|
||||
late double playSpeedDefault;
|
||||
late double longPressSpeedDefault;
|
||||
late List speedList;
|
||||
late List<double> speedList;
|
||||
late bool enableAutoLongPressSpeed;
|
||||
List<Map<dynamic, dynamic>> sheetMenu = [
|
||||
{
|
||||
@@ -115,7 +115,7 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
|
||||
SmartDialog.showToast('该倍速已存在');
|
||||
} else {
|
||||
Get.back();
|
||||
speedList.add(customSpeed);
|
||||
speedList.add(customSpeed!);
|
||||
speedList.sort();
|
||||
await video.put(VideoBoxKey.speedsList, speedList);
|
||||
setState(() {});
|
||||
|
||||
@@ -597,7 +597,7 @@ List<SettingsModel> get styleSettings => [
|
||||
leading: const Icon(Icons.chrome_reader_mode_outlined),
|
||||
onTap: (setState) {
|
||||
final numberRegExp = RegExp(r'[\d\.]+');
|
||||
List springDescription =
|
||||
List<String> springDescription =
|
||||
GStorage.springDescription.map((i) => i.toString()).toList();
|
||||
showDialog(
|
||||
context: Get.context!,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:PiliPlus/common/constants.dart';
|
||||
import 'package:PiliPlus/models/user/sub_detail.dart';
|
||||
import 'package:PiliPlus/utils/grid.dart';
|
||||
import 'package:easy_debounce/easy_throttle.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -215,7 +216,8 @@ class _SubDetailPageState extends State<SubDetailPage> {
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
List subList = _subDetailController.subList;
|
||||
List<SubDetailMediaItem> subList =
|
||||
_subDetailController.subList;
|
||||
return Obx(
|
||||
() => subList.isEmpty
|
||||
? const SliverToBoxAdapter(child: SizedBox())
|
||||
|
||||
@@ -398,8 +398,8 @@ class VideoIntroController extends GetxController
|
||||
return;
|
||||
}
|
||||
|
||||
List addMediaIdsNew = [];
|
||||
List delMediaIdsNew = [];
|
||||
List<int?> addMediaIdsNew = [];
|
||||
List<int?> delMediaIdsNew = [];
|
||||
try {
|
||||
for (var i in favFolderData.value.list!.toList()) {
|
||||
bool isFaved = favIds?.contains(i.id) == true;
|
||||
|
||||
@@ -113,7 +113,7 @@ class _PayCoinsPageState extends State<PayCoinsPage>
|
||||
late AnimationController _coinFadeController;
|
||||
late AnimationController _boxAnimController;
|
||||
|
||||
final List _images = [
|
||||
final List<String> _images = [
|
||||
'assets/images/paycoins/ic_thunder_1.png',
|
||||
'assets/images/paycoins/ic_thunder_2.png',
|
||||
'assets/images/paycoins/ic_thunder_3.png',
|
||||
|
||||
@@ -352,10 +352,11 @@ class _VideoReplyReplyPanelState
|
||||
if (res != null) {
|
||||
_savedReplies[key] = null;
|
||||
ReplyInfo replyInfo = Utils.replyCast(res);
|
||||
List list = _videoReplyReplyController.loadingState.value is Success
|
||||
? (_videoReplyReplyController.loadingState.value as Success)
|
||||
.response
|
||||
: <ReplyInfo>[];
|
||||
List<ReplyInfo> list =
|
||||
_videoReplyReplyController.loadingState.value is Success
|
||||
? (_videoReplyReplyController.loadingState.value as Success)
|
||||
.response
|
||||
: <ReplyInfo>[];
|
||||
list.insert(index + 1, replyInfo);
|
||||
_videoReplyReplyController.count.value += 1;
|
||||
_videoReplyReplyController.loadingState.refresh();
|
||||
|
||||
@@ -137,13 +137,12 @@ class WhisperController extends GetxController {
|
||||
return res;
|
||||
}
|
||||
|
||||
Future queryAccountList(sessionList) async {
|
||||
List midsList = sessionList.map((e) => e.talkerId!).toList();
|
||||
Future queryAccountList(List<SessionList> sessionList) async {
|
||||
List<int?> midsList = sessionList.map((e) => e.talkerId).toList();
|
||||
var res = await MsgHttp.accountList(midsList.join(','));
|
||||
if (res['status']) {
|
||||
accountList.value = res['data'];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
Future onLoad() async {
|
||||
|
||||
Reference in New Issue
Block a user