|
|
|
@ -1,9 +1,15 @@
|
|
|
|
|
import 'package:dio/dio.dart'; |
|
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
import 'package:flutter/services.dart'; |
|
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
|
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/my_appbar.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/round_button.dart'; |
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
|
|
|
|
|
|
class HelpFeedbackPage extends StatefulWidget { |
|
|
|
|
@override |
|
|
|
@ -15,6 +21,18 @@ class HelpFeedbackPage extends StatefulWidget {
|
|
|
|
|
class _HelpFeedbackPage extends State<HelpFeedbackPage> { |
|
|
|
|
var _isExpanded = [false, false, false]; |
|
|
|
|
|
|
|
|
|
ApiService apiService; |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void initState() { |
|
|
|
|
super.initState(); |
|
|
|
|
|
|
|
|
|
SharedPreferences.getInstance().then((value) { |
|
|
|
|
apiService = ApiService(Dio(), context: context, token: value.getString("token")); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
return Scaffold( |
|
|
|
@ -119,16 +137,21 @@ class _HelpFeedbackPage extends State<HelpFeedbackPage> {
|
|
|
|
|
), |
|
|
|
|
flex: 1, |
|
|
|
|
), |
|
|
|
|
Container( |
|
|
|
|
height: 54.h, |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
child: RoundButton( |
|
|
|
|
text: S.of(context).tijiao, |
|
|
|
|
backgroup: Color(0xFF32A060), |
|
|
|
|
textColor: Colors.white, |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
InkWell( |
|
|
|
|
onTap: () { |
|
|
|
|
report(); |
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
height: 54.h, |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
child: RoundButton( |
|
|
|
|
text: S.of(context).tijiao, |
|
|
|
|
backgroup: Color(0xFF32A060), |
|
|
|
|
textColor: Colors.white, |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
@ -137,6 +160,25 @@ class _HelpFeedbackPage extends State<HelpFeedbackPage> {
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
report() async { |
|
|
|
|
var content = editingController.text; |
|
|
|
|
var phone = phoneController.text; |
|
|
|
|
BaseData baseData = await apiService.report({ |
|
|
|
|
"mobile": phone, |
|
|
|
|
"reportContent": content, |
|
|
|
|
}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
SmartDialog.showToast("反馈成功"); |
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
} else { |
|
|
|
|
SmartDialog.showToast("反馈失败"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
final TextEditingController editingController = TextEditingController(); |
|
|
|
|
final TextEditingController phoneController = TextEditingController(); |
|
|
|
|
int textLength = 0; |
|
|
|
|
|
|
|
|
|
_feedback() { |
|
|
|
|
return Container( |
|
|
|
|
width: double.infinity, |
|
|
|
@ -161,6 +203,13 @@ class _HelpFeedbackPage extends State<HelpFeedbackPage> {
|
|
|
|
|
alignment: Alignment.topLeft, |
|
|
|
|
child: TextField( |
|
|
|
|
maxLines: 5, |
|
|
|
|
controller: editingController, |
|
|
|
|
onChanged: (value) { |
|
|
|
|
setState(() { |
|
|
|
|
textLength = value.length; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
maxLength: 50, |
|
|
|
|
decoration: InputDecoration( |
|
|
|
|
border: InputBorder.none, |
|
|
|
|
hintText: S.of(context).fankuilizi, |
|
|
|
@ -172,18 +221,18 @@ class _HelpFeedbackPage extends State<HelpFeedbackPage> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Container( |
|
|
|
|
alignment: Alignment.bottomRight, |
|
|
|
|
padding: EdgeInsets.only(right: 20.w), |
|
|
|
|
child: Text( |
|
|
|
|
"0/50", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
fontWeight: FontWeight.w400, |
|
|
|
|
color: Color(0xffA29E9E), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
// Container( |
|
|
|
|
// alignment: Alignment.bottomRight, |
|
|
|
|
// padding: EdgeInsets.only(right: 20.w), |
|
|
|
|
// child: Text( |
|
|
|
|
// "$textLength/50", |
|
|
|
|
// style: TextStyle( |
|
|
|
|
// fontSize: 14.sp, |
|
|
|
|
// fontWeight: FontWeight.w400, |
|
|
|
|
// color: Color(0xffA29E9E), |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
@ -193,7 +242,7 @@ class _HelpFeedbackPage extends State<HelpFeedbackPage> {
|
|
|
|
|
return Container( |
|
|
|
|
width: double.infinity, |
|
|
|
|
margin: EdgeInsets.all(16.w), |
|
|
|
|
decoration: new BoxDecoration( |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Color(0xffffffff), |
|
|
|
|
borderRadius: BorderRadius.circular(4.0), |
|
|
|
|
boxShadow: [ |
|
|
|
@ -211,6 +260,8 @@ class _HelpFeedbackPage extends State<HelpFeedbackPage> {
|
|
|
|
|
margin: EdgeInsets.fromLTRB(20.w, 0, 20.w, 0), |
|
|
|
|
alignment: Alignment.topLeft, |
|
|
|
|
child: TextField( |
|
|
|
|
controller: phoneController, |
|
|
|
|
inputFormatters: [LengthLimitingTextInputFormatter(11)], |
|
|
|
|
decoration: InputDecoration( |
|
|
|
|
border: InputBorder.none, |
|
|
|
|
hintText: S.of(context).qingshuruyouxiaoshoujihaoma, |
|
|
|
|