opt: dialog

This commit is contained in:
bggRGjQaUbCoE
2024-10-04 20:39:25 +08:00
parent d850e891a0
commit 6c84b0c6cb
2 changed files with 103 additions and 102 deletions

View File

@@ -273,7 +273,7 @@ class _BangumiInfoState extends State<BangumiInfo>
foregroundColor: foregroundColor:
bangumiIntroController bangumiIntroController
.isFollowed.value .isFollowed.value
? t.colorScheme.onSurface ? t.colorScheme.outline
: null, : null,
backgroundColor: backgroundColor:
bangumiIntroController bangumiIntroController
@@ -575,32 +575,30 @@ class _BangumiInfoState extends State<BangumiInfo>
} }
Widget _followDialog() { Widget _followDialog() {
return Dialog( return AlertDialog(
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
child: Padding( contentPadding: const EdgeInsets.symmetric(vertical: 12),
padding: const EdgeInsets.symmetric(vertical: 16), content: Column(
child: Column( mainAxisSize: MainAxisSize.min,
mainAxisSize: MainAxisSize.min, children: [
children: [ _followDialogItem(3, '看过'),
_followDialogItem(3, ''), _followDialogItem(2, ''),
_followDialogItem(2, ''), _followDialogItem(1, ''),
_followDialogItem(1, '想看'), ListTile(
ListTile( dense: true,
dense: true, title: const Padding(
title: const Padding( padding: EdgeInsets.only(left: 10),
padding: EdgeInsets.only(left: 10), child: Text(
child: Text( '取消追番',
'取消追番', style: TextStyle(fontSize: 14),
style: TextStyle(fontSize: 14),
),
), ),
onTap: () { ),
Get.back(); onTap: () {
bangumiIntroController.bangumiDel(); Get.back();
}, bangumiIntroController.bangumiDel();
) },
], )
), ],
), ),
); );
} }

View File

@@ -153,10 +153,16 @@ class _MemberPageState extends State<MemberPage>
onTap: () { onTap: () {
showDialog( showDialog(
context: context, context: context,
builder: (_) => Dialog( builder: (_) => AlertDialog(
child: ReportPanel( clipBehavior: Clip.hardEdge,
memberInfo: _memberController.memberInfo.value, contentPadding: const EdgeInsets.symmetric(
)), horizontal: 20,
vertical: 16,
),
content: ReportPanel(
memberInfo: _memberController.memberInfo.value,
),
),
); );
}, },
child: Row( child: Row(
@@ -539,84 +545,81 @@ class _ReportPanelState extends State<ReportPanel> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16), child: Column(
child: SingleChildScrollView( mainAxisSize: MainAxisSize.min,
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, children: [
crossAxisAlignment: CrossAxisAlignment.start, Text(
children: [ '举报: ${widget.memberInfo.name}',
Text( style: const TextStyle(fontSize: 18),
'举报: ${widget.memberInfo.name}', ),
style: const TextStyle(fontSize: 18), const SizedBox(height: 4),
Text('uid: ${widget.memberInfo.mid}'),
const SizedBox(height: 10),
const Text('举报内容(必选,可多选)'),
...List.generate(
3,
(index) => _checkBoxWidget(
_reasonList[index],
(value) {
setState(() => _reasonList[index] = value);
if (value) {
_reason.add(index + 1);
} else {
_reason.remove(index + 1);
}
},
['头像违规', '昵称违规', '签名违规'][index],
), ),
const SizedBox(height: 4), ).toList(),
Text('uid: ${widget.memberInfo.mid}'), const Text('举报理由(单选,非必选)'),
const SizedBox(height: 10), ...List.generate(
const Text('举报内容(必选,可多选)'), 5,
...List.generate( (index) => _radioWidget(
3, index,
(index) => _checkBoxWidget( _reasonV2,
_reasonList[index], (value) {
(value) { setState(() => _reasonV2 = value);
setState(() => _reasonList[index] = value); },
if (value) { ['色情低俗', '不实信息', '违禁', '人身攻击', '赌博诈骗'][index],
_reason.add(index + 1); ),
).toList(),
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: Get.back,
child: Text(
'取消',
style:
TextStyle(color: Theme.of(context).colorScheme.outline),
),
),
TextButton(
onPressed: () async {
if (_reason.isEmpty) {
SmartDialog.showToast('至少选择一项作为举报内容');
} else { } else {
_reason.remove(index + 1); Get.back();
dynamic result = await MemberHttp.reportMember(
widget.memberInfo.mid,
reason: _reason.join(','),
reasonV2: _reasonV2 != null ? _reasonV2! + 1 : null,
);
if (result['msg'] is String && result['msg'].isNotEmpty) {
SmartDialog.showToast(result['msg']);
} else {
SmartDialog.showToast('举报失败');
}
} }
}, },
['头像违规', '昵称违规', '签名违规'][index], child: const Text('确定'),
), ),
).toList(), ],
const Text('举报理由(单选,非必选)'), ),
...List.generate( ],
5,
(index) => _radioWidget(
index,
_reasonV2,
(value) {
setState(() => _reasonV2 = value);
},
['色情低俗', '不实信息', '违禁', '人身攻击', '赌博诈骗'][index],
),
).toList(),
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: Get.back,
child: Text(
'取消',
style:
TextStyle(color: Theme.of(context).colorScheme.outline),
),
),
TextButton(
onPressed: () async {
if (_reason.isEmpty) {
SmartDialog.showToast('至少选择一项作为举报内容');
} else {
Get.back();
dynamic result = await MemberHttp.reportMember(
widget.memberInfo.mid,
reason: _reason.join(','),
reasonV2: _reasonV2 != null ? _reasonV2! + 1 : null,
);
if (result['msg'] is String && result['msg'].isNotEmpty) {
SmartDialog.showToast(result['msg']);
} else {
SmartDialog.showToast('举报失败');
}
}
},
child: const Text('确定'),
),
],
),
],
),
), ),
); );
} }