275 lines
9.2 KiB
Dart
275 lines
9.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
|
|
///举报
|
|
class ReportPage extends StatefulWidget {
|
|
const ReportPage({super.key});
|
|
|
|
@override
|
|
State<ReportPage> createState() => _ReportPageState();
|
|
}
|
|
|
|
class _ReportPageState extends State<ReportPage> {
|
|
final TextEditingController _textController = TextEditingController(text: '');
|
|
final FocusNode _commentFocus = FocusNode(); //输入框焦点
|
|
int typeIndex = 0;
|
|
|
|
String promptText = "";
|
|
|
|
void _textFieldChanged(String str) {
|
|
promptText = str;
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
// TODO: implement initState
|
|
super.initState();
|
|
}
|
|
|
|
setType(type) {
|
|
typeIndex = type;
|
|
setState(() {});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final size = MediaQuery.of(context).size;
|
|
return Scaffold(
|
|
backgroundColor: Color(0xFF121213),
|
|
appBar: AppBar(
|
|
backgroundColor: Color(0xFF121213),
|
|
scrolledUnderElevation: 0.0,
|
|
title: Text(
|
|
'举报中心',
|
|
style: TextStyle(fontSize: 16, color: Colors.white),
|
|
),
|
|
centerTitle: true,
|
|
leading: IconButton(
|
|
iconSize: 18,
|
|
icon: Icon(Icons.arrow_back_ios_sharp),
|
|
color: Colors.white,
|
|
onPressed: () {
|
|
// 处理返回操作
|
|
Navigator.pop(context);
|
|
},
|
|
),
|
|
),
|
|
body: Column(
|
|
children: [
|
|
Container(
|
|
width: size.width,
|
|
margin: EdgeInsets.only(left: 16, top: 10),
|
|
child: Text(
|
|
'举报类型',
|
|
style: TextStyle(color: Colors.white, fontSize: 14),
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(left: 16, right: 16, top: 18),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
GestureDetector(
|
|
onTap: () {
|
|
setType(0);
|
|
},
|
|
child: Image(
|
|
width: 12,
|
|
height: 12,
|
|
image: typeIndex == 0 ? AssetImage('assets/images/ic_report_s.png') : AssetImage('assets/images/ic_report_n.png'),
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(left: 7),
|
|
child: Text(
|
|
'骚扰谩骂',
|
|
style: TextStyle(color: Color(0xFFA8A8A8), fontSize: 11),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
GestureDetector(
|
|
onTap: () {
|
|
setType(1);
|
|
},
|
|
child: Image(
|
|
width: 12,
|
|
height: 12,
|
|
image: typeIndex == 1 ? AssetImage('assets/images/ic_report_s.png') : AssetImage('assets/images/ic_report_n.png'),
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(left: 7),
|
|
child: Text(
|
|
'垃圾广告',
|
|
style: TextStyle(color: Color(0xFFA8A8A8), fontSize: 11),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
GestureDetector(
|
|
onTap: () {
|
|
setType(2);
|
|
},
|
|
child: Image(
|
|
width: 12,
|
|
height: 12,
|
|
image: typeIndex == 2 ? AssetImage('assets/images/ic_report_s.png') : AssetImage('assets/images/ic_report_n.png'),
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(left: 7),
|
|
child: Text(
|
|
'涉政社恐',
|
|
style: TextStyle(color: Color(0xFFA8A8A8), fontSize: 11),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(left: 16, right: 16, top: 18),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
GestureDetector(
|
|
onTap: () {
|
|
setType(4);
|
|
},
|
|
child: Image(
|
|
width: 12,
|
|
height: 12,
|
|
image: typeIndex == 4 ? AssetImage('assets/images/ic_report_s.png') : AssetImage('assets/images/ic_report_n.png'),
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(left: 7),
|
|
child: Text(
|
|
'欺诈骗钱',
|
|
style: TextStyle(color: Color(0xFFA8A8A8), fontSize: 11),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
GestureDetector(
|
|
onTap: () {
|
|
setType(5);
|
|
},
|
|
child: Image(
|
|
width: 12,
|
|
height: 12,
|
|
image: typeIndex == 5 ? AssetImage('assets/images/ic_report_s.png') : AssetImage('assets/images/ic_report_n.png'),
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(left: 7),
|
|
child: Text(
|
|
'淫秽色情',
|
|
style: TextStyle(color: Color(0xFFA8A8A8), fontSize: 11),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
GestureDetector(
|
|
onTap: () {
|
|
setType(6);
|
|
},
|
|
child: Image(
|
|
width: 12,
|
|
height: 12,
|
|
image: typeIndex == 6 ? AssetImage('assets/images/ic_report_s.png') : AssetImage('assets/images/ic_report_n.png'),
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(left: 7),
|
|
child: Text(
|
|
'其他 ',
|
|
style: TextStyle(color: Color(0xFFA8A8A8), fontSize: 11),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(left: 16, top: 24),
|
|
child: Row(
|
|
children: [
|
|
Text(
|
|
'具体描述',
|
|
style: TextStyle(fontSize: 14, color: Color(0xFFC5C5C5)),
|
|
),
|
|
Text(
|
|
'(选填)',
|
|
style: TextStyle(fontSize: 10, color: Color(0xFFC5C5C5)),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
alignment: Alignment.center,
|
|
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 20),
|
|
padding: const EdgeInsets.only(left: 9, top: 13, right: 9),
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFF262626),
|
|
borderRadius: BorderRadius.all(Radius.circular(6.6)),
|
|
),
|
|
child: TextField(
|
|
controller: _textController,
|
|
keyboardType: TextInputType.name,
|
|
focusNode: _commentFocus,
|
|
decoration:
|
|
InputDecoration.collapsed(hintText: '请描述举报的具体原因,以便更快处理', hintStyle: const TextStyle(fontSize: 10.0, color: Color(0xFF535353))),
|
|
textAlign: TextAlign.left,
|
|
maxLines: 4,
|
|
style: const TextStyle(fontSize: 16.0, color: Colors.white),
|
|
onChanged: _textFieldChanged,
|
|
autofocus: false,
|
|
maxLength: 200,
|
|
),
|
|
),
|
|
GestureDetector(
|
|
behavior: HitTestBehavior.opaque,
|
|
onTap: () {
|
|
EasyLoading.show(status: 'loading...');
|
|
Future.delayed(Duration(milliseconds: 1000), () {
|
|
//2秒
|
|
EasyLoading.showToast("提交成功");
|
|
Navigator.of(context).pop();
|
|
});
|
|
},
|
|
child: Container(
|
|
width: double.infinity,
|
|
height: 45,
|
|
alignment: Alignment.center,
|
|
margin: EdgeInsets.only(left: 16, right: 16, top: 50),
|
|
decoration: BoxDecoration(color: Color(0xFFFF9000), borderRadius: BorderRadius.all(Radius.circular(10))),
|
|
child: Text(
|
|
'提交',
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|