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