195 lines
6.6 KiB
Dart
195 lines
6.6 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
|
|
import '../../common/func.dart';
|
|
import 'me_model.dart';
|
|
|
|
class FeedbackPage extends StatefulWidget {
|
|
const FeedbackPage({super.key});
|
|
|
|
@override
|
|
State<FeedbackPage> createState() => _FeedbackPageState();
|
|
}
|
|
|
|
class _FeedbackPageState extends State<FeedbackPage> {
|
|
final TextEditingController _textController = TextEditingController(text: '');
|
|
final TextEditingController _contactController = TextEditingController(text: '');
|
|
final FocusNode _commentFocus = FocusNode(); //输入框焦点
|
|
|
|
late StreamSubscription subscription;
|
|
final MeModel _viewModel = MeModel();
|
|
|
|
@override
|
|
void initState() {
|
|
// TODO: implement initState
|
|
super.initState();
|
|
subscription = _viewModel.streamController.stream.listen((event) {
|
|
String code = event['code'];
|
|
if (code.isNotEmpty) {
|
|
switch (code) {
|
|
case "sendFeedBack":
|
|
Navigator.pop(context);
|
|
EasyLoading.showToast(event['data']);
|
|
break;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
// TODO: implement dispose
|
|
subscription.cancel();
|
|
_textController.dispose();
|
|
_contactController.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final size = MediaQuery.of(context).size;
|
|
final h50 = size.width / 7.2;
|
|
final s16 = size.width / 22.5;
|
|
final l14 = size.width / 25.71428571428571;
|
|
final w19 = size.width / 18.94736842105263;
|
|
final h26 = size.width / 13.84615384615385;
|
|
final l20 = size.width / 18;
|
|
final h45 = size.width / 8;
|
|
final t30 = size.width / 12;
|
|
final c22 = size.width / 16.36363636363636;
|
|
final s14 = size.width / 25.714285714285;
|
|
final l10 = size.width / 36;
|
|
final s9 = size.width / 40;
|
|
final t13 = size.width / 27.692307692307;
|
|
final c6 = size.width / 60;
|
|
final b5 = size.width / 72;
|
|
final s11 = size.width / 32.727272727272;
|
|
|
|
return Scaffold(
|
|
backgroundColor: const Color(0xFF17181A),
|
|
body: SingleChildScrollView(
|
|
child: Column(
|
|
children: [
|
|
Container(
|
|
width: size.width,
|
|
height: h50,
|
|
margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
|
|
child: Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
Text(
|
|
"反馈",
|
|
style: TextStyle(fontSize: s16, color: const Color(0xFFD6D6D7)),
|
|
),
|
|
Positioned(
|
|
left: l14,
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
Navigator.pop(context);
|
|
},
|
|
child: Image(
|
|
width: w19,
|
|
height: h26,
|
|
image: const AssetImage('assets/images/btn_fanhui.png'),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
alignment: Alignment.centerLeft,
|
|
margin: EdgeInsets.only(left: l14),
|
|
child: Text(
|
|
"问题描述:",
|
|
style: TextStyle(fontSize: s14, color: Color(0xFFD6D6D7)),
|
|
),
|
|
),
|
|
Container(
|
|
alignment: Alignment.center,
|
|
margin: EdgeInsets.symmetric(horizontal: l14, vertical: l20),
|
|
padding: EdgeInsets.only(left: s9, top: t13, right: s9),
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFF111319),
|
|
borderRadius: BorderRadius.all(Radius.circular(c6)),
|
|
),
|
|
child: TextField(
|
|
controller: _textController,
|
|
keyboardType: TextInputType.name,
|
|
focusNode: _commentFocus,
|
|
decoration: InputDecoration.collapsed(
|
|
hintText: '请输入您详细的问题或建议,以便我们提供更好的服务',
|
|
hintStyle: TextStyle(
|
|
fontSize: l14,
|
|
color: Color(0xFF44474F),
|
|
)),
|
|
textAlign: TextAlign.left,
|
|
maxLines: 6,
|
|
style: TextStyle(fontSize: l14, color: Colors.white),
|
|
// onChanged: _textFieldChanged,
|
|
autofocus: false,
|
|
maxLength: 200,
|
|
),
|
|
),
|
|
Container(
|
|
alignment: Alignment.centerLeft,
|
|
margin: EdgeInsets.only(left: l14),
|
|
child: Text(
|
|
"联系方式:",
|
|
style: TextStyle(fontSize: l14, color: Color(0xFFD6D6D7)),
|
|
),
|
|
),
|
|
Container(
|
|
width: size.width,
|
|
height: h45,
|
|
alignment: Alignment.centerLeft,
|
|
padding: EdgeInsets.only(left: s9, bottom: b5, right: s9),
|
|
margin: EdgeInsets.symmetric(horizontal: l14, vertical: l20),
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFF111319),
|
|
borderRadius: BorderRadius.all(Radius.circular(c6)),
|
|
),
|
|
child: TextField(
|
|
controller: _contactController,
|
|
style: TextStyle(fontSize: l14, color: Colors.white),
|
|
decoration: InputDecoration.collapsed(
|
|
hintText: '请输入您的QQ或者手机号码',
|
|
hintStyle: TextStyle(
|
|
fontSize: s11,
|
|
color: Color(0xFF44474F),
|
|
)),
|
|
),
|
|
),
|
|
GestureDetector(
|
|
onTap: () {
|
|
if (_textController.text == "") {
|
|
EasyLoading.showToast("请输入反馈内容");
|
|
return;
|
|
}
|
|
FunctionUtil.loading();
|
|
_viewModel.sendFeedBack(_textController.text, _contactController.text);
|
|
},
|
|
child: Container(
|
|
width: size.width,
|
|
height: h45,
|
|
margin: EdgeInsets.only(top: t30, left: l14, right: l14),
|
|
alignment: Alignment.center,
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFF074CE7),
|
|
borderRadius: BorderRadius.all(Radius.circular(c22)),
|
|
),
|
|
child: Text(
|
|
"提交",
|
|
style: TextStyle(fontSize: l14, color: Colors.white),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|