Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-06-13 11:49:38 +08:00
parent f824477ddb
commit c05fbde3fa
106 changed files with 2780 additions and 3200 deletions

View File

@@ -90,6 +90,7 @@ class _MediaListPanelState
automaticallyImplyLeading: false,
titleSpacing: 16,
title: Text(widget.panelTitle ?? '稍后再看'),
backgroundColor: Colors.transparent,
actions: [
Obx(
() => mediumButton(
@@ -155,158 +156,163 @@ class _MediaListPanelState
final isCurr = item.bvid == widget.getBvId();
return SizedBox(
height: 98,
child: InkWell(
onTap: () async {
if (item.type != 2) {
SmartDialog.showToast('不支持播放该类型视频');
return;
}
Get.back();
String bvid = item.bvid!;
int? aid = item.aid;
String cover = item.cover ?? '';
final int? cid =
item.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
if (cid != null) {
widget.changeMediaList?.call(bvid, cid, aid, cover);
}
},
onLongPress: () => imageSaveDialog(
title: item.title,
cover: item.cover,
aid: item.aid,
bvid: item.bvid,
),
child: Stack(
clipBehavior: Clip.none,
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 5,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AspectRatio(
aspectRatio: StyleString.aspectRatio,
child: LayoutBuilder(
builder: (context, boxConstraints) {
return Stack(
clipBehavior: Clip.none,
children: [
NetworkImgLayer(
src: item.cover,
width: boxConstraints.maxWidth,
height: boxConstraints.maxHeight,
),
if (item.badge?.text?.isNotEmpty == true)
PBadge(
text: item.badge?.text,
right: 6.0,
top: 6.0,
type: switch (item.badge?.text) {
'充电专属' => PBadgeType.error,
_ => PBadgeType.primary,
},
child: Material(
type: MaterialType.transparency,
child: InkWell(
onTap: () async {
if (item.type != 2) {
SmartDialog.showToast('不支持播放该类型视频');
return;
}
Get.back();
String bvid = item.bvid!;
int? aid = item.aid;
String cover = item.cover ?? '';
final int? cid = item.cid ??
await SearchHttp.ab2c(aid: aid, bvid: bvid);
if (cid != null) {
widget.changeMediaList?.call(bvid, cid, aid, cover);
}
},
onLongPress: () => imageSaveDialog(
title: item.title,
cover: item.cover,
aid: item.aid,
bvid: item.bvid,
),
child: Stack(
clipBehavior: Clip.none,
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 5,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AspectRatio(
aspectRatio: StyleString.aspectRatio,
child: LayoutBuilder(
builder: (context, boxConstraints) {
return Stack(
clipBehavior: Clip.none,
children: [
NetworkImgLayer(
src: item.cover,
width: boxConstraints.maxWidth,
height: boxConstraints.maxHeight,
),
PBadge(
text: Utils.timeFormat(item.duration!),
right: 6.0,
bottom: 6.0,
type: PBadgeType.gray,
),
],
);
},
if (item.badge?.text?.isNotEmpty ==
true)
PBadge(
text: item.badge?.text,
right: 6.0,
top: 6.0,
type: switch (item.badge?.text) {
'充电专属' => PBadgeType.error,
_ => PBadgeType.primary,
},
),
PBadge(
text:
Utils.timeFormat(item.duration!),
right: 6.0,
bottom: 6.0,
type: PBadgeType.gray,
),
],
);
},
),
),
),
const SizedBox(width: 10),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
item.title!,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight:
isCurr ? FontWeight.bold : null,
color: isCurr
? theme.colorScheme.primary
: null,
),
),
if (item.type == 24 &&
item.intro?.isNotEmpty == true) ...[
const SizedBox(height: 3),
const SizedBox(width: 10),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
item.intro!,
item.title!,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13,
fontWeight:
isCurr ? FontWeight.bold : null,
color: isCurr
? theme.colorScheme.primary
: null,
),
),
if (item.type == 24 &&
item.intro?.isNotEmpty == true) ...[
const SizedBox(height: 3),
Text(
item.intro!,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13,
color: theme.colorScheme.outline,
),
),
],
const Spacer(),
Text(
item.upper!.name!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12,
color: theme.colorScheme.outline,
),
),
if (item.type == 2) ...[
const SizedBox(height: 3),
Row(
spacing: 8,
children: [
StatWidget(
type: StatType.play,
value: item.cntInfo!.play,
),
StatWidget(
type: StatType.danmaku,
value: item.cntInfo!.danmaku,
),
],
),
],
],
const Spacer(),
Text(
item.upper!.name!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12,
color: theme.colorScheme.outline,
),
),
if (item.type == 2) ...[
const SizedBox(height: 3),
Row(
spacing: 8,
children: [
StatWidget(
type: StatType.play,
value: item.cntInfo!.play,
),
StatWidget(
type: StatType.danmaku,
value: item.cntInfo!.danmaku,
),
],
),
],
],
),
),
),
],
],
),
),
),
if (showDelBtn && !isCurr)
Positioned(
right: 12,
bottom: -6,
child: InkWell(
customBorder: const CircleBorder(),
onTap: () => showConfirmDialog(
context: context,
title: '确定移除该视频?',
onConfirm: () => widget.onDelete!(index),
),
onLongPress: () => widget.onDelete!(index),
child: Padding(
padding: const EdgeInsets.all(9),
child: Icon(
Icons.clear,
size: 18,
color: theme.colorScheme.outline,
if (showDelBtn && !isCurr)
Positioned(
right: 12,
bottom: -6,
child: InkWell(
customBorder: const CircleBorder(),
onTap: () => showConfirmDialog(
context: context,
title: '确定移除该视频?',
onConfirm: () => widget.onDelete!(index),
),
onLongPress: () => widget.onDelete!(index),
child: Padding(
padding: const EdgeInsets.all(9),
child: Icon(
Icons.clear,
size: 18,
color: theme.colorScheme.outline,
),
),
),
),
),
],
],
),
),
),
);