Browse Source

举报更改

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

122
lib/community/community_view/community_dynamic.dart

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

250
lib/community/report/report_page.dart

@ -1,13 +1,16 @@
import 'dart:ui'; import 'dart:ui';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.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/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
class ReportPage extends StatefulWidget { class ReportPage extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic> arguments;
@ -24,10 +27,37 @@ class _ReportPage extends State<ReportPage> {
ApiService apiService; ApiService apiService;
int textLength = 0; int textLength = 0;
final TextEditingController editingController = TextEditingController(); final TextEditingController editingController = TextEditingController();
String textContext;
String userName;
String authorId;
@override @override
void initState() { void initState() {
super.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 @override
@ -67,7 +97,7 @@ class _ReportPage extends State<ReportPage> {
), ),
), ),
TextSpan( TextSpan(
text: "@百花谷", text: "@${userName.toString()}",
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
@ -86,8 +116,9 @@ class _ReportPage extends State<ReportPage> {
), ),
), ),
), ),
report(), reportContent(),
SizedBox(height: 12), SizedBox(height: 12),
if(checkIndex == 9)
Container( Container(
width: double.infinity, width: double.infinity,
height: 186.h, height: 186.h,
@ -119,8 +150,7 @@ class _ReportPage extends State<ReportPage> {
), ),
), ),
), ),
) ))
)
], ],
), ),
), ),
@ -148,12 +178,13 @@ class _ReportPage extends State<ReportPage> {
), ),
), ),
)), )),
Expanded(child: Expanded(
GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
Navigator.of(context) report();
.pushNamed('/router/report_success');
}, },
child: Opacity(
opacity: checkIndex == 0 ? 0.3 : 0.9,
child: Container( child: Container(
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
@ -167,7 +198,9 @@ class _ReportPage extends State<ReportPage> {
color: Color(0xFFFFFFFF), color: Color(0xFFFFFFFF),
), ),
), ),
),)) ),
),
))
], ],
), ),
)) ))
@ -177,55 +210,178 @@ class _ReportPage extends State<ReportPage> {
); );
} }
Widget report() { Widget reportContent() {
return Container( 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: child:
// (articles == null || articles.length == 0) content(
// ? NoDataView( "色情低俗",
// src: "assets/image/dong_tai.webp", 1
// isShowBtn: false, ),
// text: "目前暂无发布动态,要把开心的事讲出来哦~", ),
// fontSize: 16.sp, SizedBox(height: 18,),
// margin: EdgeInsets.only(left: 60.w, right: 60.w), GestureDetector(
// ) : behavior: HitTestBehavior.opaque,
ListView.builder( onTap: () {
physics: BouncingScrollPhysics(), setState(() {
shrinkWrap: true, checkIndex = 2;
itemBuilder: (context, position) { });
return GestureDetector( },
onTap: () {}, child:
child: reportList(), 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;
});
}, },
itemCount: 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( return Container(
padding: EdgeInsets.only(top: 18, bottom: 20), alignment: Alignment.center,
color: Color(0xFFFFFFFF),
child:Row( child:Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Image.asset( checkView(index),
"assets/image/icon_radio_unselected.webp", Container(),
width: 16, Expanded(child:
height: 16, Text(
), textContext,
SizedBox(
width: 8,
),
Expanded(
child: Text(
"色情低俗",
style: TextStyle( style: TextStyle(
fontSize: 16.sp,
color: Color(0xFF353535), color: Color(0xFF353535),
fontSize: 14.sp, fontWeight: MyFontWeight.regular,
fontWeight: MyFontWeight.regular), ),
)) ),)
], ],
)); ),
);
} }
} }

Loading…
Cancel
Save