feat: reply: sync to dyn

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-02-03 11:40:37 +08:00
parent 6c96b3a7f5
commit e368436bc6
3 changed files with 54 additions and 23 deletions

View File

@@ -759,6 +759,7 @@ class VideoHttp {
int? root,
int? parent,
List? pictures,
bool? syncToDynamic,
}) async {
if (message == '') {
return {'status': false, 'data': [], 'msg': '请输入评论内容'};
@@ -766,10 +767,11 @@ class VideoHttp {
Map<String, dynamic> data = {
'type': type.index,
'oid': oid,
'root': root == null || root == 0 ? '' : root,
'parent': parent == null || parent == 0 ? '' : parent,
if (root != null && root != 0) 'root': root,
if (parent != null && parent != 0) 'parent': parent,
'message': message,
if (pictures != null) 'pictures': jsonEncode(pictures),
if (syncToDynamic == true) 'sync_to_dynamic': 1,
'csrf': await Request.getCsrf(),
};
var res = await Request().post(

View File

@@ -306,6 +306,25 @@ class AuthorPanel extends StatelessWidget {
},
minLeadingWidth: 0,
),
if (GStorage.isLogin)
ListTile(
title: Text(
'举报',
style: Theme.of(context).textTheme.titleSmall!.copyWith(
color: Theme.of(context).colorScheme.error,
),
),
leading: Icon(
Icons.error_outline_outlined,
size: 19,
color: Theme.of(context).colorScheme.error,
),
onTap: () {
Get.back();
_showReportDynDialog(context);
},
minLeadingWidth: 0,
),
if (item.modules.moduleAuthor.mid ==
GStorage.userInfo.get('userInfoCache')?.mid &&
onRemove != null)
@@ -345,25 +364,6 @@ class AuthorPanel extends StatelessWidget {
.titleSmall!
.copyWith(color: Theme.of(context).colorScheme.error)),
),
if (GStorage.isLogin)
ListTile(
title: Text(
'举报',
style: Theme.of(context).textTheme.titleSmall!.copyWith(
color: Theme.of(context).colorScheme.error,
),
),
leading: Icon(
Icons.error_outline_outlined,
size: 19,
color: Theme.of(context).colorScheme.error,
),
onTap: () {
Get.back();
_showReportDynDialog(context);
},
minLeadingWidth: 0,
),
const Divider(thickness: 0.1, height: 1),
ListTile(
onTap: Get.back,

View File

@@ -34,6 +34,8 @@ class ReplyPage extends CommonPublishPage {
}
class _ReplyPageState extends CommonPublishPageState<ReplyPage> {
RxBool _syncToDynamic = false.obs;
@override
Widget build(BuildContext context) {
return MediaQuery.removePadding(
@@ -177,7 +179,7 @@ class _ReplyPageState extends CommonPublishPageState<ReplyPage> {
selected: selectKeyboard.value,
),
),
const SizedBox(width: 20),
const SizedBox(width: 10),
Obx(
() => ToolbarIconButton(
tooltip: '表情',
@@ -192,7 +194,7 @@ class _ReplyPageState extends CommonPublishPageState<ReplyPage> {
),
),
if (widget.root == 0) ...[
const SizedBox(width: 20),
const SizedBox(width: 10),
ToolbarIconButton(
tooltip: '图片',
selected: false,
@@ -201,6 +203,32 @@ class _ReplyPageState extends CommonPublishPageState<ReplyPage> {
),
],
const Spacer(),
Obx(
() => TextButton.icon(
style: TextButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 15, vertical: 13),
visualDensity: const VisualDensity(
horizontal: -2,
vertical: -2,
),
foregroundColor: _syncToDynamic.value
? Theme.of(context).colorScheme.secondary
: Theme.of(context).colorScheme.outline,
),
onPressed: () {
_syncToDynamic.value = !_syncToDynamic.value;
},
icon: Icon(
_syncToDynamic.value
? Icons.check_box
: Icons.check_box_outline_blank,
size: 22,
),
label: const Text('转发至动态'),
),
),
const Spacer(),
Obx(
() => FilledButton.tonal(
onPressed: enablePublish.value ? onPublish : null,
@@ -234,6 +262,7 @@ class _ReplyPageState extends CommonPublishPageState<ReplyPage> {
? ' 回复 @${GlobalData().grpcReply ? widget.replyItem.member.name : widget.replyItem.member.uname} : $message'
: message,
pictures: pictures,
syncToDynamic: _syncToDynamic.value,
);
if (result['status']) {
SmartDialog.showToast(result['data']['success_toast']);