|
|
|
import 'dart:ui';
|
|
|
|
|
|
|
|
import 'package:dio/dio.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/rendering.dart';
|
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart';
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart';
|
|
|
|
import 'package:huixiang/utils/font_weight.dart';
|
|
|
|
import 'package:huixiang/view_widget/my_appbar.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
|
|
|
|
class ReportPage extends StatefulWidget {
|
|
|
|
final Map<String, dynamic> arguments;
|
|
|
|
|
|
|
|
ReportPage({this.arguments});
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _ReportPage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _ReportPage extends State<ReportPage> {
|
|
|
|
ApiService apiService;
|
|
|
|
int textLength = 0;
|
|
|
|
final TextEditingController editingController = TextEditingController();
|
|
|
|
String textCon;
|
|
|
|
String userName;
|
|
|
|
String authorId;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
userName = widget.arguments['userName'];
|
|
|
|
authorId = widget.arguments['authorId'];
|
|
|
|
}
|
|
|
|
|
|
|
|
report() async {
|
|
|
|
if (apiService == null) {
|
|
|
|
SharedPreferences value = await SharedPreferences.getInstance();
|
|
|
|
apiService = ApiService(
|
|
|
|
Dio(),
|
|
|
|
context: context,
|
|
|
|
token: value.getString("token"),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
BaseData baseData = await apiService.complaint({
|
|
|
|
"content": checkIndex == 9 ? editingController.text : textCon,
|
|
|
|
"informationId": authorId,
|
|
|
|
}).catchError((onError) {});
|
|
|
|
if (baseData != null && baseData.isSuccess) {
|
|
|
|
Navigator.of(context).popAndPushNamed('/router/report_success');
|
|
|
|
} else {
|
|
|
|
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
appBar: MyAppBar(
|
|
|
|
background: Color(0xFFFFFFFFF),
|
|
|
|
leadingColor: Colors.black,
|
|
|
|
title: "举报",
|
|
|
|
titleSize: 18,
|
|
|
|
titleColor: Colors.black,
|
|
|
|
),
|
|
|
|
body: Container(
|
|
|
|
height: double.infinity,
|
|
|
|
color: Color(0xFFFFFFFF),
|
|
|
|
child: Stack(
|
|
|
|
children: [
|
|
|
|
SingleChildScrollView(
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
color: Color(0XFFFFFFFF),
|
|
|
|
padding: EdgeInsets.only(bottom: 4, left: 16, right: 16),
|
|
|
|
child: Text.rich(
|
|
|
|
TextSpan(
|
|
|
|
children: [
|
|
|
|
TextSpan(
|
|
|
|
text: "举报",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: Color(0xFF1A1A1A),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextSpan(
|
|
|
|
text: "@${userName.toString()}",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: Color(0xFF319E5F),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextSpan(
|
|
|
|
text: "的动态",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: Color(0xFF1A1A1A),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
reportContent(),
|
|
|
|
SizedBox(height: 12),
|
|
|
|
if (checkIndex == 9)
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 186.h,
|
|
|
|
margin:
|
|
|
|
EdgeInsets.only(right: 16, left: 40, bottom: 100),
|
|
|
|
decoration: new BoxDecoration(
|
|
|
|
color: Color(0xFFF7F7F7),
|
|
|
|
borderRadius: BorderRadius.circular(4.0),
|
|
|
|
),
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.fromLTRB(20.w, 5.h, 20.w, 0),
|
|
|
|
alignment: Alignment.topLeft,
|
|
|
|
child: TextField(
|
|
|
|
maxLines: 5,
|
|
|
|
controller: editingController,
|
|
|
|
onChanged: (value) {
|
|
|
|
setState(() {
|
|
|
|
textLength = value.length;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
maxLength: 100,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
border: InputBorder.none,
|
|
|
|
hintText: "请输入举报原因,以便我们更快定位问题,快速处理",
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
height: 1.2,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF999999),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Align(
|
|
|
|
alignment: Alignment.bottomCenter,
|
|
|
|
child: Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 95,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/report_notice');
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.bottomCenter,
|
|
|
|
margin: EdgeInsets.only(bottom: 25),
|
|
|
|
child: Text(
|
|
|
|
"投诉须知",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF3C425C),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Expanded(
|
|
|
|
child: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
if(checkIndex == 9 && editingController.text == ""){
|
|
|
|
SmartDialog.showToast("请输入举报原因", alignment: Alignment.center);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
report();
|
|
|
|
},
|
|
|
|
child: Opacity(
|
|
|
|
opacity: checkIndex == 0 ? 0.3 : 0.9,
|
|
|
|
child: Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: double.infinity,
|
|
|
|
color: Color(0xFF319E5F),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Text(
|
|
|
|
"提交",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
color: Color(0xFFFFFFFF),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget reportContent() {
|
|
|
|
return Container(
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.only(left: 16, right: 16, top: 20),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
content("色情低俗", 1),
|
|
|
|
SizedBox(
|
|
|
|
height: 18,
|
|
|
|
),
|
|
|
|
content("政治宗教", 2),
|
|
|
|
SizedBox(
|
|
|
|
height: 18,
|
|
|
|
),
|
|
|
|
content("广告骚扰", 3),
|
|
|
|
SizedBox(
|
|
|
|
height: 18,
|
|
|
|
),
|
|
|
|
content("虚假欺骗", 4),
|
|
|
|
SizedBox(
|
|
|
|
height: 18,
|
|
|
|
),
|
|
|
|
content("侵权(诽谤、抄袭、冒用)", 5),
|
|
|
|
SizedBox(
|
|
|
|
height: 18,
|
|
|
|
),
|
|
|
|
content("不良封面/标题", 6),
|
|
|
|
SizedBox(
|
|
|
|
height: 18,
|
|
|
|
),
|
|
|
|
content("赌博诈骗", 7),
|
|
|
|
SizedBox(
|
|
|
|
height: 18,
|
|
|
|
),
|
|
|
|
content("违禁内容(暴利恐怖、令人不适、宣言仇恨)", 8),
|
|
|
|
SizedBox(
|
|
|
|
height: 18,
|
|
|
|
),
|
|
|
|
content("其他", 9),
|
|
|
|
],
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
var checkIndex = 0;
|
|
|
|
|
|
|
|
Widget checkView(var index) {
|
|
|
|
return Container(
|
|
|
|
padding: EdgeInsets.only(right: 16.w, left: 5),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
// color: Colors.red,
|
|
|
|
child: Image.asset(
|
|
|
|
checkIndex != index
|
|
|
|
? "assets/image/icon_radio_unselected.webp"
|
|
|
|
: "assets/image/icon_radio_selected.webp",
|
|
|
|
width: 20.w,
|
|
|
|
height: 20.h,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget content(textContext, var index) {
|
|
|
|
return GestureDetector(
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
checkIndex = index;
|
|
|
|
textCon = textContext;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
checkView(index),
|
|
|
|
Container(),
|
|
|
|
Expanded(
|
|
|
|
child: Text(
|
|
|
|
textContext,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16.sp,
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|