mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: multi select
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -27,7 +27,7 @@ class HotVideoItemModel {
|
|||||||
this.seasontype,
|
this.seasontype,
|
||||||
this.isOgv,
|
this.isOgv,
|
||||||
this.rcmdReason,
|
this.rcmdReason,
|
||||||
required this.checked,
|
this.checked,
|
||||||
this.pgcLabel,
|
this.pgcLabel,
|
||||||
this.redirectUrl,
|
this.redirectUrl,
|
||||||
});
|
});
|
||||||
@@ -57,7 +57,7 @@ class HotVideoItemModel {
|
|||||||
int? seasontype;
|
int? seasontype;
|
||||||
bool? isOgv;
|
bool? isOgv;
|
||||||
RcmdReason? rcmdReason;
|
RcmdReason? rcmdReason;
|
||||||
late bool checked;
|
bool? checked;
|
||||||
String? pgcLabel;
|
String? pgcLabel;
|
||||||
String? redirectUrl;
|
String? redirectUrl;
|
||||||
|
|
||||||
@@ -89,7 +89,6 @@ class HotVideoItemModel {
|
|||||||
rcmdReason = json['rcmd_reason'] != '' && json['rcmd_reason'] != null
|
rcmdReason = json['rcmd_reason'] != '' && json['rcmd_reason'] != null
|
||||||
? RcmdReason.fromJson(json['rcmd_reason'])
|
? RcmdReason.fromJson(json['rcmd_reason'])
|
||||||
: null;
|
: null;
|
||||||
checked = false;
|
|
||||||
pgcLabel = json['pgc_label'];
|
pgcLabel = json['pgc_label'];
|
||||||
redirectUrl = json['redirect_url'];
|
redirectUrl = json['redirect_url'];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class FavDetailItemData {
|
|||||||
this.stat,
|
this.stat,
|
||||||
this.cid,
|
this.cid,
|
||||||
this.epId,
|
this.epId,
|
||||||
required this.checked,
|
this.checked,
|
||||||
});
|
});
|
||||||
|
|
||||||
int? id;
|
int? id;
|
||||||
@@ -70,7 +70,7 @@ class FavDetailItemData {
|
|||||||
Stat? stat;
|
Stat? stat;
|
||||||
int? cid;
|
int? cid;
|
||||||
String? epId;
|
String? epId;
|
||||||
late bool checked;
|
bool? checked;
|
||||||
|
|
||||||
FavDetailItemData.fromJson(Map<String, dynamic> json) {
|
FavDetailItemData.fromJson(Map<String, dynamic> json) {
|
||||||
id = json['id'];
|
id = json['id'];
|
||||||
@@ -95,7 +95,6 @@ class FavDetailItemData {
|
|||||||
if (json['link'] != null && json['link'].contains('/bangumi')) {
|
if (json['link'] != null && json['link'].contains('/bangumi')) {
|
||||||
epId = resolveEpId(json['link']);
|
epId = resolveEpId(json['link']);
|
||||||
}
|
}
|
||||||
checked = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String resolveEpId(url) {
|
String resolveEpId(url) {
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class HisListItem {
|
|||||||
this.kid,
|
this.kid,
|
||||||
this.tagName,
|
this.tagName,
|
||||||
this.liveStatus,
|
this.liveStatus,
|
||||||
required this.checked,
|
this.checked,
|
||||||
});
|
});
|
||||||
|
|
||||||
String? title;
|
String? title;
|
||||||
@@ -112,7 +112,7 @@ class HisListItem {
|
|||||||
int? kid;
|
int? kid;
|
||||||
String? tagName;
|
String? tagName;
|
||||||
int? liveStatus;
|
int? liveStatus;
|
||||||
late bool checked;
|
bool? checked;
|
||||||
void isFullScreen;
|
void isFullScreen;
|
||||||
|
|
||||||
HisListItem.fromJson(Map<String, dynamic> json) {
|
HisListItem.fromJson(Map<String, dynamic> json) {
|
||||||
@@ -140,7 +140,6 @@ class HisListItem {
|
|||||||
kid = json['kid'];
|
kid = json['kid'];
|
||||||
tagName = json['tag_name'];
|
tagName = json['tag_name'];
|
||||||
liveStatus = json['live_status'];
|
liveStatus = json['live_status'];
|
||||||
checked = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ abstract class MultiSelectController extends CommonController {
|
|||||||
|
|
||||||
onSelect(int index) {
|
onSelect(int index) {
|
||||||
List list = (loadingState.value as Success).response;
|
List list = (loadingState.value as Success).response;
|
||||||
list[index].checked = !list[index].checked;
|
list[index].checked = !(list[index]?.checked ?? false);
|
||||||
checkedCount.value = list.where((item) => item.checked).length;
|
checkedCount.value = list.where((item) => item.checked == true).length;
|
||||||
loadingState.value = LoadingState.success(list);
|
loadingState.value = LoadingState.success(list);
|
||||||
if (checkedCount.value == 0) {
|
if (checkedCount.value == 0) {
|
||||||
enableMultiSelect.value = false;
|
enableMultiSelect.value = false;
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class FavDetailController extends MultiSelectController {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Get.back();
|
Get.back();
|
||||||
List list = ((loadingState.value as Success).response as List)
|
List list = ((loadingState.value as Success).response as List)
|
||||||
.where((e) => e.checked)
|
.where((e) => e.checked == true)
|
||||||
.toList();
|
.toList();
|
||||||
dynamic result = await VideoHttp.delFav(
|
dynamic result = await VideoHttp.delFav(
|
||||||
ids: list.map((item) => '${item.id}:${item.type}').toList(),
|
ids: list.map((item) => '${item.id}:${item.type}').toList(),
|
||||||
|
|||||||
@@ -365,9 +365,10 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
|||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, constraints) =>
|
builder: (context, constraints) =>
|
||||||
AnimatedOpacity(
|
AnimatedOpacity(
|
||||||
opacity: loadingState.response[index].checked
|
opacity:
|
||||||
? 1
|
loadingState.response[index].checked == true
|
||||||
: 0,
|
? 1
|
||||||
|
: 0,
|
||||||
duration: const Duration(milliseconds: 200),
|
duration: const Duration(milliseconds: 200),
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
@@ -382,10 +383,11 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
|||||||
width: 34,
|
width: 34,
|
||||||
height: 34,
|
height: 34,
|
||||||
child: AnimatedScale(
|
child: AnimatedScale(
|
||||||
scale:
|
scale: loadingState
|
||||||
loadingState.response[index].checked
|
.response[index].checked ==
|
||||||
? 1
|
true
|
||||||
: 0,
|
? 1
|
||||||
|
: 0,
|
||||||
duration:
|
duration:
|
||||||
const Duration(milliseconds: 250),
|
const Duration(milliseconds: 250),
|
||||||
curve: Curves.easeInOut,
|
curve: Curves.easeInOut,
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ class HistoryController extends MultiSelectController {
|
|||||||
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)
|
||||||
.where((e) => e.checked)
|
.where((e) => e.checked == true)
|
||||||
.toList());
|
.toList());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ class HistoryItem extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
Positioned.fill(
|
Positioned.fill(
|
||||||
child: AnimatedOpacity(
|
child: AnimatedOpacity(
|
||||||
opacity: videoItem.checked ? 1 : 0,
|
opacity: videoItem.checked == true ? 1 : 0,
|
||||||
duration: const Duration(milliseconds: 200),
|
duration: const Duration(milliseconds: 200),
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
@@ -238,7 +238,7 @@ class HistoryItem extends StatelessWidget {
|
|||||||
width: 34,
|
width: 34,
|
||||||
height: 34,
|
height: 34,
|
||||||
child: AnimatedScale(
|
child: AnimatedScale(
|
||||||
scale: videoItem.checked ? 1 : 0,
|
scale: videoItem.checked == true ? 1 : 0,
|
||||||
duration: const Duration(milliseconds: 250),
|
duration: const Duration(milliseconds: 250),
|
||||||
curve: Curves.easeInOut,
|
curve: Curves.easeInOut,
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ class LaterController extends MultiSelectController {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Get.back();
|
Get.back();
|
||||||
_onDelete(((loadingState.value as Success).response as List)
|
_onDelete(((loadingState.value as Success).response as List)
|
||||||
.where((e) => e.checked)
|
.where((e) => e.checked == true)
|
||||||
.toList());
|
.toList());
|
||||||
},
|
},
|
||||||
child: const Text('确认'),
|
child: const Text('确认'),
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ class _LaterPageState extends State<LaterPage> {
|
|||||||
child: IgnorePointer(
|
child: IgnorePointer(
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, constraints) => AnimatedOpacity(
|
builder: (context, constraints) => AnimatedOpacity(
|
||||||
opacity: videoItem.checked ? 1 : 0,
|
opacity: videoItem.checked == true ? 1 : 0,
|
||||||
duration: const Duration(milliseconds: 200),
|
duration: const Duration(milliseconds: 200),
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
@@ -187,7 +187,7 @@ class _LaterPageState extends State<LaterPage> {
|
|||||||
width: 34,
|
width: 34,
|
||||||
height: 34,
|
height: 34,
|
||||||
child: AnimatedScale(
|
child: AnimatedScale(
|
||||||
scale: videoItem.checked ? 1 : 0,
|
scale: videoItem.checked == true ? 1 : 0,
|
||||||
duration: const Duration(milliseconds: 250),
|
duration: const Duration(milliseconds: 250),
|
||||||
curve: Curves.easeInOut,
|
curve: Curves.easeInOut,
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
|
|||||||
Reference in New Issue
Block a user