opt: bangumi card

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-01-03 11:31:56 +08:00
parent 168bb22670
commit 51e436faed

View File

@@ -20,110 +20,98 @@ class BangumiCardV extends StatelessWidget {
return Card( return Card(
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
margin: EdgeInsets.zero, margin: EdgeInsets.zero,
child: GestureDetector( child: InkWell(
// onLongPress: () {
// if (longPress != null) {
// longPress!();
// }
// },
// onLongPressEnd: (details) {
// if (longPressEnd != null) {
// longPressEnd!();
// }
// },
onLongPress: () => imageSaveDialog( onLongPress: () => imageSaveDialog(
context: context, context: context,
title: bangumiItem.title, title: bangumiItem.title,
cover: bangumiItem.cover, cover: bangumiItem.cover,
), ),
child: InkWell( onTap: () async {
onTap: () async { final int seasonId = bangumiItem.seasonId;
final int seasonId = bangumiItem.seasonId; Utils.viewBangumi(seasonId: seasonId);
Utils.viewBangumi(seasonId: seasonId); // SmartDialog.showLoading(msg: '获取中...');
// SmartDialog.showLoading(msg: '获取中...'); // final res = await SearchHttp.bangumiInfo(seasonId: seasonId);
// final res = await SearchHttp.bangumiInfo(seasonId: seasonId); // SmartDialog.dismiss().then((value) {
// SmartDialog.dismiss().then((value) { // if (res['status']) {
// if (res['status']) { // if (res['data'].episodes.isEmpty) {
// if (res['data'].episodes.isEmpty) { // SmartDialog.showToast('资源加载失败');
// SmartDialog.showToast('资源加载失败'); // return;
// return; // }
// } // EpisodeItem episode = res['data'].episodes.first;
// EpisodeItem episode = res['data'].episodes.first; // int? epId = res['data'].userStatus?.progress?.lastEpId;
// int? epId = res['data'].userStatus?.progress?.lastEpId; // if (epId == null) {
// if (epId == null) { // epId = episode.epId;
// epId = episode.epId; // } else {
// } else { // for (var item in res['data'].episodes) {
// for (var item in res['data'].episodes) { // if (item.epId == epId) {
// if (item.epId == epId) { // episode = item;
// episode = item; // break;
// break; // }
// } // }
// } // }
// } // String bvid = episode.bvid!;
// String bvid = episode.bvid!; // int cid = episode.cid!;
// int cid = episode.cid!; // String pic = episode.cover!;
// String pic = episode.cover!; // // debugPrint('epId');
// // debugPrint('epId'); // // debugPrint(epId);
// // debugPrint(epId); // String heroTag = Utils.makeHeroTag(cid);
// String heroTag = Utils.makeHeroTag(cid); // Get.toNamed(
// Get.toNamed( // '/video?bvid=$bvid&cid=$cid&seasonId=$seasonId&epId=$epId',
// '/video?bvid=$bvid&cid=$cid&seasonId=$seasonId&epId=$epId', // arguments: {
// arguments: { // 'pic': pic,
// 'pic': pic, // 'heroTag': heroTag,
// 'heroTag': heroTag, // 'videoType': SearchType.media_bangumi,
// 'videoType': SearchType.media_bangumi, // 'bangumiItem': res['data'],
// 'bangumiItem': res['data'], // },
// }, // );
// ); // } else {
// } else { // SmartDialog.showToast(res['msg']);
// SmartDialog.showToast(res['msg']); // }
// } // });
// }); },
}, child: Column(
child: Column( children: [
children: [ ClipRRect(
ClipRRect( borderRadius: const BorderRadius.all(StyleString.imgRadius),
borderRadius: const BorderRadius.all(StyleString.imgRadius), child: AspectRatio(
child: AspectRatio( aspectRatio: 0.75,
aspectRatio: 0.75, child: LayoutBuilder(builder: (context, boxConstraints) {
child: LayoutBuilder(builder: (context, boxConstraints) { final double maxWidth = boxConstraints.maxWidth;
final double maxWidth = boxConstraints.maxWidth; final double maxHeight = boxConstraints.maxHeight;
final double maxHeight = boxConstraints.maxHeight; return Stack(
return Stack( children: [
children: [ Hero(
Hero( tag: heroTag,
tag: heroTag, child: NetworkImgLayer(
child: NetworkImgLayer( src: bangumiItem.cover,
src: bangumiItem.cover, width: maxWidth,
width: maxWidth, height: maxHeight,
height: maxHeight,
),
), ),
if (bangumiItem.badge != null) ),
PBadge( if (bangumiItem.badge != null)
text: bangumiItem.badge, PBadge(
top: 6, text: bangumiItem.badge,
right: 6, top: 6,
bottom: null, right: 6,
left: null, bottom: null,
), left: null,
if (bangumiItem.order != null) ),
PBadge( if (bangumiItem.order != null)
text: bangumiItem.order, PBadge(
top: null, text: bangumiItem.order,
right: null, top: null,
bottom: 6, right: null,
left: 6, bottom: 6,
type: 'gray', left: 6,
), type: 'gray',
], ),
); ],
}), );
), }),
), ),
bagumiContent(context) ),
], bagumiContent(context)
), ],
), ),
), ),
); );