Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-01-29 13:35:51 +08:00
parent bcbfe5c849
commit 5979ddb60c
46 changed files with 3266 additions and 3293 deletions

View File

@@ -19,116 +19,114 @@ Future<void> autoWrapReportDialog(
late final key = GlobalKey<FormFieldState<String>>();
return showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: const Text('举报'),
titlePadding: const .only(left: 22, top: 16, right: 22),
contentPadding: const .symmetric(vertical: 5),
actionsPadding: const .only(left: 16, right: 16, bottom: 10),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Flexible(
child: SingleChildScrollView(
child: AnimatedSize(
duration: const Duration(milliseconds: 200),
child: Builder(
builder: (context) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Padding(
padding: .only(left: 22, right: 22, bottom: 5),
child: Text('请选择举报的理由:'),
builder: (context) => AlertDialog(
title: const Text('举报'),
titlePadding: const .only(left: 22, top: 16, right: 22),
contentPadding: const .symmetric(vertical: 5),
actionsPadding: const .only(left: 16, right: 16, bottom: 10),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Flexible(
child: SingleChildScrollView(
child: AnimatedSize(
duration: const Duration(milliseconds: 200),
child: Builder(
builder: (context) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Padding(
padding: .only(left: 22, right: 22, bottom: 5),
child: Text('请选择举报的理由:'),
),
RadioGroup(
onChanged: (value) {
reasonType = value;
(context as Element).markNeedsBuild();
},
groupValue: reasonType,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: options.entries.map((entry) {
return WrapRadioOptionsGroup<int>(
groupTitle: entry.key,
options: entry.value,
);
}).toList(),
),
RadioGroup(
onChanged: (value) {
reasonType = value;
(context as Element).markNeedsBuild();
},
groupValue: reasonType,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: options.entries.map((entry) {
return WrapRadioOptionsGroup<int>(
groupTitle: entry.key,
options: entry.value,
);
}).toList(),
),
),
if (reasonType == 0)
Padding(
padding: const .only(left: 22, top: 5, right: 22),
child: TextFormField(
key: key,
autofocus: true,
minLines: 2,
maxLines: 4,
initialValue: reasonDesc,
decoration: const InputDecoration(
labelText: '为帮助审核人员更快处理,请补充问题类型和出现位置等详细信息',
border: OutlineInputBorder(),
contentPadding: .all(10),
labelStyle: TextStyle(fontSize: 14),
floatingLabelStyle: TextStyle(fontSize: 14),
),
onChanged: (value) => reasonDesc = value,
validator: (value) =>
value.isNullOrEmpty ? '理由不能为空' : null,
),
if (reasonType == 0)
Padding(
padding: const .only(left: 22, top: 5, right: 22),
child: TextFormField(
key: key,
autofocus: true,
minLines: 2,
maxLines: 4,
initialValue: reasonDesc,
decoration: const InputDecoration(
labelText: '为帮助审核人员更快处理,请补充问题类型和出现位置等详细信息',
border: OutlineInputBorder(),
contentPadding: .all(10),
labelStyle: TextStyle(fontSize: 14),
floatingLabelStyle: TextStyle(fontSize: 14),
),
onChanged: (value) => reasonDesc = value,
validator: (value) =>
value.isNullOrEmpty ? '理由不能为空' : null,
),
],
),
),
],
),
),
),
),
if (ban)
Padding(
padding: const EdgeInsets.only(left: 14, top: 6),
child: CheckBoxText(
text: '拉黑该用户',
onChanged: (value) => banUid = value,
),
),
if (ban)
Padding(
padding: const EdgeInsets.only(left: 14, top: 6),
child: CheckBoxText(
text: '拉黑该用户',
onChanged: (value) => banUid = value,
),
],
),
actions: [
TextButton(
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(color: ColorScheme.of(context).outline),
),
),
TextButton(
onPressed: () async {
if (reasonType == null ||
(reasonType == 0 && key.currentState?.validate() != true)) {
return;
}
SmartDialog.showLoading();
try {
final res = await onSuccess(reasonType!, reasonDesc, banUid);
SmartDialog.dismiss();
if (res.isSuccess) {
Get.back();
SmartDialog.showToast('举报成功');
} else {
res.toast();
}
} catch (e, s) {
SmartDialog.dismiss();
SmartDialog.showToast('提交失败:$e');
Utils.reportError(e, s);
}
},
child: const Text('确定'),
),
],
);
},
),
actions: [
TextButton(
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(color: ColorScheme.of(context).outline),
),
),
TextButton(
onPressed: () async {
if (reasonType == null ||
(reasonType == 0 && key.currentState?.validate() != true)) {
return;
}
SmartDialog.showLoading();
try {
final res = await onSuccess(reasonType!, reasonDesc, banUid);
SmartDialog.dismiss();
if (res.isSuccess) {
Get.back();
SmartDialog.showToast('举报成功');
} else {
res.toast();
}
} catch (e, s) {
SmartDialog.dismiss();
SmartDialog.showToast('提交失败:$e');
Utils.reportError(e, s);
}
},
child: const Text('确定'),
),
],
),
);
}