mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: video pic showing
This commit is contained in:
@@ -40,7 +40,7 @@ class NetworkImgLayer extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final int defaultImgQuality = GlobalData().imgQuality;
|
final int defaultImgQuality = GlobalData().imgQuality;
|
||||||
final String imageUrl =
|
final String imageUrl =
|
||||||
'${src!.startsWith('//') ? 'https:${src!}' : src!}@${quality ?? defaultImgQuality}q.webp';
|
'${src?.startsWith('//') == true ? 'https:$src' : src}@${quality ?? defaultImgQuality}q.webp';
|
||||||
int? memCacheWidth, memCacheHeight;
|
int? memCacheWidth, memCacheHeight;
|
||||||
|
|
||||||
if (width > height || (origAspectRatio != null && origAspectRatio! > 1)) {
|
if (width > height || (origAspectRatio != null && origAspectRatio! > 1)) {
|
||||||
@@ -66,7 +66,8 @@ class NetworkImgLayer extends StatelessWidget {
|
|||||||
child: CachedNetworkImage(
|
child: CachedNetworkImage(
|
||||||
imageUrl: imageUrl,
|
imageUrl: imageUrl,
|
||||||
width: width,
|
width: width,
|
||||||
height: ignoreHeight == null || ignoreHeight == false? height:null,
|
height:
|
||||||
|
ignoreHeight == null || ignoreHeight == false ? height : null,
|
||||||
memCacheWidth: memCacheWidth,
|
memCacheWidth: memCacheWidth,
|
||||||
memCacheHeight: memCacheHeight,
|
memCacheHeight: memCacheHeight,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
|
|||||||
@@ -245,7 +245,11 @@ class VideoHttp {
|
|||||||
var res = await Request().get(Api.videoIntro, data: {'bvid': bvid});
|
var res = await Request().get(Api.videoIntro, data: {'bvid': bvid});
|
||||||
VideoDetailResponse result = VideoDetailResponse.fromJson(res.data);
|
VideoDetailResponse result = VideoDetailResponse.fromJson(res.data);
|
||||||
if (result.code == 0) {
|
if (result.code == 0) {
|
||||||
return {'status': true, 'data': result.data!};
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': result.data!,
|
||||||
|
'pic': result.data?.pic ?? '',
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
// Map errMap = {
|
// Map errMap = {
|
||||||
// -400: '请求错误',
|
// -400: '请求错误',
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class VideoDetailController extends GetxController
|
|||||||
RxInt danmakuCid = 0.obs;
|
RxInt danmakuCid = 0.obs;
|
||||||
String heroTag = Get.arguments['heroTag'];
|
String heroTag = Get.arguments['heroTag'];
|
||||||
// 视频详情
|
// 视频详情
|
||||||
Map videoItem = {};
|
RxMap videoItem = {}.obs;
|
||||||
// 视频类型 默认投稿视频
|
// 视频类型 默认投稿视频
|
||||||
SearchType videoType = Get.arguments['videoType'] ?? SearchType.video;
|
SearchType videoType = Get.arguments['videoType'] ?? SearchType.video;
|
||||||
|
|
||||||
|
|||||||
@@ -114,11 +114,15 @@ class VideoIntroController extends GetxController {
|
|||||||
queryVideoIntro();
|
queryVideoIntro();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
late final videoDetailController =
|
||||||
|
Get.find<VideoDetailController>(tag: heroTag);
|
||||||
|
|
||||||
// 获取视频简介&分p
|
// 获取视频简介&分p
|
||||||
void queryVideoIntro() async {
|
void queryVideoIntro() async {
|
||||||
var result = await VideoHttp.videoIntro(bvid: bvid);
|
var result = await VideoHttp.videoIntro(bvid: bvid);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
videoDetail.value = result['data']!;
|
videoDetail.value = result['data']!;
|
||||||
|
videoDetailController.videoItem['pic'] = result['pic']!;
|
||||||
if (videoDetail.value.pages != null &&
|
if (videoDetail.value.pages != null &&
|
||||||
videoDetail.value.pages!.isNotEmpty &&
|
videoDetail.value.pages!.isNotEmpty &&
|
||||||
lastPlayCid.value == 0) {
|
lastPlayCid.value == 0) {
|
||||||
|
|||||||
@@ -130,4 +130,10 @@ class VideoReplyController extends GetxController {
|
|||||||
void animToTop() {
|
void animToTop() {
|
||||||
scrollController.animToTop();
|
scrollController.animToTop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
scrollController.dispose();
|
||||||
|
super.onClose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -677,12 +677,14 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
right: 0,
|
right: 0,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: handlePlay,
|
onTap: handlePlay,
|
||||||
child: NetworkImgLayer(
|
child: Obx(
|
||||||
type: 'emote',
|
() => NetworkImgLayer(
|
||||||
src: videoDetailController
|
type: 'emote',
|
||||||
.videoItem['pic'],
|
src: videoDetailController
|
||||||
width: videoWidth,
|
.videoItem['pic'],
|
||||||
height: videoHeight,
|
width: videoWidth,
|
||||||
|
height: videoHeight,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -798,11 +800,13 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
right: 0,
|
right: 0,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: handlePlay,
|
onTap: handlePlay,
|
||||||
child: NetworkImgLayer(
|
child: Obx(
|
||||||
type: 'emote',
|
() => NetworkImgLayer(
|
||||||
src: videoDetailController.videoItem['pic'],
|
type: 'emote',
|
||||||
width: videoWidth,
|
src: videoDetailController.videoItem['pic'],
|
||||||
height: videoHeight,
|
width: videoWidth,
|
||||||
|
height: videoHeight,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -897,11 +901,13 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
right: 0,
|
right: 0,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: handlePlay,
|
onTap: handlePlay,
|
||||||
child: NetworkImgLayer(
|
child: Obx(
|
||||||
type: 'emote',
|
() => NetworkImgLayer(
|
||||||
src: videoDetailController.videoItem['pic'],
|
type: 'emote',
|
||||||
width: videoWidth,
|
src: videoDetailController.videoItem['pic'],
|
||||||
height: videoHeight,
|
width: videoWidth,
|
||||||
|
height: videoHeight,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -993,11 +999,13 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
right: 0,
|
right: 0,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: handlePlay,
|
onTap: handlePlay,
|
||||||
child: NetworkImgLayer(
|
child: Obx(
|
||||||
type: 'emote',
|
() => NetworkImgLayer(
|
||||||
src: videoDetailController.videoItem['pic'],
|
type: 'emote',
|
||||||
width: videoWidth,
|
src: videoDetailController.videoItem['pic'],
|
||||||
height: videoHeight,
|
width: videoWidth,
|
||||||
|
height: videoHeight,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -1097,12 +1105,14 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
right: 0,
|
right: 0,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: handlePlay,
|
onTap: handlePlay,
|
||||||
child: NetworkImgLayer(
|
child: Obx(
|
||||||
type: 'emote',
|
() => NetworkImgLayer(
|
||||||
src: videoDetailController
|
type: 'emote',
|
||||||
.videoItem['pic'],
|
src: videoDetailController
|
||||||
width: videoWidth,
|
.videoItem['pic'],
|
||||||
height: videoHeight,
|
width: videoWidth,
|
||||||
|
height: videoHeight,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user