Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-31 15:30:50 +08:00
parent 1462e6ecf1
commit 19bbdaac65
10 changed files with 113 additions and 134 deletions

View File

@@ -60,62 +60,54 @@ class VideoCardH extends StatelessWidget {
label: Utils.videoItemSemantics(videoItem),
excludeSemantics: true,
child: InkWell(
onLongPress: () {
if (onLongPress != null) {
onLongPress!();
} else {
imageSaveDialog(
title: videoItem.title,
cover: videoItem.pic,
);
}
},
onTap: () async {
if (onTap != null) {
onTap!();
return;
}
if (type == 'ketang') {
SmartDialog.showToast('课堂视频暂不支持播放');
return;
} else if (type == 'live_room') {
if (videoItem case SearchVideoItemModel item) {
int? roomId = item.id;
if (roomId != null) {
Get.toNamed('/liveRoom?roomid=$roomId');
onLongPress: onLongPress ??
() => imageSaveDialog(
title: videoItem.title,
cover: videoItem.pic,
),
onTap: onTap ??
() async {
if (type == 'ketang') {
SmartDialog.showToast('课堂视频暂不支持播放');
return;
} else if (type == 'live_room') {
if (videoItem case SearchVideoItemModel item) {
int? roomId = item.id;
if (roomId != null) {
Get.toNamed('/liveRoom?roomid=$roomId');
}
} else {
SmartDialog.showToast(
'err: live_room : ${videoItem.runtimeType}');
}
return;
}
} else {
SmartDialog.showToast(
'err: live_room : ${videoItem.runtimeType}');
}
return;
}
if (videoItem case HotVideoItemModel item) {
if (item.redirectUrl?.isNotEmpty == true &&
PageUtils.viewPgcFromUri(item.redirectUrl!)) {
return;
}
}
try {
final int? cid = videoItem.cid ??
await SearchHttp.ab2c(aid: aid, bvid: bvid);
if (cid != null) {
if (source == 'later') {
onViewLater!(cid);
} else {
PageUtils.toVideoPage(
'bvid=$bvid&cid=$cid',
arguments: {
'videoItem': videoItem,
'heroTag': Utils.makeHeroTag(aid)
},
);
if (videoItem case HotVideoItemModel item) {
if (item.redirectUrl?.isNotEmpty == true &&
PageUtils.viewPgcFromUri(item.redirectUrl!)) {
return;
}
}
}
} catch (err) {
SmartDialog.showToast(err.toString());
}
},
try {
final int? cid = videoItem.cid ??
await SearchHttp.ab2c(aid: aid, bvid: bvid);
if (cid != null) {
if (source == 'later') {
onViewLater!(cid);
} else {
PageUtils.toVideoPage(
'bvid=$bvid&cid=$cid',
arguments: {
'videoItem': videoItem,
'heroTag': Utils.makeHeroTag(aid)
},
);
}
}
} catch (err) {
SmartDialog.showToast(err.toString());
}
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: StyleString.safeSpace,

View File

@@ -37,30 +37,28 @@ class VideoCardHMemberVideo extends StatelessWidget {
title: videoItem.title,
cover: videoItem.cover,
),
onTap: () async {
if (onTap != null) {
onTap!();
return;
}
if (videoItem.isPgc == true && videoItem.uri?.isNotEmpty == true) {
if (PageUtils.viewPgcFromUri(videoItem.uri!)) {
return;
}
}
if (videoItem.bvid == null || videoItem.cid == null) {
return;
}
try {
PageUtils.toVideoPage(
'bvid=${videoItem.bvid}&cid=${videoItem.cid}',
arguments: {
'heroTag': Utils.makeHeroTag(videoItem.bvid),
},
);
} catch (err) {
SmartDialog.showToast(err.toString());
}
},
onTap: onTap ??
() async {
if (videoItem.isPgc == true &&
videoItem.uri?.isNotEmpty == true) {
if (PageUtils.viewPgcFromUri(videoItem.uri!)) {
return;
}
}
if (videoItem.bvid == null || videoItem.cid == null) {
return;
}
try {
PageUtils.toVideoPage(
'bvid=${videoItem.bvid}&cid=${videoItem.cid}',
arguments: {
'heroTag': Utils.makeHeroTag(videoItem.bvid),
},
);
} catch (err) {
SmartDialog.showToast(err.toString());
}
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: StyleString.safeSpace,