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), label: Utils.videoItemSemantics(videoItem),
excludeSemantics: true, excludeSemantics: true,
child: InkWell( child: InkWell(
onLongPress: () { onLongPress: onLongPress ??
if (onLongPress != null) { () => imageSaveDialog(
onLongPress!(); title: videoItem.title,
} else { cover: videoItem.pic,
imageSaveDialog( ),
title: videoItem.title, onTap: onTap ??
cover: videoItem.pic, () async {
); if (type == 'ketang') {
} SmartDialog.showToast('课堂视频暂不支持播放');
}, return;
onTap: () async { } else if (type == 'live_room') {
if (onTap != null) { if (videoItem case SearchVideoItemModel item) {
onTap!(); int? roomId = item.id;
return; if (roomId != null) {
} Get.toNamed('/liveRoom?roomid=$roomId');
if (type == 'ketang') { }
SmartDialog.showToast('课堂视频暂不支持播放'); } else {
return; SmartDialog.showToast(
} else if (type == 'live_room') { 'err: live_room : ${videoItem.runtimeType}');
if (videoItem case SearchVideoItemModel item) { }
int? roomId = item.id; return;
if (roomId != null) {
Get.toNamed('/liveRoom?roomid=$roomId');
} }
} else { if (videoItem case HotVideoItemModel item) {
SmartDialog.showToast( if (item.redirectUrl?.isNotEmpty == true &&
'err: live_room : ${videoItem.runtimeType}'); PageUtils.viewPgcFromUri(item.redirectUrl!)) {
} return;
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)
},
);
} }
} try {
} catch (err) { final int? cid = videoItem.cid ??
SmartDialog.showToast(err.toString()); 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( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: StyleString.safeSpace, horizontal: StyleString.safeSpace,

View File

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

View File

@@ -215,14 +215,13 @@ class SearchHttp {
dynamic seasonId, dynamic seasonId,
dynamic epId, dynamic epId,
}) async { }) async {
final Map<String, dynamic> data = {}; var res = await Request().get(
if (seasonId != null) { Api.bangumiInfo,
data['season_id'] = seasonId; queryParameters: {
} else if (epId != null) { if (seasonId != null) 'season_id': seasonId,
data['ep_id'] = epId; if (epId != null) 'ep_id': epId,
} },
var res = await Request().get(Api.bangumiInfo, queryParameters: data); );
if (res.data['code'] == 0) { if (res.data['code'] == 0) {
return { return {
'status': true, 'status': true,

View File

@@ -149,14 +149,13 @@ class _UpPanelState extends State<UpPanel> {
} }
}, },
onDoubleTap: data is LiveUserItem ? () => _onSelect(data) : null, onDoubleTap: data is LiveUserItem ? () => _onSelect(data) : null,
onLongPress: () { onLongPress: data.mid == -1
if (data.mid == -1) { ? null
return; : () {
} String heroTag = Utils.makeHeroTag(data.mid);
String heroTag = Utils.makeHeroTag(data.mid); Get.toNamed('/member?mid=${data.mid}',
Get.toNamed('/member?mid=${data.mid}', arguments: {'face': data.face, 'heroTag': heroTag});
arguments: {'face': data.face, 'heroTag': heroTag}); },
},
child: AnimatedOpacity( child: AnimatedOpacity(
opacity: isCurrent ? 1 : 0.6, opacity: isCurrent ? 1 : 0.6,
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),

View File

@@ -35,40 +35,31 @@ class FavVideoCardH extends StatelessWidget {
return InkWell( return InkWell(
onTap: isSort == true onTap: isSort == true
? null ? null
: () async { : onTap ??
if (onTap != null) { () {
onTap!(); if (!const [0, 16].contains(videoItem.attr)) {
return; Get.toNamed('/member?mid=${videoItem.owner.mid}');
} return;
}
if (!const [0, 16].contains(videoItem.attr)) { // pgc
Get.toNamed('/member?mid=${videoItem.owner.mid}'); if (videoItem.type == 24) {
return; PageUtils.viewBangumi(
} seasonId: videoItem.ogv!.seasonId,
epId: videoItem.epId,
);
return;
}
// pgc onViewFav?.call();
if (videoItem.type == 24) { },
PageUtils.viewBangumi(
seasonId: videoItem.ogv!.seasonId,
epId: videoItem.epId,
);
return;
}
onViewFav?.call();
},
onLongPress: isSort == true onLongPress: isSort == true
? null ? null
: () { : onLongPress ??
if (onLongPress != null) { () => imageSaveDialog(
onLongPress!(); title: videoItem.title,
} else { cover: videoItem.pic,
imageSaveDialog( ),
title: videoItem.title,
cover: videoItem.pic,
);
}
},
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: StyleString.safeSpace, horizontal: StyleString.safeSpace,

View File

@@ -173,7 +173,7 @@ class _IntroDetailState extends CommonCollapseSlidePageState<IntroDetail> {
'/searchResult', '/searchResult',
parameters: {'keyword': tagName}, parameters: {'keyword': tagName},
), ),
onLongPress: (tagName) => Utils.copyText(tagName), onLongPress: Utils.copyText,
), ),
) )
.toList(), .toList(),

View File

@@ -719,8 +719,7 @@ class _VideoInfoState extends State<VideoInfo> {
'/searchResult', '/searchResult',
parameters: {'keyword': tagName}, parameters: {'keyword': tagName},
), ),
onLongPress: (tagName) => onLongPress: Utils.copyText,
Utils.copyText(tagName),
), ),
) )
.toList(), .toList(),

View File

@@ -145,9 +145,9 @@ class ActionItemState extends State<ActionItem>
widget.onTap?.call(); widget.onTap?.call();
}, },
onLongPress: _isThumbsUp ? null : widget.onLongPress, onLongPress: _isThumbsUp ? null : widget.onLongPress,
onTapDown: (details) => _isThumbsUp ? _startLongPress() : null, onTapDown: _isThumbsUp ? (details) => _startLongPress() : null,
onTapUp: (details) => _isThumbsUp ? _cancelLongPress() : null, onTapUp: _isThumbsUp ? (details) => _cancelLongPress() : null,
onTapCancel: () => _isThumbsUp ? _cancelLongPress(true) : null, onTapCancel: _isThumbsUp ? () => _cancelLongPress(true) : null,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [

View File

@@ -85,9 +85,10 @@ class PiliScheme {
if (id != null) { if (id != null) {
bool isEp = path.contains('/ep/'); bool isEp = path.contains('/ep/');
PageUtils.viewBangumi( PageUtils.viewBangumi(
seasonId: isEp ? null : id, seasonId: isEp ? null : id,
epId: isEp ? id : null, epId: isEp ? id : null,
progress: uri.queryParameters['start_progress']); progress: uri.queryParameters['start_progress'],
);
return true; return true;
} }
return false; return false;

View File

@@ -697,7 +697,7 @@ class PageUtils {
} }
static Future<void> viewBangumi( static Future<void> viewBangumi(
{dynamic seasonId, dynamic epId, dynamic progress}) async { {dynamic seasonId, dynamic epId, String? progress}) async {
try { try {
SmartDialog.showLoading(msg: '资源获取中'); SmartDialog.showLoading(msg: '资源获取中');
var result = await SearchHttp.bangumiInfo(seasonId: seasonId, epId: epId); var result = await SearchHttp.bangumiInfo(seasonId: seasonId, epId: epId);