mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-24 01:58:36 +00:00
@@ -204,7 +204,24 @@ class _MusicDetailPageState extends CommonDynPageState<MusicDetailPage> {
|
||||
});
|
||||
|
||||
Widget _buildBottom(ThemeData theme, MusicDetail item) {
|
||||
if (!controller.showDynActionBar) {
|
||||
return Positioned(
|
||||
right: kFloatingActionButtonMargin,
|
||||
bottom: 0,
|
||||
child: SlideTransition(
|
||||
position: fabAnimation,
|
||||
child: fabButton,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final primary = theme.colorScheme.primary;
|
||||
final outline = theme.colorScheme.outline;
|
||||
final style = TextButton.styleFrom(
|
||||
tapTargetSize: .padded,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||
foregroundColor: outline,
|
||||
);
|
||||
|
||||
Widget textIconButton({
|
||||
required IconData icon,
|
||||
@@ -214,7 +231,7 @@ class _MusicDetailPageState extends CommonDynPageState<MusicDetailPage> {
|
||||
required VoidCallback onPressed,
|
||||
IconData? activatedIcon,
|
||||
}) {
|
||||
final color = status ? theme.colorScheme.primary : outline;
|
||||
final color = status ? primary : outline;
|
||||
return TextButton.icon(
|
||||
onPressed: onPressed,
|
||||
icon: Icon(
|
||||
@@ -222,11 +239,7 @@ class _MusicDetailPageState extends CommonDynPageState<MusicDetailPage> {
|
||||
size: 16,
|
||||
color: color,
|
||||
),
|
||||
style: TextButton.styleFrom(
|
||||
tapTargetSize: .padded,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||
foregroundColor: outline,
|
||||
),
|
||||
style: style,
|
||||
label: Text(
|
||||
count != null ? NumUtils.numFormat(count) : text,
|
||||
style: TextStyle(color: color),
|
||||
@@ -239,116 +252,104 @@ class _MusicDetailPageState extends CommonDynPageState<MusicDetailPage> {
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: SlideTransition(
|
||||
position: fabAnim,
|
||||
child: controller.showDynActionBar
|
||||
? Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
right: kFloatingActionButtonMargin,
|
||||
bottom: kFloatingActionButtonMargin,
|
||||
position: fabAnimation,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
right: kFloatingActionButtonMargin,
|
||||
bottom: kFloatingActionButtonMargin,
|
||||
),
|
||||
child: replyButton,
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.surface,
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
color: theme.colorScheme.outline.withValues(
|
||||
alpha: 0.08,
|
||||
),
|
||||
child: replyButton,
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.surface,
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
color: theme.colorScheme.outline.withValues(
|
||||
alpha: 0.08,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.only(bottom: padding.bottom),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
// TODO
|
||||
// Expanded(
|
||||
// child: textIconButton(
|
||||
// icon: FontAwesomeIcons.shareFromSquare,
|
||||
// text: '转发',
|
||||
// count: item.musicShares,
|
||||
// onPressed: () {
|
||||
// final data = controller.infoState.value.dataOrNull;
|
||||
// if (data != null) {
|
||||
// showModalBottomSheet(
|
||||
// context: context,
|
||||
// isScrollControlled: true,
|
||||
// useSafeArea: true,
|
||||
// builder: (context) => RepostPanel(
|
||||
// rid: controller.oid,
|
||||
// dynType: null,
|
||||
// pic: data.mvCover,
|
||||
// title: data.musicTitle,
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
Expanded(
|
||||
child: textIconButton(
|
||||
icon: CustomIcons.share_node,
|
||||
text: '分享',
|
||||
onPressed: () => Utils.shareText(controller.shareUrl),
|
||||
),
|
||||
padding: EdgeInsets.only(bottom: padding.bottom),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
// TODO
|
||||
// Expanded(
|
||||
// child: textIconButton(
|
||||
// icon: FontAwesomeIcons.shareFromSquare,
|
||||
// text: '转发',
|
||||
// count: item.musicShares,
|
||||
// onPressed: () {
|
||||
// final data = controller.infoState.value.dataOrNull;
|
||||
// if (data != null) {
|
||||
// showModalBottomSheet(
|
||||
// context: context,
|
||||
// isScrollControlled: true,
|
||||
// useSafeArea: true,
|
||||
// builder: (context) => RepostPanel(
|
||||
// rid: controller.oid,
|
||||
// dynType: null,
|
||||
// pic: data.mvCover,
|
||||
// title: data.musicTitle,
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
Expanded(
|
||||
child: textIconButton(
|
||||
icon: CustomIcons.share_node,
|
||||
text: '分享',
|
||||
onPressed: () =>
|
||||
Utils.shareText(controller.shareUrl),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Builder(
|
||||
builder: (context) => textIconButton(
|
||||
icon: FontAwesomeIcons.thumbsUp,
|
||||
activatedIcon: FontAwesomeIcons.solidThumbsUp,
|
||||
text: '点赞',
|
||||
count: item.wishCount,
|
||||
status: item.wishListen ?? false,
|
||||
onPressed: () async {
|
||||
if (!Accounts.main.isLogin) {
|
||||
SmartDialog.showToast('请先登录');
|
||||
return;
|
||||
}
|
||||
final hasLike = item.wishListen ?? false;
|
||||
final res = await MusicHttp.wishUpdate(
|
||||
controller.musicId,
|
||||
hasLike,
|
||||
);
|
||||
if (res.isSuccess) {
|
||||
if (hasLike) {
|
||||
item.wishCount--;
|
||||
} else {
|
||||
item.wishCount++;
|
||||
}
|
||||
item.wishListen = !hasLike;
|
||||
if (context.mounted) {
|
||||
(context as Element).markNeedsBuild();
|
||||
}
|
||||
} else {
|
||||
res.toast();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: Builder(
|
||||
builder: (context) => textIconButton(
|
||||
icon: FontAwesomeIcons.thumbsUp,
|
||||
activatedIcon: FontAwesomeIcons.solidThumbsUp,
|
||||
text: '点赞',
|
||||
count: item.wishCount,
|
||||
status: item.wishListen ?? false,
|
||||
onPressed: () async {
|
||||
if (!Accounts.main.isLogin) {
|
||||
SmartDialog.showToast('请先登录');
|
||||
return;
|
||||
}
|
||||
final hasLike = item.wishListen ?? false;
|
||||
final res = await MusicHttp.wishUpdate(
|
||||
controller.musicId,
|
||||
hasLike,
|
||||
);
|
||||
if (res.isSuccess) {
|
||||
if (hasLike) {
|
||||
item.wishCount--;
|
||||
} else {
|
||||
item.wishCount++;
|
||||
}
|
||||
item.wishListen = !hasLike;
|
||||
if (context.mounted) {
|
||||
(context as Element).markNeedsBuild();
|
||||
}
|
||||
} else {
|
||||
res.toast();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Align(
|
||||
alignment: Alignment.bottomRight,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
right: kFloatingActionButtonMargin,
|
||||
bottom: padding.bottom + kFloatingActionButtonMargin,
|
||||
),
|
||||
child: replyButton,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user