Skip to content

Commit 44b0f4b

Browse files
committed
feat(card): copy pid in context menu
1 parent dafd0b4 commit 44b0f4b

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

lib/i18n/en.i18n.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,8 @@
823823
},
824824
"share": "Copy share link",
825825
"openInBrowser": "Open in browser",
826-
"copyText": "Copy Text"
826+
"copyText": "Copy Text",
827+
"copyPid": "Copy pid (${pid: String})"
827828
},
828829
"packetCard": {
829830
"title": "Packet",

lib/i18n/zh-CN.i18n.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,8 @@
823823
},
824824
"share": "复制分享链接",
825825
"openInBrowser": "在浏览器中打开",
826-
"copyText": "复制文字"
826+
"copyText": "复制文字",
827+
"copyPid": "复制pid(${pid: String})"
827828
},
828829
"packetCard": {
829830
"title": "红包",

lib/i18n/zh-TW.i18n.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,8 @@
823823
},
824824
"share": "複製分享連結",
825825
"openInBrowser": "在瀏覽器中開啟",
826-
"copyText": "複製文字"
826+
"copyText": "複製文字",
827+
"copyPid": "複製pid(${pid: String})"
827828
},
828829
"packetCard": {
829830
"title": "紅包",

lib/widgets/card/post_card/post_card.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ enum _PostCardActions {
5959

6060
/// Open the dialog to copy contents.
6161
openAndCopy,
62+
63+
/// Copy post id.
64+
copyPid,
6265
}
6366

6467
/// Card for a [Post] model.
@@ -345,6 +348,16 @@ class _PostCardState extends State<PostCard> with AutomaticKeepAliveClientMixin
345348
],
346349
),
347350
),
351+
PopupMenuItem(
352+
value: _PostCardActions.copyPid,
353+
child: Row(
354+
children: [
355+
const Icon(Icons.numbers_outlined),
356+
sizedBoxPopupMenuItemIconSpacing,
357+
Text(context.t.postCard.copyPid(pid: widget.post.postID)),
358+
],
359+
),
360+
),
348361
],
349362
],
350363
onSelected: (value) async {
@@ -394,6 +407,8 @@ class _PostCardState extends State<PostCard> with AutomaticKeepAliveClientMixin
394407
.join() ??
395408
'';
396409
await showCopySelectContentDialog(context: context, data: data);
410+
case _PostCardActions.copyPid:
411+
await copyToClipboard(context, widget.post.postID);
397412
}
398413
},
399414
),

0 commit comments

Comments
 (0)