익명 커뮤니티 게시판(백판) 기능 추가
디시인사이드식 고정 카테고리 게시판 + 에타 스타일 익명(글 안에서만 유효한 익명 번호) 댓글. 신고는 자동 삭제 없이 운영자(교사/관리자) 검토 후 처리하도록 별도 신고 검토 화면을 대시보드에 추가. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,169 @@
|
||||
// 🚩 커뮤니티 게시판 - 신고 검토(운영자용) 화면 (UI 전용).
|
||||
// 서버 통신/상태는 lib/function/board_report_controller.dart가 담당한다.
|
||||
import 'package:flutter/material.dart';
|
||||
import '../function/board_report_controller.dart';
|
||||
import '../theme/app_palette.dart';
|
||||
import 'app_notice.dart';
|
||||
import 'title_pill.dart';
|
||||
|
||||
class BoardReportScreen extends StatefulWidget {
|
||||
final String reviewerId;
|
||||
|
||||
const BoardReportScreen({super.key, required this.reviewerId});
|
||||
|
||||
@override
|
||||
State<BoardReportScreen> createState() => _BoardReportScreenState();
|
||||
}
|
||||
|
||||
class _BoardReportScreenState extends State<BoardReportScreen> {
|
||||
late final BoardReportController _controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = BoardReportController(reviewerId: widget.reviewerId);
|
||||
_controller.init();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> _resolve(int reportId, String action) async {
|
||||
final (success, message) = await _controller.resolve(reportId, action);
|
||||
if (!mounted) return;
|
||||
AppNotice.show(context, message);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListenableBuilder(
|
||||
listenable: _controller,
|
||||
builder: (context, _) {
|
||||
final reports = _controller.reports;
|
||||
return Scaffold(
|
||||
backgroundColor: AppPalette.mist,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
foregroundColor: AppPalette.ink,
|
||||
elevation: 0,
|
||||
centerTitle: true,
|
||||
title: const TitlePill('게시판 신고 검토'),
|
||||
),
|
||||
body: _controller.isLoading
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: reports.isEmpty
|
||||
? const Center(
|
||||
child: Text(
|
||||
'처리할 신고가 없습니다.',
|
||||
style: TextStyle(color: Colors.grey),
|
||||
),
|
||||
)
|
||||
: RefreshIndicator(
|
||||
onRefresh: _controller.fetchPending,
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.all(16),
|
||||
itemCount: reports.length,
|
||||
itemBuilder: (context, index) {
|
||||
final report = reports[index];
|
||||
final reportId = report['id'] as int;
|
||||
final alreadyDeleted = report['alreadyDeleted'] == true;
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppPalette.paper,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
border: Border.all(color: AppPalette.sage),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Chip(
|
||||
label: Text(
|
||||
report['targetType'] == 'post'
|
||||
? '게시글'
|
||||
: '댓글',
|
||||
),
|
||||
visualDensity: VisualDensity.compact,
|
||||
backgroundColor: AppPalette.mist,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'${report['createdAt'] ?? ''}',
|
||||
style: const TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
'${report['targetContent'] ?? ''}',
|
||||
style: const TextStyle(fontSize: 14, height: 1.4),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
if (report['reason'] != null &&
|
||||
'${report['reason']}'.isNotEmpty)
|
||||
Text(
|
||||
'신고 사유: ${report['reason']}',
|
||||
style: const TextStyle(
|
||||
color: Colors.redAccent,
|
||||
fontSize: 12.5,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'신고자 학번: ${report['reporterStudentId'] ?? ''}',
|
||||
style: const TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
if (alreadyDeleted)
|
||||
const Text(
|
||||
'이미 삭제된 항목입니다.',
|
||||
style: TextStyle(color: Colors.grey),
|
||||
)
|
||||
else
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: OutlinedButton(
|
||||
onPressed: _controller.isBusy
|
||||
? null
|
||||
: () => _resolve(reportId, 'dismiss'),
|
||||
child: const Text('유지 (문제 없음)'),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.red[400],
|
||||
foregroundColor: Colors.white,
|
||||
),
|
||||
onPressed: _controller.isBusy
|
||||
? null
|
||||
: () => _resolve(reportId, 'delete'),
|
||||
child: const Text('삭제'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user