Browse Source

举报更改

remove_uniapp
w-R 3 years ago
parent
commit
00e4664183
  1. 122
      lib/community/community_view/community_dynamic.dart
  2. 262
      lib/community/report/report_page.dart

122
lib/community/community_view/community_dynamic.dart

@ -410,25 +410,26 @@ class _CommunityDynamic extends State<CommunityDynamic> {
],
),
),
// Expanded(
// child: GestureDetector(
// behavior: HitTestBehavior.opaque,
// onTap: () {
// setState(() {
// choiceShowBottomSheet();
// });
// },
// child: Container(
// alignment: Alignment.center,
// child: Text(
// "...",
// style: TextStyle(
// fontSize: 18.sp,
// fontWeight: MyFontWeight.medium,
// color: Colors.black,
// ),
// ),
// ))),
if (widget?.article?.author != widget.userId ?? "")
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
choiceShowBottomSheet();
});
},
child: Container(
alignment: Alignment.center,
child: Text(
"...",
style: TextStyle(
fontSize: 18.sp,
fontWeight: MyFontWeight.medium,
color: Colors.black,
),
),
))),
],
),
],
@ -772,50 +773,53 @@ class _CommunityDynamic extends State<CommunityDynamic> {
SizedBox(
height: 10,
),
GestureDetector(
onTap: () {
setState(() {
Navigator.of(context).pop();
share();
});
},
child: Container(
child: Row(
children: [
SizedBox(
width: 4,
),
Image.asset(
"assets/image/icon_share.webp",
fit: BoxFit.cover,
width: 25,
height: 25,
color: Color(0xff515151),
),
SizedBox(
width: 12,
),
Text(
"分享",
style: TextStyle(
fontSize: 17.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF1A1A1A),
),
),
],
),
)),
Container(
margin: EdgeInsets.symmetric(vertical: 12),
height: 1.h,
color: Color(0xFFF7F7F7),
),
// GestureDetector(
// onTap: () {
// setState(() {
// Navigator.of(context).pop();
// share();
// });
// },
// child: Container(
// child: Row(
// children: [
// SizedBox(
// width: 4,
// ),
// Image.asset(
// "assets/image/icon_share.webp",
// fit: BoxFit.cover,
// width: 25,
// height: 25,
// color: Color(0xff515151),
// ),
// SizedBox(
// width: 12,
// ),
// Text(
// "分享",
// style: TextStyle(
// fontSize: 17.sp,
// fontWeight: MyFontWeight.medium,
// color: Color(0xFF1A1A1A),
// ),
// ),
// ],
// ),
// )),
// Container(
// margin: EdgeInsets.symmetric(vertical: 12),
// height: 1.h,
// color: Color(0xFFF7F7F7),
// ),
GestureDetector(
onTap: () {
setState(() {
Navigator.of(context)
.popAndPushNamed('/router/report_page');
.popAndPushNamed('/router/report_page',arguments: {
"userName":widget?.article?.authorName ?? "",
"authorId":widget?.article?.author ?? "",
});
});
},
child: Row(

262
lib/community/report/report_page.dart

@ -1,13 +1,16 @@
import 'dart:ui';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:huixiang/generated/l10n.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;
@ -24,10 +27,37 @@ class _ReportPage extends State<ReportPage> {
ApiService apiService;
int textLength = 0;
final TextEditingController editingController = TextEditingController();
String textContext;
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": editingController.text,
"informationId":authorId,
}).catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
Navigator.of(context)
.pushNamed('/router/report_success');
editingController.clear();
} else {
SmartDialog.showToast(baseData.msg,alignment: Alignment.center);
}
}
@override
@ -67,7 +97,7 @@ class _ReportPage extends State<ReportPage> {
),
),
TextSpan(
text: "@百花谷",
text: "@${userName.toString()}",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
@ -86,12 +116,13 @@ class _ReportPage extends State<ReportPage> {
),
),
),
report(),
reportContent(),
SizedBox(height: 12),
if(checkIndex == 9)
Container(
width: double.infinity,
height: 186.h,
margin: EdgeInsets.only(right: 16,left:40,bottom:100),
margin: EdgeInsets.only(right: 16, left: 40, bottom: 100),
decoration: new BoxDecoration(
color: Color(0xFFF7F7F7),
borderRadius: BorderRadius.circular(4.0),
@ -119,8 +150,7 @@ class _ReportPage extends State<ReportPage> {
),
),
),
)
)
))
],
),
),
@ -128,7 +158,7 @@ class _ReportPage extends State<ReportPage> {
alignment: Alignment.bottomCenter,
child: Container(
width: double.infinity,
height:95,
height: 95,
child: Column(
children: [
GestureDetector(
@ -138,7 +168,7 @@ class _ReportPage extends State<ReportPage> {
},
child: Container(
alignment: Alignment.bottomCenter,
margin: EdgeInsets.only(bottom:25),
margin: EdgeInsets.only(bottom: 25),
child: Text(
"投诉须知",
style: TextStyle(
@ -148,15 +178,16 @@ class _ReportPage extends State<ReportPage> {
),
),
)),
Expanded(child:
GestureDetector(
onTap: (){
Navigator.of(context)
.pushNamed('/router/report_success');
Expanded(
child: GestureDetector(
onTap: () {
report();
},
child: Opacity(
opacity: checkIndex == 0 ? 0.3 : 0.9,
child: Container(
width: double.infinity,
height:double.infinity,
height: double.infinity,
color: Color(0xFF319E5F),
alignment: Alignment.center,
child: Text(
@ -167,7 +198,9 @@ class _ReportPage extends State<ReportPage> {
color: Color(0xFFFFFFFF),
),
),
),))
),
),
))
],
),
))
@ -177,55 +210,178 @@ class _ReportPage extends State<ReportPage> {
);
}
Widget report() {
Widget reportContent() {
return Container(
padding: EdgeInsets.only(left: 16, right: 16),
width: double.infinity,
padding: EdgeInsets.only(left:16, right:16,top:20),
child: Column(
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
checkIndex = 1;
});
},
child:
// (articles == null || articles.length == 0)
// ? NoDataView(
// src: "assets/image/dong_tai.webp",
// isShowBtn: false,
// text: "目前暂无发布动态,要把开心的事讲出来哦~",
// fontSize: 16.sp,
// margin: EdgeInsets.only(left: 60.w, right: 60.w),
// ) :
ListView.builder(
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {},
child: reportList(),
);
content(
"色情低俗",
1
),
),
SizedBox(height: 18,),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
checkIndex = 2;
});
},
itemCount: 9,
child:
content(
"政治宗教",
2
),
),
SizedBox(height: 18,),
GestureDetector (
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
checkIndex = 3;
});
},
child:
content(
"广告骚扰",
3
),
),
SizedBox(height: 18,),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
checkIndex = 4;
});
},
child:
content(
"虚假欺骗",
4
),
),
SizedBox(height: 18,),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
checkIndex = 5;
});
},
child:
content(
"侵权(诽谤、抄袭、冒用)",
5
),
),
SizedBox(height: 18,),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
checkIndex = 6;
});
},
child:
content(
"不良封面/标题",
6
),
),
SizedBox(height: 18,),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
checkIndex = 7;
});
},
child:
content(
"赌博诈骗",
7
),
),
SizedBox(height: 18,),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
checkIndex = 8;
});
},
child:
content(
editingController.text = "违禁内容(暴利恐怖、令人不适、宣言仇恨)",
8
),
),
SizedBox(height: 18,),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
checkIndex = 9;
});
},
child:
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 reportList() {
Widget content(textContext,var index) {
return Container(
padding: EdgeInsets.only(top: 18, bottom: 20),
color: Color(0xFFFFFFFF),
child: Row(
alignment: Alignment.center,
child:Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(
"assets/image/icon_radio_unselected.webp",
width: 16,
height: 16,
),
SizedBox(
width: 8,
),
Expanded(
child: Text(
"色情低俗",
checkView(index),
Container(),
Expanded(child:
Text(
textContext,
style: TextStyle(
fontSize: 16.sp,
color: Color(0xFF353535),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular),
))
fontWeight: MyFontWeight.regular,
),
),)
],
));
),
);
}
}

Loading…
Cancel
Save