diff --git a/lib/common/widgets/radio_widget.dart b/lib/common/widgets/radio_widget.dart index 98143081..fa8c26d1 100644 --- a/lib/common/widgets/radio_widget.dart +++ b/lib/common/widgets/radio_widget.dart @@ -5,21 +5,26 @@ Widget radioWidget({ T? groupValue, required ValueChanged onChanged, required String title, - double? paddingStart, + EdgeInsetsGeometry? padding, }) { + Widget child() => Row( + children: [ + Radio( + value: value, + groupValue: groupValue, + onChanged: onChanged, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + Text(title), + ], + ); return InkWell( onTap: () => onChanged(value), - child: Row( - children: [ - if (paddingStart != null) SizedBox(width: paddingStart), - Radio( - value: value, - groupValue: groupValue, - onChanged: onChanged, - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - ), - Text(title), - ], - ), + child: padding != null + ? Padding( + padding: padding, + child: child(), + ) + : child(), ); } diff --git a/lib/common/widgets/report.dart b/lib/common/widgets/report.dart index b89b115c..76996e8c 100644 --- a/lib/common/widgets/report.dart +++ b/lib/common/widgets/report.dart @@ -47,7 +47,9 @@ void autoWrapReportDialog( padding: const EdgeInsets.only(left: 22), child: Text( title.key, - style: Theme.of(context).textTheme.labelSmall, + style: TextStyle( + color: + Theme.of(context).colorScheme.outline), ), ), Padding( @@ -59,6 +61,7 @@ void autoWrapReportDialog( value: opt.key, groupValue: reasonType, title: opt.value, + padding: const EdgeInsets.only(right: 10), onChanged: (value) { reasonType = value; if (context.mounted) { @@ -105,21 +108,36 @@ void autoWrapReportDialog( ), ), ), - Padding( - padding: const EdgeInsets.only(left: 12, top: 12), - child: Row( - children: [ - Checkbox( - value: banUid, - onChanged: (v) { - banUid = v ?? false; - (context as Element?)?.markNeedsBuild(); - }, - materialTapTargetSize: - MaterialTapTargetSize.shrinkWrap, - ), - const Text('拉黑该用户'), - ], + GestureDetector( + onTap: () { + banUid = !banUid; + (context as Element?)?.markNeedsBuild(); + }, + child: Padding( + padding: const EdgeInsets.only(left: 18, top: 10), + child: Row( + children: [ + Icon( + size: 22, + banUid + ? Icons.check_box_outlined + : Icons.check_box_outline_blank, + color: banUid + ? Theme.of(context).colorScheme.primary + : Theme.of(context) + .colorScheme + .onSurfaceVariant, + ), + Text( + ' 拉黑该用户', + style: TextStyle( + color: banUid + ? Theme.of(context).colorScheme.primary + : null, + ), + ), + ], + ), ), ), ], @@ -145,6 +163,7 @@ void autoWrapReportDialog( SmartDialog.showLoading(); try { final data = await onSuccess(reasonType!, reasonDesc, banUid); + SmartDialog.dismiss(); if (data['code'] == 0) { Get.back(); SmartDialog.showToast('举报成功'); @@ -152,9 +171,8 @@ void autoWrapReportDialog( SmartDialog.showToast(data['message']); } } catch (e) { - SmartDialog.showToast('提交失败:$e'); - } finally { SmartDialog.dismiss(); + SmartDialog.showToast('提交失败:$e'); } }, child: const Text('确定'), @@ -167,34 +185,34 @@ void autoWrapReportDialog( class ReportOptions { // from https://s1.hdslb.com/bfs/seed/jinkela/comment-h5/static/js/605.chunks.js - static const Map> commentReport = { - '违反法律法规': {9: '违法违规', 2: '色情', 10: '低俗', 12: '赌博诈骗', 23: '违法信息外链'}, - '谣言类不实信息': {19: '涉政谣言', 22: '虚假不实信息', 20: '涉社会事件谣言'}, - '侵犯个人权益': {7: '人身攻击', 15: '侵犯隐私'}, - '有害社区环境': { - 1: '垃圾广告', - 4: '引战', - 5: '剧透', - 3: '刷屏', - 8: '视频不相关', - 18: '违规抽奖', - 17: '青少年不良信息', - }, - '其他': {0: '其他'}, - }; + static Map> get commentReport => { + '违反法律法规': {9: '违法违规', 2: '色情', 10: '低俗', 12: '赌博诈骗', 23: '违法信息外链'}, + '谣言类不实信息': {19: '涉政谣言', 22: '虚假不实信息', 20: '涉社会事件谣言'}, + '侵犯个人权益': {7: '人身攻击', 15: '侵犯隐私'}, + '有害社区环境': { + 1: '垃圾广告', + 4: '引战', + 5: '剧透', + 3: '刷屏', + 8: '视频不相关', + 18: '违规抽奖', + 17: '青少年不良信息', + }, + '其他': {0: '其他'}, + }; - static const Map> dynamicReport = { - '': { - 4: '垃圾广告', - 8: '引战', - 1: '色情', - 5: '人身攻击', - 3: '违法信息', - 9: '涉政谣言', - 10: '涉社会事件谣言', - 12: '虚假不实信息', - 13: '违法信息外链', - 0: '其他', - }, - }; + static Map> get dynamicReport => { + '': { + 4: '垃圾广告', + 8: '引战', + 1: '色情', + 5: '人身攻击', + 3: '违法信息', + 9: '涉政谣言', + 10: '涉社会事件谣言', + 12: '虚假不实信息', + 13: '违法信息外链', + 0: '其他', + }, + }; } diff --git a/lib/pages/dynamics/widgets/author_panel.dart b/lib/pages/dynamics/widgets/author_panel.dart index a80fc682..4334dbcc 100644 --- a/lib/pages/dynamics/widgets/author_panel.dart +++ b/lib/pages/dynamics/widgets/author_panel.dart @@ -327,32 +327,35 @@ class AuthorPanel extends StatelessWidget { ), onTap: () { Get.back(); - autoWrapReportDialog(context, ReportOptions.dynamicReport, - (reasonType, reasonDesc, banUid) async { - if (banUid) { - VideoHttp.relationMod( - mid: item.modules.moduleAuthor.mid, - act: 5, - reSrc: 11, + autoWrapReportDialog( + context, + ReportOptions.dynamicReport, + (reasonType, reasonDesc, banUid) async { + if (banUid) { + VideoHttp.relationMod( + mid: item.modules.moduleAuthor.mid, + act: 5, + reSrc: 11, + ); + } + final res = await Request().post( + '/x/dynamic/feed/dynamic_report/add', + queryParameters: { + 'csrf': await Request.getCsrf(), + }, + data: { + "accused_uid": item.modules.moduleAuthor.mid, + "dynamic_id": item.idStr, + "reason_type": reasonType, + "reason_desc": reasonType == 0 ? reasonDesc : null, + }, + options: Options( + contentType: Headers.formUrlEncodedContentType, + ), ); - } - final res = await Request().post( - '/x/dynamic/feed/dynamic_report/add', - queryParameters: { - 'csrf': await Request.getCsrf(), - }, - data: { - "accused_uid": item.modules.moduleAuthor.mid, - "dynamic_id": item.idStr, - "reason_type": reasonType, - "reason_desc": reasonType == 0 ? reasonDesc : null, - }, - options: Options( - contentType: Headers.formUrlEncodedContentType, - ), - ); - return res.data as Map; - }); + return res.data as Map; + }, + ); }, minLeadingWidth: 0, ), diff --git a/lib/pages/video/detail/reply/widgets/reply_item.dart b/lib/pages/video/detail/reply/widgets/reply_item.dart index 2b050b8d..abff87a4 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item.dart @@ -1037,24 +1037,32 @@ class MorePanel extends StatelessWidget { switch (type) { case 'report': Get.back(); - autoWrapReportDialog(Get.context!, ReportOptions.commentReport, - (reasonType, reasonDesc, banUid) async { - final res = await Request().post('/x/v2/reply/report', + autoWrapReportDialog( + Get.context!, + ReportOptions.commentReport, + (reasonType, reasonDesc, banUid) async { + final res = await Request().post( + '/x/v2/reply/report', data: { - 'add_blacklist': banUid.toString(), + 'add_blacklist': banUid, 'csrf': await Request.getCsrf(), 'gaia_source': 'main_h5', - 'oid': item.oid.toString(), + 'oid': item.oid, 'platform': 'android', - 'reason': reasonType.toString(), - 'rpid': item.rpid.toString(), + 'reason': reasonType, + 'rpid': item.rpid, 'scene': 'main', - 'type': '1', + 'type': 1, if (reasonType == 0) 'content': reasonDesc! }, - options: Options(contentType: Headers.formUrlEncodedContentType)); - return res.data as Map; - }); + options: Options(contentType: Headers.formUrlEncodedContentType), + ); + if (res.data['code'] == 0) { + onDelete?.call(item.rpid); + } + return res.data as Map; + }, + ); break; case 'copyAll': Get.back(); diff --git a/lib/pages/video/detail/reply/widgets/reply_item_grpc.dart b/lib/pages/video/detail/reply/widgets/reply_item_grpc.dart index 37d29c2b..a65ab05d 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item_grpc.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item_grpc.dart @@ -1069,7 +1069,7 @@ class ReplyItemGrpc extends StatelessWidget { Widget morePanel({ required BuildContext context, - required dynamic item, + required ReplyInfo item, required onDelete, }) { Future menuActionHandler(String type) async { @@ -1077,25 +1077,33 @@ class ReplyItemGrpc extends StatelessWidget { switch (type) { case 'report': Get.back(); - autoWrapReportDialog(context, ReportOptions.commentReport, - (reasonType, reasonDesc, banUid) async { - final res = await Request().post('/x/v2/reply/report', + autoWrapReportDialog( + context, + ReportOptions.commentReport, + (reasonType, reasonDesc, banUid) async { + final res = await Request().post( + '/x/v2/reply/report', data: { - 'add_blacklist': banUid.toString(), + 'add_blacklist': banUid, 'csrf': await Request.getCsrf(), 'gaia_source': 'main_h5', - 'oid': item.oid.toString(), + 'oid': item.oid, 'platform': 'android', - 'reason': reasonType.toString(), - 'rpid': item.id.toString(), + 'reason': reasonType, + 'rpid': item.id, 'scene': 'main', - 'type': '1', + 'type': 1, if (reasonType == 0) 'content': reasonDesc! }, options: - Options(contentType: Headers.formUrlEncodedContentType)); - return res.data as Map; - }); + Options(contentType: Headers.formUrlEncodedContentType), + ); + if (res.data['code'] == 0) { + onDelete?.call(item.id.toInt()); + } + return res.data as Map; + }, + ); break; case 'copyAll': Get.back(); diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index b04aa251..6a9ef36b 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -327,7 +327,7 @@ class Utils { builder: (context) => Column( children: List.generate(list.length, (index) { return radioWidget( - paddingStart: 14, + padding: const EdgeInsets.only(left: 14), title: list[index].title ?? '', groupValue: checkedId, value: list[index].id,