mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: 视频简介与相关视频实现方式微调
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@@ -17,6 +18,7 @@ import 'package:PiliPalaX/pages/video/detail/widgets/ai_detail.dart';
|
|||||||
import 'package:PiliPalaX/utils/feed_back.dart';
|
import 'package:PiliPalaX/utils/feed_back.dart';
|
||||||
import 'package:PiliPalaX/utils/storage.dart';
|
import 'package:PiliPalaX/utils/storage.dart';
|
||||||
import 'package:PiliPalaX/utils/utils.dart';
|
import 'package:PiliPalaX/utils/utils.dart';
|
||||||
|
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||||
|
|
||||||
import 'widgets/action_item.dart';
|
import 'widgets/action_item.dart';
|
||||||
import 'widgets/action_row_item.dart';
|
import 'widgets/action_row_item.dart';
|
||||||
@@ -93,7 +95,18 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
|
|||||||
snapshot.data['code'] == 62002
|
snapshot.data['code'] == 62002
|
||||||
? '上一页'
|
? '上一页'
|
||||||
: null,
|
: null,
|
||||||
fn: () => Get.back(),
|
fn: () {
|
||||||
|
if (snapshot.data['code'] == -404 ||
|
||||||
|
snapshot.data['code'] == 62002) {
|
||||||
|
Get.back();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_futureBuilderFuture = videoIntroController.queryVideoIntro();
|
||||||
|
_futureBuilderFuture!.then((value) {
|
||||||
|
videoIntroController.videoDetail.refresh();
|
||||||
|
setState(() {});
|
||||||
|
});
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -245,11 +258,15 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final ThemeData t = Theme.of(context);
|
final ThemeData t = Theme.of(context);
|
||||||
final Color outline = t.colorScheme.outline;
|
return SliverLayoutBuilder(
|
||||||
bool isHorizontal = context.width > context.height * 1.25;
|
builder: (BuildContext context, SliverConstraints constraints) {
|
||||||
|
bool isHorizontal = constraints.crossAxisExtent >
|
||||||
|
constraints.viewportMainAxisExtent * 1.25;
|
||||||
return SliverPadding(
|
return SliverPadding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: StyleString.safeSpace, right: StyleString.safeSpace, top: 10),
|
left: StyleString.safeSpace,
|
||||||
|
right: StyleString.safeSpace,
|
||||||
|
top: 10),
|
||||||
sliver: SliverToBoxAdapter(
|
sliver: SliverToBoxAdapter(
|
||||||
child: !loadingStatus
|
child: !loadingStatus
|
||||||
? Column(
|
? Column(
|
||||||
@@ -264,6 +281,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
vertical: 1, horizontal: 0),
|
vertical: 1, horizontal: 0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
NetworkImgLayer(
|
NetworkImgLayer(
|
||||||
type: 'avatar',
|
type: 'avatar',
|
||||||
@@ -276,11 +294,14 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
fadeOutDuration: Duration.zero,
|
fadeOutDuration: Duration.zero,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Column(
|
Expanded(
|
||||||
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
owner.name,
|
owner.name,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: t.colorScheme.primary),
|
color: t.colorScheme.primary),
|
||||||
@@ -292,71 +313,21 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
semanticsLabel: "$follower粉丝",
|
semanticsLabel: "$follower粉丝",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: outline,
|
color: t.colorScheme.outline,
|
||||||
),
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
const Spacer(),
|
|
||||||
Obx(() => AnimatedOpacity(
|
|
||||||
opacity: loadingStatus ||
|
|
||||||
videoIntroController
|
|
||||||
.followStatus.isEmpty
|
|
||||||
? 0
|
|
||||||
: 1,
|
|
||||||
duration: const Duration(milliseconds: 50),
|
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
child: Obx(
|
|
||||||
() => videoIntroController
|
|
||||||
.followStatus.isNotEmpty
|
|
||||||
? TextButton(
|
|
||||||
onPressed: () =>
|
|
||||||
videoIntroController
|
|
||||||
.actionRelationMod(
|
|
||||||
context),
|
|
||||||
style: TextButton.styleFrom(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
left: 8, right: 8),
|
|
||||||
foregroundColor:
|
|
||||||
followStatus['attribute'] !=
|
|
||||||
0
|
|
||||||
? outline
|
|
||||||
: t.colorScheme
|
|
||||||
.onPrimary,
|
|
||||||
backgroundColor:
|
|
||||||
followStatus['attribute'] !=
|
|
||||||
0
|
|
||||||
? t.colorScheme
|
|
||||||
.onInverseSurface
|
|
||||||
: t.colorScheme
|
|
||||||
.primary, // 设置按钮背景色
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
followStatus['attribute'] != 0
|
|
||||||
? '已关注'
|
|
||||||
: '关注',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: t.textTheme
|
|
||||||
.labelMedium!.fontSize),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: ElevatedButton(
|
|
||||||
onPressed: () =>
|
|
||||||
videoIntroController
|
|
||||||
.actionRelationMod(
|
|
||||||
context),
|
|
||||||
child: const Text('关注'),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
)),
|
)),
|
||||||
|
followButton(context, t),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
if (isHorizontal)
|
if (isHorizontal) ...[
|
||||||
|
const SizedBox(width: 10),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: actionGrid(context, videoIntroController)),
|
child: actionGrid(context, videoIntroController)),
|
||||||
|
]
|
||||||
]),
|
]),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
@@ -421,15 +392,10 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
if (MineController.anonymity) ...<Widget>[
|
if (MineController.anonymity) ...<Widget>[
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Icon(
|
Icon(
|
||||||
CupertinoIcons.checkmark_shield,
|
MdiIcons.incognito,
|
||||||
size: 15,
|
size: 15,
|
||||||
color: t.colorScheme.outline,
|
color: t.colorScheme.outline,
|
||||||
),
|
semanticLabel: '无痕',
|
||||||
Text(
|
|
||||||
'无痕',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: t.colorScheme.outline),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
@@ -455,8 +421,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
label: 'AI总结',
|
label: 'AI总结',
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final res =
|
final res = await videoIntroController
|
||||||
await videoIntroController.aiConclusion();
|
.aiConclusion();
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
showAiBottomSheet();
|
showAiBottomSheet();
|
||||||
}
|
}
|
||||||
@@ -478,7 +444,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
// 点赞收藏转发 布局样式2
|
// 点赞收藏转发 布局样式2
|
||||||
if (!isHorizontal) actionGrid(context, videoIntroController),
|
if (!isHorizontal)
|
||||||
|
actionGrid(context, videoIntroController),
|
||||||
// 合集
|
// 合集
|
||||||
if (!loadingStatus &&
|
if (!loadingStatus &&
|
||||||
widget.videoDetail!.ugcSeason != null) ...[
|
widget.videoDetail!.ugcSeason != null) ...[
|
||||||
@@ -501,7 +468,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
pages: widget.videoDetail!.pages!,
|
pages: widget.videoDetail!.pages!,
|
||||||
cid: videoIntroController.lastPlayCid.value,
|
cid: videoIntroController.lastPlayCid.value,
|
||||||
bvid: videoIntroController.bvid,
|
bvid: videoIntroController.bvid,
|
||||||
changeFuc: videoIntroController.changeSeasonOrbangu,
|
changeFuc:
|
||||||
|
videoIntroController.changeSeasonOrbangu,
|
||||||
))
|
))
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@@ -514,6 +482,31 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Obx followButton(BuildContext context, ThemeData t) {
|
||||||
|
return Obx(
|
||||||
|
() => TextButton(
|
||||||
|
onPressed: () => videoIntroController.actionRelationMod(context),
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
visualDensity: VisualDensity.compact,
|
||||||
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
|
padding: const EdgeInsets.only(left: 6, right: 6),
|
||||||
|
foregroundColor: (followStatus?['attribute'] ?? 0) != 0
|
||||||
|
? t.colorScheme.outline
|
||||||
|
: t.colorScheme.onPrimary,
|
||||||
|
backgroundColor: (followStatus?['attribute'] ?? 0) != 0
|
||||||
|
? t.colorScheme.onInverseSurface
|
||||||
|
: t.colorScheme.primary, // 设置按钮背景色
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
((followStatus?['attribute'] ?? 0) != 0) ? '已关注' : '关注',
|
||||||
|
style: TextStyle(fontSize: t.textTheme.labelMedium!.fontSize),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget actionGrid(BuildContext context, videoIntroController) {
|
Widget actionGrid(BuildContext context, videoIntroController) {
|
||||||
@@ -530,6 +523,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
icon: const Icon(FontAwesomeIcons.thumbsUp),
|
icon: const Icon(FontAwesomeIcons.thumbsUp),
|
||||||
selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp),
|
selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp),
|
||||||
onTap: handleState(videoIntroController.actionLikeVideo),
|
onTap: handleState(videoIntroController.actionLikeVideo),
|
||||||
|
onLongPress: handleState(videoIntroController.actionOneThree),
|
||||||
selectStatus: videoIntroController.hasLike.value,
|
selectStatus: videoIntroController.hasLike.value,
|
||||||
loadingStatus: loadingStatus,
|
loadingStatus: loadingStatus,
|
||||||
semanticsLabel: '点赞',
|
semanticsLabel: '点赞',
|
||||||
|
|||||||
@@ -85,7 +85,10 @@ class _RelatedVideoPanelState extends State<RelatedVideoPanel>
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// 请求错误
|
// 请求错误
|
||||||
return HttpError(errMsg: '出错了', fn: () {});
|
return HttpError(errMsg: '出错了', fn: () {
|
||||||
|
_futureBuilder = _relatedController.queryRelatedVideo();
|
||||||
|
_futureBuilder.then((value) => setState(() {}));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 骨架屏
|
// 骨架屏
|
||||||
|
|||||||
Reference in New Issue
Block a user