mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-17 15:46:14 +08:00
opt ugc intro
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -43,8 +43,8 @@ class VideoCardV extends StatelessWidget {
|
|||||||
PageUtils.toVideoPage(
|
PageUtils.toVideoPage(
|
||||||
'bvid=$bvid&cid=$cid',
|
'bvid=$bvid&cid=$cid',
|
||||||
arguments: {
|
arguments: {
|
||||||
'pic': videoItem.cover,
|
|
||||||
'heroTag': heroTag,
|
'heroTag': heroTag,
|
||||||
|
'videoItem': videoItem,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,10 +54,11 @@ abstract class CommonIntroController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> queryVideoTags() async {
|
Future<void> queryVideoTags() async {
|
||||||
videoTags.value = null;
|
|
||||||
var result = await UserHttp.videoTags(bvid: bvid);
|
var result = await UserHttp.videoTags(bvid: bvid);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
videoTags.value = result['data'];
|
videoTags.value = result['data'];
|
||||||
|
} else {
|
||||||
|
videoTags.value = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,25 +164,28 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
ExpandablePanel(
|
if (isLoading)
|
||||||
controller: introController.expandableCtr,
|
_buildVideoTitle(theme, videoDetail)
|
||||||
collapsed: GestureDetector(
|
else
|
||||||
onLongPress: () {
|
ExpandablePanel(
|
||||||
Feedback.forLongPress(context);
|
controller: introController.expandableCtr,
|
||||||
Utils.copyText(videoDetail.title ?? '');
|
collapsed: GestureDetector(
|
||||||
},
|
onLongPress: () {
|
||||||
child: _buildVideoTitle(theme, videoDetail),
|
Feedback.forLongPress(context);
|
||||||
|
Utils.copyText(videoDetail.title ?? '');
|
||||||
|
},
|
||||||
|
child: _buildVideoTitle(theme, videoDetail),
|
||||||
|
),
|
||||||
|
expanded: GestureDetector(
|
||||||
|
onLongPress: () {
|
||||||
|
Feedback.forLongPress(context);
|
||||||
|
Utils.copyText(videoDetail.title ?? '');
|
||||||
|
},
|
||||||
|
child: _buildVideoTitle(theme, videoDetail,
|
||||||
|
isExpand: true),
|
||||||
|
),
|
||||||
|
theme: expandTheme,
|
||||||
),
|
),
|
||||||
expanded: GestureDetector(
|
|
||||||
onLongPress: () {
|
|
||||||
Feedback.forLongPress(context);
|
|
||||||
Utils.copyText(videoDetail.title ?? '');
|
|
||||||
},
|
|
||||||
child: _buildVideoTitle(theme, videoDetail,
|
|
||||||
isExpand: true),
|
|
||||||
),
|
|
||||||
theme: expandTheme,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Stack(
|
Stack(
|
||||||
clipBehavior: Clip.none,
|
clipBehavior: Clip.none,
|
||||||
@@ -508,8 +511,9 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
|
|||||||
handleState(videoIntroController.actionOneThree),
|
handleState(videoIntroController.actionOneThree),
|
||||||
selectStatus: videoIntroController.hasLike.value,
|
selectStatus: videoIntroController.hasLike.value,
|
||||||
semanticsLabel: '点赞',
|
semanticsLabel: '点赞',
|
||||||
text:
|
text: !isLoading
|
||||||
!isLoading ? NumUtil.numFormat(videoDetail.stat!.like!) : '-',
|
? NumUtil.numFormat(videoDetail.stat!.like!)
|
||||||
|
: null,
|
||||||
needAnim: true,
|
needAnim: true,
|
||||||
hasTriple: videoIntroController.hasLike.value &&
|
hasTriple: videoIntroController.hasLike.value &&
|
||||||
videoIntroController.hasCoin &&
|
videoIntroController.hasCoin &&
|
||||||
@@ -544,8 +548,9 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
|
|||||||
onTap: () => handleState(videoIntroController.actionCoinVideo),
|
onTap: () => handleState(videoIntroController.actionCoinVideo),
|
||||||
selectStatus: videoIntroController.hasCoin,
|
selectStatus: videoIntroController.hasCoin,
|
||||||
semanticsLabel: '投币',
|
semanticsLabel: '投币',
|
||||||
text:
|
text: !isLoading
|
||||||
!isLoading ? NumUtil.numFormat(videoDetail.stat!.coin!) : '-',
|
? NumUtil.numFormat(videoDetail.stat!.coin!)
|
||||||
|
: null,
|
||||||
needAnim: true,
|
needAnim: true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -561,7 +566,7 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
|
|||||||
semanticsLabel: '收藏',
|
semanticsLabel: '收藏',
|
||||||
text: !isLoading
|
text: !isLoading
|
||||||
? NumUtil.numFormat(videoDetail.stat!.favorite!)
|
? NumUtil.numFormat(videoDetail.stat!.favorite!)
|
||||||
: '-',
|
: null,
|
||||||
needAnim: true,
|
needAnim: true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -581,7 +586,7 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
|
|||||||
selectStatus: false,
|
selectStatus: false,
|
||||||
semanticsLabel: '分享',
|
semanticsLabel: '分享',
|
||||||
text:
|
text:
|
||||||
!isLoading ? NumUtil.numFormat(videoDetail.stat!.share!) : '分享',
|
!isLoading ? NumUtil.numFormat(videoDetail.stat!.share!) : null,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -121,84 +121,78 @@ class ActionItemState extends State<ActionItem>
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
return widget.expand == false
|
final hasText = widget.text != null;
|
||||||
? _buildItem(theme)
|
final text = Text(
|
||||||
: Expanded(child: _buildItem(theme));
|
hasText ? widget.text! : '-',
|
||||||
}
|
key: hasText ? ValueKey(widget.text!) : null,
|
||||||
|
style: TextStyle(
|
||||||
Widget _buildItem(ThemeData theme) => Semantics(
|
color: widget.selectStatus
|
||||||
label: (widget.text ?? "") +
|
? theme.colorScheme.primary
|
||||||
(widget.selectStatus ? "已" : "") +
|
: theme.colorScheme.outline,
|
||||||
widget.semanticsLabel,
|
fontSize: theme.textTheme.labelSmall!.fontSize,
|
||||||
child: Material(
|
),
|
||||||
type: MaterialType.transparency,
|
);
|
||||||
child: InkWell(
|
final child = Material(
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(6)),
|
type: MaterialType.transparency,
|
||||||
onTap: _isThumbsUp
|
child: InkWell(
|
||||||
? null
|
borderRadius: const BorderRadius.all(Radius.circular(6)),
|
||||||
: () {
|
onTap: _isThumbsUp
|
||||||
feedBack();
|
? null
|
||||||
widget.onTap?.call();
|
: () {
|
||||||
},
|
feedBack();
|
||||||
onLongPress: _isThumbsUp ? null : widget.onLongPress,
|
widget.onTap?.call();
|
||||||
onTapDown: _isThumbsUp ? (details) => _startLongPress() : null,
|
},
|
||||||
onTapUp: _isThumbsUp ? (details) => _cancelLongPress() : null,
|
onLongPress: _isThumbsUp ? null : widget.onLongPress,
|
||||||
onTapCancel: _isThumbsUp ? () => _cancelLongPress(true) : null,
|
onTapDown: _isThumbsUp ? (details) => _startLongPress() : null,
|
||||||
child: Column(
|
onTapUp: _isThumbsUp ? (details) => _cancelLongPress() : null,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
onTapCancel: _isThumbsUp ? () => _cancelLongPress(true) : null,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Stack(
|
||||||
|
clipBehavior: Clip.none,
|
||||||
|
alignment: Alignment.center,
|
||||||
children: [
|
children: [
|
||||||
Stack(
|
if (widget.needAnim)
|
||||||
clipBehavior: Clip.none,
|
AnimatedBuilder(
|
||||||
alignment: Alignment.center,
|
animation: _animation!,
|
||||||
children: [
|
builder: (context, child) => CustomPaint(
|
||||||
if (widget.needAnim)
|
size: const Size(28, 28),
|
||||||
AnimatedBuilder(
|
painter: _ArcPainter(
|
||||||
animation: _animation!,
|
color: theme.colorScheme.primary,
|
||||||
builder: (context, child) => CustomPaint(
|
sweepAngle: _animation!.value,
|
||||||
size: const Size(28, 28),
|
|
||||||
painter: _ArcPainter(
|
|
||||||
color: theme.colorScheme.primary,
|
|
||||||
sweepAngle: _animation!.value,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
else
|
|
||||||
const SizedBox(width: 28, height: 28),
|
|
||||||
Icon(
|
|
||||||
widget.selectStatus
|
|
||||||
? widget.selectIcon!.icon!
|
|
||||||
: widget.icon.icon,
|
|
||||||
size: 18,
|
|
||||||
color: widget.selectStatus
|
|
||||||
? theme.colorScheme.primary
|
|
||||||
: widget.icon.color ?? theme.colorScheme.outline,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
if (widget.text != null)
|
|
||||||
AnimatedSwitcher(
|
|
||||||
duration: const Duration(milliseconds: 300),
|
|
||||||
transitionBuilder:
|
|
||||||
(Widget child, Animation<double> animation) {
|
|
||||||
return ScaleTransition(scale: animation, child: child);
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
widget.text!,
|
|
||||||
key: ValueKey(widget.text!),
|
|
||||||
style: TextStyle(
|
|
||||||
color: widget.selectStatus
|
|
||||||
? theme.colorScheme.primary
|
|
||||||
: theme.colorScheme.outline,
|
|
||||||
fontSize: theme.textTheme.labelSmall!.fontSize,
|
|
||||||
),
|
),
|
||||||
semanticsLabel: "",
|
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
|
else
|
||||||
|
const SizedBox(width: 28, height: 28),
|
||||||
|
Icon(
|
||||||
|
widget.selectStatus
|
||||||
|
? widget.selectIcon!.icon!
|
||||||
|
: widget.icon.icon,
|
||||||
|
size: 18,
|
||||||
|
color: widget.selectStatus
|
||||||
|
? theme.colorScheme.primary
|
||||||
|
: widget.icon.color ?? theme.colorScheme.outline,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
if (widget.text != null)
|
||||||
|
AnimatedSwitcher(
|
||||||
|
duration: const Duration(milliseconds: 300),
|
||||||
|
transitionBuilder: (Widget child, Animation<double> animation) {
|
||||||
|
return ScaleTransition(scale: animation, child: child);
|
||||||
|
},
|
||||||
|
child: text,
|
||||||
|
)
|
||||||
|
else
|
||||||
|
text
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
|
);
|
||||||
|
return widget.expand == false ? child : Expanded(child: child);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ArcPainter extends CustomPainter {
|
class _ArcPainter extends CustomPainter {
|
||||||
|
|||||||
Reference in New Issue
Block a user