mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-08-04 17:50:13 +08:00
@@ -7,6 +7,8 @@ import 'package:PiliPlus/common/widgets/flutter/refresh_indicator.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/common/widgets/image_viewer/hero.dart';
|
||||
import 'package:PiliPlus/common/widgets/marquee.dart';
|
||||
import 'package:PiliPlus/common/widgets/scaffold/mini_scaffold.dart';
|
||||
import 'package:PiliPlus/common/widgets/scaffold/simple_scaffold.dart';
|
||||
import 'package:PiliPlus/common/widgets/selection_text.dart';
|
||||
import 'package:PiliPlus/common/widgets/sliver/sliver_to_box_adapter.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
@@ -54,20 +56,20 @@ class _MusicDetailPageState extends CommonDynPageState<MusicDetailPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final child = Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: _buildAppBar(),
|
||||
body: Padding(
|
||||
padding: EdgeInsets.only(left: padding.left, right: padding.right),
|
||||
child: isPortrait
|
||||
? refreshIndicator(
|
||||
onRefresh: controller.onRefresh,
|
||||
child: _buildBody(),
|
||||
)
|
||||
: _buildBody(),
|
||||
return fabAnimWrapper(
|
||||
child: SimpleScaffold(
|
||||
appBar: _buildAppBar(),
|
||||
body: Padding(
|
||||
padding: EdgeInsets.only(left: padding.left, right: padding.right),
|
||||
child: isPortrait
|
||||
? refreshIndicator(
|
||||
onRefresh: controller.onRefresh,
|
||||
child: _buildBody(),
|
||||
)
|
||||
: _buildBody(),
|
||||
),
|
||||
),
|
||||
);
|
||||
return fabAnimWrapper(child: child);
|
||||
}
|
||||
|
||||
PreferredSizeWidget _buildAppBar() => AppBar(
|
||||
@@ -171,9 +173,7 @@ class _MusicDetailPageState extends CommonDynPageState<MusicDetailPage> {
|
||||
flex: flex1,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(right: padding),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
resizeToAvoidBottomInset: false,
|
||||
child: MiniScaffold(
|
||||
body: refreshIndicator(
|
||||
onRefresh: controller.onRefresh,
|
||||
child: CustomScrollView(
|
||||
@@ -192,12 +192,9 @@ class _MusicDetailPageState extends CommonDynPageState<MusicDetailPage> {
|
||||
],
|
||||
);
|
||||
}
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
child,
|
||||
_buildBottom(response),
|
||||
],
|
||||
return ScaffoldLayout(
|
||||
body: child,
|
||||
fab: _buildBottom(response),
|
||||
);
|
||||
default:
|
||||
return const SizedBox.shrink();
|
||||
@@ -206,9 +203,8 @@ class _MusicDetailPageState extends CommonDynPageState<MusicDetailPage> {
|
||||
|
||||
Widget _buildBottom(MusicDetail item) {
|
||||
if (!controller.showDynActionBar) {
|
||||
return Positioned(
|
||||
right: kFloatingActionButtonMargin,
|
||||
bottom: 0,
|
||||
return Padding(
|
||||
padding: const .only(right: kFloatingActionButtonMargin),
|
||||
child: SlideTransition(
|
||||
position: fabAnimation,
|
||||
child: fabButton,
|
||||
@@ -248,110 +244,104 @@ class _MusicDetailPageState extends CommonDynPageState<MusicDetailPage> {
|
||||
);
|
||||
}
|
||||
|
||||
return Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: SlideTransition(
|
||||
position: fabAnimation,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
right: kFloatingActionButtonMargin,
|
||||
bottom: kFloatingActionButtonMargin,
|
||||
),
|
||||
child: replyButton,
|
||||
return SlideTransition(
|
||||
position: fabAnimation,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
right: kFloatingActionButtonMargin,
|
||||
bottom: kFloatingActionButtonMargin,
|
||||
),
|
||||
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: () =>
|
||||
ShareUtils.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();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
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: () => ShareUtils.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();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user