mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 11:08:03 +08:00
@@ -32,32 +32,38 @@ class ActionPanel extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextButton.icon(
|
||||
onPressed: () => showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
useSafeArea: true,
|
||||
builder: (_) => RepostPanel(
|
||||
item: item,
|
||||
onSuccess: () {
|
||||
int count = forward.count ?? 0;
|
||||
forward.count = count + 1;
|
||||
if (context.mounted) {
|
||||
(context as Element?)?.markNeedsBuild();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.shareFromSquare,
|
||||
size: 16,
|
||||
color: outline,
|
||||
semanticLabel: "转发",
|
||||
),
|
||||
style: btnStyle,
|
||||
label: Text(
|
||||
forward.count != null ? NumUtils.numFormat(forward.count) : '转发',
|
||||
),
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
return TextButton.icon(
|
||||
onPressed: () => showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
useSafeArea: true,
|
||||
builder: (_) => RepostPanel(
|
||||
item: item,
|
||||
onSuccess: () {
|
||||
int count = forward.count ?? 0;
|
||||
forward.count = count + 1;
|
||||
if (context.mounted) {
|
||||
(context as Element?)?.markNeedsBuild();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.shareFromSquare,
|
||||
size: 16,
|
||||
color: outline,
|
||||
semanticLabel: "转发",
|
||||
),
|
||||
style: btnStyle,
|
||||
label: Text(
|
||||
forward.count != null
|
||||
? NumUtils.numFormat(forward.count)
|
||||
: '转发',
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@@ -76,32 +82,40 @@ class ActionPanel extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: TextButton.icon(
|
||||
onPressed: () => RequestUtils.onLikeDynamic(item, () {
|
||||
if (context.mounted) {
|
||||
(context as Element?)?.markNeedsBuild();
|
||||
}
|
||||
}),
|
||||
icon: Icon(
|
||||
like.status!
|
||||
? FontAwesomeIcons.solidThumbsUp
|
||||
: FontAwesomeIcons.thumbsUp,
|
||||
size: 16,
|
||||
color: like.status! ? primary : outline,
|
||||
semanticLabel: like.status! ? "已赞" : "点赞",
|
||||
),
|
||||
style: btnStyle,
|
||||
label: AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 400),
|
||||
transitionBuilder: (Widget child, Animation<double> animation) {
|
||||
return ScaleTransition(scale: animation, child: child);
|
||||
},
|
||||
child: Text(
|
||||
like.count != null ? NumUtils.numFormat(like.count) : '点赞',
|
||||
key: ValueKey<int?>(like.count),
|
||||
style: TextStyle(color: like.status! ? primary : outline),
|
||||
),
|
||||
),
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
final likeIcon = Icon(
|
||||
like.status!
|
||||
? FontAwesomeIcons.solidThumbsUp
|
||||
: FontAwesomeIcons.thumbsUp,
|
||||
size: 16,
|
||||
color: like.status! ? primary : outline,
|
||||
semanticLabel: like.status! ? "已赞" : "点赞",
|
||||
);
|
||||
return TextButton.icon(
|
||||
onPressed: () => RequestUtils.onLikeDynamic(
|
||||
item,
|
||||
likeIcon.color == primary,
|
||||
() {
|
||||
if (context.mounted) {
|
||||
(context as Element?)?.markNeedsBuild();
|
||||
}
|
||||
},
|
||||
),
|
||||
icon: likeIcon,
|
||||
style: btnStyle,
|
||||
label: AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 400),
|
||||
transitionBuilder: (child, animation) =>
|
||||
ScaleTransition(scale: animation, child: child),
|
||||
child: Text(
|
||||
like.count != null ? NumUtils.numFormat(like.count) : '点赞',
|
||||
key: ValueKey<int?>(like.count),
|
||||
style: TextStyle(color: like.status! ? primary : outline),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user