fix

report im msg

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2026-01-07 11:05:16 +08:00
parent 5a0b045a1f
commit 9855b35b65
14 changed files with 343 additions and 199 deletions

View File

@@ -1,6 +1,7 @@
import 'dart:async';
import 'dart:io' show File;
import 'package:PiliPlus/common/widgets/dialog/report.dart';
import 'package:PiliPlus/common/widgets/flutter/text_field/text_field.dart';
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
import 'package:PiliPlus/common/widgets/loading_widget/loading_widget.dart';
@@ -168,14 +169,18 @@ class _WhisperDetailPageState
_whisperDetailController.onLoadMore();
}
final item = response[index];
final isOwner =
item.senderUid.toInt() ==
_whisperDetailController.account.mid;
return ChatItem(
item: item,
eInfos: _whisperDetailController.eInfos,
onLongPress:
item.senderUid.toInt() ==
_whisperDetailController.account.mid
? () => onLongPress(index, item)
onLongPress: () => onLongPress(index, item, isOwner),
onSecondaryTapUp: PlatformUtils.isDesktop
? (e) =>
_showMenu(e.globalPosition, index, item, isOwner)
: null,
isOwner: isOwner,
);
},
separatorBuilder: (context, index) =>
@@ -189,34 +194,86 @@ class _WhisperDetailPageState
};
}
void onLongPress(int index, Msg item) {
void _showMenu(Offset offset, int index, Msg item, bool isOwner) {
showMenu(
context: context,
position: .fromLTRB(offset.dx, offset.dy, offset.dx, 0),
items: [
if (isOwner)
PopupMenuItem(
height: 42,
onTap: () => _whisperDetailController.sendMsg(
message: '${item.msgKey}',
onClearText: editController.clear,
msgType: 5,
index: index,
),
child: const Text('撤回', style: TextStyle(fontSize: 14)),
)
else
PopupMenuItem(
height: 42,
onTap: () => autoWrapReportDialog(
context,
ban: false,
ReportOptions.imMsgReport,
(reasonType, reasonDesc, banUid) =>
_whisperDetailController.onReport(
item,
reasonType,
reasonType == 0
? reasonDesc!
: ReportOptions.imMsgReport['']![reasonType]!,
),
),
child: const Text('举报', style: TextStyle(fontSize: 14)),
),
],
);
}
void onLongPress(int index, Msg item, bool isOwner) {
Feedback.forLongPress(context);
showDialog(
context: context,
builder: (context) {
return AlertDialog(
clipBehavior: Clip.hardEdge,
contentPadding: const EdgeInsets.symmetric(vertical: 12),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
onTap: () {
Get.back();
_whisperDetailController.sendMsg(
message: '${item.msgKey}',
onClearText: editController.clear,
msgType: 5,
index: index,
);
},
dense: true,
title: const Text(
'撤回',
style: TextStyle(fontSize: 14),
content: isOwner
? ListTile(
onTap: () {
Get.back();
_whisperDetailController.sendMsg(
message: '${item.msgKey}',
onClearText: editController.clear,
msgType: 5,
index: index,
);
},
dense: true,
title: const Text('撤回', style: TextStyle(fontSize: 14)),
)
: ListTile(
onTap: () {
Get.back();
autoWrapReportDialog(
context,
ban: false,
ReportOptions.imMsgReport,
(reasonType, reasonDesc, banUid) =>
_whisperDetailController.onReport(
item,
reasonType,
reasonType == 0
? reasonDesc!
: ReportOptions.imMsgReport['']![reasonType]!,
),
);
},
dense: true,
title: const Text('举报', style: TextStyle(fontSize: 14)),
),
),
],
),
);
},
);