174 lines
5.6 KiB
Dart
174 lines
5.6 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_easyloading/flutter_easyloading.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;
|
|
return Scaffold(
|
|
backgroundColor: const Color(0xFF17181A),
|
|
body: Column(
|
|
children: [
|
|
Container(
|
|
width: size.width,
|
|
height: 50,
|
|
margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
|
|
child: Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
Text(
|
|
"反馈",
|
|
style: TextStyle(fontSize: 16, color: Color(0xFFD6D6D7)),
|
|
),
|
|
Positioned(
|
|
left: 14,
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
Navigator.pop(context);
|
|
},
|
|
child: Image(
|
|
width: 19,
|
|
height: 26,
|
|
image: AssetImage('assets/images/btn_fanhui.png'),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
alignment: Alignment.centerLeft,
|
|
margin: EdgeInsets.only(left: 14),
|
|
child: Text(
|
|
"问题描述:",
|
|
style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)),
|
|
),
|
|
),
|
|
Container(
|
|
alignment: Alignment.center,
|
|
margin: EdgeInsets.symmetric(horizontal: 14, vertical: 20),
|
|
padding: const EdgeInsets.only(left: 9, top: 13, right: 9),
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFF111319),
|
|
borderRadius: BorderRadius.all(Radius.circular(6.6)),
|
|
),
|
|
child: TextField(
|
|
controller: _textController,
|
|
keyboardType: TextInputType.name,
|
|
focusNode: _commentFocus,
|
|
decoration: InputDecoration.collapsed(
|
|
hintText: '请输入您详细的问题或建议,以便我们提供更好的服务',
|
|
hintStyle: const TextStyle(
|
|
fontSize: 14.0,
|
|
color: Color(0xFF44474F),
|
|
)),
|
|
textAlign: TextAlign.left,
|
|
maxLines: 6,
|
|
style: const TextStyle(fontSize: 14.0, color: Colors.white),
|
|
// onChanged: _textFieldChanged,
|
|
autofocus: false,
|
|
maxLength: 200,
|
|
),
|
|
),
|
|
Container(
|
|
alignment: Alignment.centerLeft,
|
|
margin: EdgeInsets.only(left: 14),
|
|
child: Text(
|
|
"联系方式:",
|
|
style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)),
|
|
),
|
|
),
|
|
Container(
|
|
width: size.width,
|
|
height: 45,
|
|
alignment: Alignment.centerLeft,
|
|
padding: const EdgeInsets.only(left: 9, bottom: 5, right: 9),
|
|
margin: EdgeInsets.symmetric(horizontal: 14, vertical: 20),
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFF111319),
|
|
borderRadius: BorderRadius.all(Radius.circular(6.6)),
|
|
),
|
|
child: TextField(
|
|
controller: _contactController,
|
|
style: TextStyle(fontSize: 14, color: Colors.white),
|
|
decoration: InputDecoration.collapsed(
|
|
hintText: '请输入您的QQ或者手机号码',
|
|
hintStyle: const TextStyle(
|
|
fontSize: 11.0,
|
|
color: Color(0xFF44474F),
|
|
)),
|
|
),
|
|
),
|
|
GestureDetector(
|
|
onTap: () {
|
|
if (_textController.text == "") {
|
|
EasyLoading.showToast("请输入反馈内容");
|
|
return;
|
|
}
|
|
_viewModel.sendFeedBack(_textController.text, _contactController.text);
|
|
},
|
|
child: Container(
|
|
width: size.width,
|
|
height: 44,
|
|
margin: EdgeInsets.only(top: 30),
|
|
alignment: Alignment.center,
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFF074CE7),
|
|
borderRadius: BorderRadius.all(Radius.circular(22)),
|
|
),
|
|
child: Text(
|
|
"提交",
|
|
style: TextStyle(fontSize: 14, color: Colors.white),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|