mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: show video tags
This commit is contained in:
@@ -47,6 +47,8 @@ class VideoIntroController extends GetxController {
|
||||
Rx<Map<String, dynamic>> userStat =
|
||||
Rx<Map<String, dynamic>>({'follower': '-'});
|
||||
|
||||
dynamic videoTags;
|
||||
|
||||
// 是否点赞
|
||||
RxBool hasLike = false.obs;
|
||||
// 是否点踩
|
||||
@@ -120,6 +122,7 @@ class VideoIntroController extends GetxController {
|
||||
|
||||
// 获取视频简介&分p
|
||||
void queryVideoIntro() async {
|
||||
queryVideoTags();
|
||||
var result = await VideoHttp.videoIntro(bvid: bvid);
|
||||
if (result['status']) {
|
||||
videoDetail.value = result['data']!;
|
||||
@@ -159,6 +162,14 @@ class VideoIntroController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
Future queryVideoTags() async {
|
||||
var result = await UserHttp.videoTags(bvid: bvid);
|
||||
if (result['status']) {
|
||||
videoTags = result['data'];
|
||||
debugPrint('tags: ${result['data']}');
|
||||
}
|
||||
}
|
||||
|
||||
// 获取up主粉丝数
|
||||
Future queryUserStat() async {
|
||||
var result = await UserHttp.userStat(mid: videoDetail.value.owner!.mid!);
|
||||
|
||||
@@ -82,7 +82,10 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
|
||||
videoDetail: videoDetail,
|
||||
heroTag: heroTag,
|
||||
showAiBottomSheet: widget.showAiBottomSheet,
|
||||
showIntroDetail: widget.showIntroDetail,
|
||||
showIntroDetail: () => widget.showIntroDetail(
|
||||
videoDetail,
|
||||
videoIntroController.videoTags,
|
||||
),
|
||||
showEpisodes: widget.showEpisodes,
|
||||
)
|
||||
: VideoInfo(
|
||||
@@ -92,7 +95,10 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
|
||||
videoDetail: videoIntroController.videoDetail.value,
|
||||
heroTag: heroTag,
|
||||
showAiBottomSheet: widget.showAiBottomSheet,
|
||||
showIntroDetail: widget.showIntroDetail,
|
||||
showIntroDetail: () => widget.showIntroDetail(
|
||||
videoIntroController.videoDetail.value,
|
||||
videoIntroController.videoTags,
|
||||
),
|
||||
showEpisodes: widget.showEpisodes,
|
||||
));
|
||||
}
|
||||
@@ -199,7 +205,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
return;
|
||||
}
|
||||
feedBack();
|
||||
widget.showIntroDetail(widget.videoDetail);
|
||||
widget.showIntroDetail();
|
||||
}
|
||||
|
||||
// 用户主页
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:PiliPalaX/pages/search/widgets/search_text.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
@@ -10,8 +11,10 @@ class IntroDetail extends StatelessWidget {
|
||||
const IntroDetail({
|
||||
super.key,
|
||||
this.videoDetail,
|
||||
this.videoTags,
|
||||
});
|
||||
final dynamic videoDetail;
|
||||
final dynamic videoTags;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -75,6 +78,23 @@ class IntroDetail extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
if (videoTags is List && videoTags.isNotEmpty) ...[
|
||||
const SizedBox(height: 10),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: (videoTags as List)
|
||||
.map(
|
||||
(item) => SearchText(
|
||||
fontSize: 13,
|
||||
searchText: item['tag_name'],
|
||||
onSelect: (_) => Get.toNamed('/searchResult',
|
||||
parameters: {'keyword': item['tag_name']}),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
)
|
||||
],
|
||||
const SizedBox(height: 10),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
|
||||
@@ -1296,12 +1296,18 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
);
|
||||
}
|
||||
|
||||
showIntroDetail(videoDetail) {
|
||||
showIntroDetail(videoDetail, videoTags) {
|
||||
scaffoldKey.currentState?.showBottomSheet(
|
||||
enableDrag: true,
|
||||
(context) => videoDetail is BangumiInfoModel
|
||||
? bangumi.IntroDetail(bangumiDetail: videoDetail)
|
||||
: video.IntroDetail(videoDetail: videoDetail),
|
||||
? bangumi.IntroDetail(
|
||||
bangumiDetail: videoDetail,
|
||||
videoTags: videoTags,
|
||||
)
|
||||
: video.IntroDetail(
|
||||
videoDetail: videoDetail,
|
||||
videoTags: videoTags,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user