refa: pgc intro

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-11 14:32:00 +08:00
parent 6748a20ddb
commit 2f3f712256
8 changed files with 346 additions and 648 deletions

View File

@@ -71,7 +71,7 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
return Obx(
() => videoIntroController.videoDetail.value.title == null
? VideoInfo(
loadingStatus: true,
isLoading: true,
videoIntroController: videoIntroController,
heroTag: widget.heroTag,
showAiBottomSheet: widget.showAiBottomSheet,
@@ -80,7 +80,7 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
)
: VideoInfo(
key: ValueKey(widget.heroTag),
loadingStatus: false,
isLoading: false,
videoIntroController: videoIntroController,
heroTag: widget.heroTag,
showAiBottomSheet: widget.showAiBottomSheet,
@@ -92,7 +92,7 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
}
class VideoInfo extends StatefulWidget {
final bool loadingStatus;
final bool isLoading;
final String heroTag;
final Function showAiBottomSheet;
final Function showEpisodes;
@@ -101,7 +101,7 @@ class VideoInfo extends StatefulWidget {
const VideoInfo({
super.key,
this.loadingStatus = false,
this.isLoading = false,
required this.heroTag,
required this.showAiBottomSheet,
required this.showEpisodes,
@@ -236,7 +236,7 @@ class _VideoInfoState extends State<VideoInfo> {
// 视频介绍
void showIntroDetail() {
if (widget.loadingStatus) {
if (widget.isLoading) {
return;
}
feedBack();
@@ -246,9 +246,8 @@ class _VideoInfoState extends State<VideoInfo> {
// 用户主页
void onPushMember() {
feedBack();
int? mid = !widget.loadingStatus
? videoDetail.owner?.mid
: videoItem['owner']?.mid;
int? mid =
!widget.isLoading ? videoDetail.owner?.mid : videoItem['owner']?.mid;
if (mid != null) {
if (context.orientation == Orientation.landscape &&
_horizontalMemberPage) {
@@ -369,7 +368,7 @@ class _VideoInfoState extends State<VideoInfo> {
childBuilder: (index) => GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
int? ownerMid = !widget.loadingStatus
int? ownerMid = !widget.isLoading
? videoDetail.owner?.mid
: videoItem['owner']?.mid;
if (videoItem['staff'][index].mid ==
@@ -557,7 +556,7 @@ class _VideoInfoState extends State<VideoInfo> {
StatView(
context: context,
theme: 'gray',
value: Utils.numFormat(!widget.loadingStatus
value: Utils.numFormat(!widget.isLoading
? videoDetail.stat?.view ?? '-'
: videoItem['stat']?.view ?? '-'),
textColor: theme.colorScheme.outline,
@@ -566,7 +565,7 @@ class _VideoInfoState extends State<VideoInfo> {
StatDanMu(
context: context,
theme: 'gray',
value: Utils.numFormat(!widget.loadingStatus
value: Utils.numFormat(!widget.isLoading
? videoDetail.stat?.danmaku ?? '-'
: videoItem['stat']?.danmu ?? '-'),
textColor: theme.colorScheme.outline,
@@ -574,7 +573,7 @@ class _VideoInfoState extends State<VideoInfo> {
const SizedBox(width: 10),
Text(
Utils.dateFormat(
!widget.loadingStatus
!widget.isLoading
? videoDetail.pubdate
: videoItem['pubdate'],
formatType: 'detail'),
@@ -769,7 +768,7 @@ class _VideoInfoState extends State<VideoInfo> {
actionGrid(context, videoIntroController),
],
// 合集
if (!widget.loadingStatus &&
if (!widget.isLoading &&
videoDetail.ugcSeason != null &&
(context.orientation != Orientation.landscape ||
(context.orientation == Orientation.landscape &&
@@ -784,7 +783,7 @@ class _VideoInfoState extends State<VideoInfo> {
videoIntroController: videoIntroController,
),
),
if (!widget.loadingStatus &&
if (!widget.isLoading &&
videoDetail.pages != null &&
videoDetail.pages!.length > 1 &&
(context.orientation != Orientation.landscape ||
@@ -857,9 +856,9 @@ class _VideoInfoState extends State<VideoInfo> {
onLongPress: () =>
handleState(videoIntroController.actionOneThree),
selectStatus: videoIntroController.hasLike.value,
loadingStatus: widget.loadingStatus,
isLoading: widget.isLoading,
semanticsLabel: '点赞',
text: !widget.loadingStatus
text: !widget.isLoading
? Utils.numFormat(videoDetail.stat!.like!)
: '-',
needAnim: true,
@@ -884,7 +883,7 @@ class _VideoInfoState extends State<VideoInfo> {
selectIcon: const Icon(FontAwesomeIcons.solidThumbsDown),
onTap: () => handleState(videoIntroController.actionDislikeVideo),
selectStatus: videoIntroController.hasDislike.value,
loadingStatus: widget.loadingStatus,
isLoading: widget.isLoading,
semanticsLabel: '点踩',
text: "点踩",
),
@@ -896,9 +895,9 @@ class _VideoInfoState extends State<VideoInfo> {
selectIcon: const Icon(FontAwesomeIcons.b),
onTap: () => handleState(videoIntroController.actionCoinVideo),
selectStatus: videoIntroController.hasCoin,
loadingStatus: widget.loadingStatus,
isLoading: widget.isLoading,
semanticsLabel: '投币',
text: !widget.loadingStatus
text: !widget.isLoading
? Utils.numFormat(videoDetail.stat!.coin!)
: '-',
needAnim: true,
@@ -913,9 +912,9 @@ class _VideoInfoState extends State<VideoInfo> {
onLongPress: () => videoIntroController
.showFavBottomSheet(context, type: 'longPress'),
selectStatus: videoIntroController.hasFav.value,
loadingStatus: widget.loadingStatus,
isLoading: widget.isLoading,
semanticsLabel: '收藏',
text: !widget.loadingStatus
text: !widget.isLoading
? Utils.numFormat(videoDetail.stat!.favorite!)
: '-',
needAnim: true,
@@ -927,7 +926,7 @@ class _VideoInfoState extends State<VideoInfo> {
selectIcon: const Icon(FontAwesomeIcons.solidClock),
onTap: () => handleState(videoIntroController.viewLater),
selectStatus: videoIntroController.hasLater.value,
loadingStatus: widget.loadingStatus,
isLoading: widget.isLoading,
semanticsLabel: '再看',
text: '再看',
),
@@ -936,9 +935,9 @@ class _VideoInfoState extends State<VideoInfo> {
icon: const Icon(FontAwesomeIcons.shareFromSquare),
onTap: () => videoIntroController.actionShareVideo(context),
selectStatus: false,
loadingStatus: widget.loadingStatus,
isLoading: widget.isLoading,
semanticsLabel: '分享',
text: !widget.loadingStatus
text: !widget.isLoading
? Utils.numFormat(videoDetail.stat!.share!)
: '分享',
),
@@ -958,9 +957,8 @@ class _VideoInfoState extends State<VideoInfo> {
icon: const Icon(FontAwesomeIcons.thumbsUp),
onTap: () => handleState(videoIntroController.actionLikeVideo),
selectStatus: videoIntroController.hasLike.value,
loadingStatus: widget.loadingStatus,
text:
!widget.loadingStatus ? videoDetail.stat!.like!.toString() : '-',
isLoading: widget.isLoading,
text: !widget.isLoading ? videoDetail.stat!.like!.toString() : '-',
),
),
const SizedBox(width: 8),
@@ -969,9 +967,8 @@ class _VideoInfoState extends State<VideoInfo> {
icon: const Icon(FontAwesomeIcons.b),
onTap: () => handleState(videoIntroController.actionCoinVideo),
selectStatus: videoIntroController.hasCoin,
loadingStatus: widget.loadingStatus,
text:
!widget.loadingStatus ? videoDetail.stat!.coin!.toString() : '-',
isLoading: widget.isLoading,
text: !widget.isLoading ? videoDetail.stat!.coin!.toString() : '-',
),
),
const SizedBox(width: 8),
@@ -982,10 +979,9 @@ class _VideoInfoState extends State<VideoInfo> {
onLongPress: () => videoIntroController.showFavBottomSheet(context,
type: 'longPress'),
selectStatus: videoIntroController.hasFav.value,
loadingStatus: widget.loadingStatus,
text: !widget.loadingStatus
? videoDetail.stat!.favorite!.toString()
: '-',
isLoading: widget.isLoading,
text:
!widget.isLoading ? videoDetail.stat!.favorite!.toString() : '-',
),
),
const SizedBox(width: 8),
@@ -995,15 +991,15 @@ class _VideoInfoState extends State<VideoInfo> {
videoDetailCtr.tabCtr.animateTo(1);
},
selectStatus: false,
loadingStatus: widget.loadingStatus,
text: !widget.loadingStatus ? videoDetail.stat!.reply!.toString() : '-',
isLoading: widget.isLoading,
text: !widget.isLoading ? videoDetail.stat!.reply!.toString() : '-',
),
const SizedBox(width: 8),
ActionRowItem(
icon: const Icon(FontAwesomeIcons.share),
onTap: () => videoIntroController.actionShareVideo(context),
selectStatus: false,
loadingStatus: widget.loadingStatus,
isLoading: widget.isLoading,
text: '转发',
),
]);

View File

@@ -12,7 +12,7 @@ class ActionItem extends StatefulWidget {
final Icon? selectIcon;
final Function? onTap;
final Function? onLongPress;
final bool? loadingStatus;
final bool? isLoading;
final String? text;
final bool selectStatus;
final String semanticsLabel;
@@ -27,7 +27,7 @@ class ActionItem extends StatefulWidget {
this.selectIcon,
this.onTap,
this.onLongPress,
this.loadingStatus,
this.isLoading,
this.text,
this.selectStatus = false,
this.needAnim = false,
@@ -183,7 +183,7 @@ class ActionItemState extends State<ActionItem>
),
if (widget.text != null)
AnimatedOpacity(
opacity: widget.loadingStatus! ? 0 : 1,
opacity: widget.isLoading! ? 0 : 1,
duration: const Duration(milliseconds: 200),
child: AnimatedSwitcher(
duration: const Duration(milliseconds: 300),

View File

@@ -5,7 +5,7 @@ class ActionRowItem extends StatelessWidget {
final Icon? icon;
final Icon? selectIcon;
final Function? onTap;
final bool? loadingStatus;
final bool? isLoading;
final String? text;
final bool selectStatus;
final Function? onLongPress;
@@ -15,7 +15,7 @@ class ActionRowItem extends StatelessWidget {
this.icon,
this.selectIcon,
this.onTap,
this.loadingStatus,
this.isLoading,
this.text,
this.selectStatus = false,
this.onLongPress,
@@ -53,7 +53,7 @@ class ActionRowItem extends StatelessWidget {
const SizedBox(width: 6),
],
AnimatedOpacity(
opacity: loadingStatus! ? 0 : 1,
opacity: isLoading! ? 0 : 1,
duration: const Duration(milliseconds: 200),
child: AnimatedSwitcher(
duration: const Duration(milliseconds: 300),

View File

@@ -4,9 +4,9 @@ import 'package:flutter/material.dart';
class MenuRow extends StatelessWidget {
const MenuRow({
super.key,
this.loadingStatus,
this.isLoading,
});
final bool? loadingStatus;
final bool? isLoading;
@override
Widget build(BuildContext context) {
@@ -20,28 +20,28 @@ class MenuRow extends StatelessWidget {
child: Row(children: [
ActionRowLineItem(
onTap: () => {},
loadingStatus: loadingStatus,
isLoading: isLoading,
text: '推荐',
selectStatus: false,
),
const SizedBox(width: 8),
ActionRowLineItem(
onTap: () => {},
loadingStatus: loadingStatus,
isLoading: isLoading,
text: '弹幕',
selectStatus: false,
),
const SizedBox(width: 8),
ActionRowLineItem(
onTap: () => {},
loadingStatus: loadingStatus,
isLoading: isLoading,
text: '评论列表',
selectStatus: false,
),
const SizedBox(width: 8),
ActionRowLineItem(
onTap: () => {},
loadingStatus: loadingStatus,
isLoading: isLoading,
text: '播放列表',
selectStatus: false,
),
@@ -51,7 +51,7 @@ class MenuRow extends StatelessWidget {
}
Widget actionRowLineItem(
ThemeData theme, Function? onTap, bool? loadingStatus, String? text,
ThemeData theme, Function? onTap, bool? isLoading, String? text,
{bool selectStatus = false}) {
return Material(
color: selectStatus
@@ -78,7 +78,7 @@ class MenuRow extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
AnimatedOpacity(
opacity: loadingStatus! ? 0 : 1,
opacity: isLoading! ? 0 : 1,
duration: const Duration(milliseconds: 200),
child: Text(
text!,
@@ -103,13 +103,13 @@ class ActionRowLineItem extends StatelessWidget {
required this.selectStatus,
this.onTap,
this.text,
this.loadingStatus = false,
this.isLoading = false,
this.iconData,
this.icon,
});
final bool selectStatus;
final Function? onTap;
final bool? loadingStatus;
final bool? isLoading;
final String? text;
final IconData? iconData;
final Widget? icon;
@@ -152,7 +152,7 @@ class ActionRowLineItem extends StatelessWidget {
else if (icon != null)
icon!,
AnimatedOpacity(
opacity: loadingStatus! ? 0 : 1,
opacity: isLoading! ? 0 : 1,
duration: const Duration(milliseconds: 200),
child: Text(
text!,