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

View File

@@ -306,6 +306,25 @@ class AuthorPanel extends StatelessWidget {
}, },
minLeadingWidth: 0, 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 == if (item.modules.moduleAuthor.mid ==
GStorage.userInfo.get('userInfoCache')?.mid && GStorage.userInfo.get('userInfoCache')?.mid &&
onRemove != null) onRemove != null)
@@ -345,25 +364,6 @@ class AuthorPanel extends StatelessWidget {
.titleSmall! .titleSmall!
.copyWith(color: Theme.of(context).colorScheme.error)), .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), const Divider(thickness: 0.1, height: 1),
ListTile( ListTile(
onTap: Get.back, onTap: Get.back,

View File

@@ -34,6 +34,8 @@ class ReplyPage extends CommonPublishPage {
} }
class _ReplyPageState extends CommonPublishPageState<ReplyPage> { class _ReplyPageState extends CommonPublishPageState<ReplyPage> {
RxBool _syncToDynamic = false.obs;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MediaQuery.removePadding( return MediaQuery.removePadding(
@@ -177,7 +179,7 @@ class _ReplyPageState extends CommonPublishPageState<ReplyPage> {
selected: selectKeyboard.value, selected: selectKeyboard.value,
), ),
), ),
const SizedBox(width: 20), const SizedBox(width: 10),
Obx( Obx(
() => ToolbarIconButton( () => ToolbarIconButton(
tooltip: '表情', tooltip: '表情',
@@ -192,7 +194,7 @@ class _ReplyPageState extends CommonPublishPageState<ReplyPage> {
), ),
), ),
if (widget.root == 0) ...[ if (widget.root == 0) ...[
const SizedBox(width: 20), const SizedBox(width: 10),
ToolbarIconButton( ToolbarIconButton(
tooltip: '图片', tooltip: '图片',
selected: false, selected: false,
@@ -201,6 +203,32 @@ class _ReplyPageState extends CommonPublishPageState<ReplyPage> {
), ),
], ],
const Spacer(), 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( Obx(
() => FilledButton.tonal( () => FilledButton.tonal(
onPressed: enablePublish.value ? onPublish : null, 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' ? ' 回复 @${GlobalData().grpcReply ? widget.replyItem.member.name : widget.replyItem.member.uname} : $message'
: message, : message,
pictures: pictures, pictures: pictures,
syncToDynamic: _syncToDynamic.value,
); );
if (result['status']) { if (result['status']) {
SmartDialog.showToast(result['data']['success_toast']); SmartDialog.showToast(result['data']['success_toast']);