Commit b0bfe5fb authored by tongzifang's avatar tongzifang

feature/20230406-user_feedback

parent 2b6997ab
This diff is collapsed.
class UserFeedBackImgs{
static String get user_feedback_camare => "images/ic_feedback_camare.png";
static String get user_feedback_del => "images/ic_feedback_img_del.png";
}
\ No newline at end of file
......@@ -5,4 +5,8 @@ class UserFeedBackString{
static String get feedback_type_a_tip => "反馈产品及服务优化建议";
static String get feedback_type_b => "功能异常";
static String get feedback_type_b_tip => "报错、卡顿、错位等问题";
static String get feedback_hint => "说说您的建议或者问题,以便我们提供更好的服务(5个人以上)";
static String get feedback_img => "上传图片凭证(提供问题截图)";
static String get feedback_sub => "提交反馈";
static String get feedback_ud_img=> "上传图片";
}
\ No newline at end of file
import 'dart:io';
import 'package:base_data_channel/config/common_colors.dart';
import 'package:base_data_channel/utils/page_utils.dart';
import 'package:flutter/material.dart';
import 'package:dotted_border/dotted_border.dart';
import 'package:qmsd_flutter_user_feedback/config/user_feedback_imgs.dart';
import 'config/user_feedback_strings.dart';
import 'package:image_picker/image_picker.dart';
import 'package:cached_network_image/cached_network_image.dart';
class UserFeedBackPage extends StatefulWidget {
const UserFeedBackPage({Key? key}) : super(key: key);
......@@ -12,16 +17,49 @@ class UserFeedBackPage extends StatefulWidget {
}
class _UserFeedBackPageState extends State<UserFeedBackPage> {
var _feedType = -1; //1=功能异常;2=产品建议
var _feedType = 1; //1=功能异常;2=产品建议
final _controller = TextEditingController();
List<XFile> imgFeed = [];
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: CommonColor.colorF5,
appBar: PageUtils.navigator(context, title: UserFeedBackString.title),
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [_feedbackType()],
body: Stack(
children: [
Positioned(
left: 0,
right: 0,
top: 0,
bottom: 90,
child: ListView(
physics: const BouncingScrollPhysics(),
children: [
_feedbackType(),
_feedbackDes(),
_feedbackImg(),
],
)),
Positioned(
left: 0,
right: 0,
bottom: 0,
child: Container(
height: 50,
alignment: Alignment.center,
margin: const EdgeInsets.only(
left: 12, right: 12, top: 12, bottom: 30),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: CommonColor.colorMainGreen),
child: Text(
UserFeedBackString.feedback_sub,
style: TextStyle(color: CommonColor.color33, fontSize: 18),
),
))
],
),
);
}
......@@ -59,9 +97,7 @@ class _UserFeedBackPageState extends State<UserFeedBackPage> {
}),
child: Container(
margin: EdgeInsets.only(
top: 10,
left: feedType == 2 ? 6 : 0,
right: feedType == 1 ? 6 : 0),
top: 10, left: feedType == 2 ? 6 : 0, right: feedType == 1 ? 6 : 0),
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: _feedType == feedType
......@@ -88,6 +124,7 @@ class _UserFeedBackPageState extends State<UserFeedBackPage> {
style: TextStyle(
color: CommonColor.colorBlack,
fontSize: 12,
height: 2,
fontWeight: FontWeight.w500))
]),
textAlign: TextAlign.center,
......@@ -96,4 +133,174 @@ class _UserFeedBackPageState extends State<UserFeedBackPage> {
),
));
}
_feedbackDes() {
return Container(
margin: const EdgeInsets.only(left: 12, right: 12, bottom: 12),
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(8)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
UserFeedBackString.feedback_type,
style: TextStyle(
color: CommonColor.color33,
fontSize: 17,
),
),
Container(
height: 145,
margin: const EdgeInsets.only(top: 10),
padding: const EdgeInsets.only(bottom: 12),
decoration: BoxDecoration(
color: CommonColor.colorF8,
borderRadius: BorderRadius.circular(8)),
child: TextField(
maxLength: 200,
controller: _controller,
maxLines: 7,
style: TextStyle(
color: CommonColor.color33,
fontSize: 14,
textBaseline: TextBaseline.alphabetic,
),
cursorColor: CommonColor.colorBB,
decoration: InputDecoration(
contentPadding:
const EdgeInsets.only(left: 10, right: 10, top: 10),
border: InputBorder.none,
hintText: UserFeedBackString.feedback_hint,
hintStyle: TextStyle(fontSize: 13, color: CommonColor.colorBB),
),
),
),
],
),
);
}
_feedbackImg() {
return Container(
margin: const EdgeInsets.only(left: 12, right: 12, bottom: 12),
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(8)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
UserFeedBackString.feedback_img,
style: TextStyle(
color: CommonColor.color33,
fontSize: 17,
),
),
GridView.builder(
shrinkWrap: true,
physics: const BouncingScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
childAspectRatio: 1,
),
itemCount: imgFeed.length + 1,
itemBuilder: (context, index) {
// return Image.file(File(imgAD[index].path));
return index == imgFeed.length
? _imgAdd(index)
: _singleAD(index);
},
),
],
),
);
}
_singleAD(int pos) {
return Stack(
children: [
Positioned(
right: 6,
top: 6,
child: imgFeed[pos].path.startsWith('http')
? CachedNetworkImage(
imageUrl: imgFeed[pos].path,
width: 68,
height: 68,
fit: BoxFit.cover,
)
: Image.file(
File(imgFeed[pos].path),
width: 68,
height: 68,
fit: BoxFit.cover,
),
),
Positioned(
right: 0,
child: GestureDetector(
onTap: () {
imgFeed.removeAt(pos);
setState(() {});
},
child: Image.asset(
UserFeedBackImgs.user_feedback_del,
width: 18,
package: "qmsd_flutter_user_feedback",
)),
)
],
);
}
_imgAdd(int pos) {
return Stack(
children: [
Positioned(
right: 6,
top: 6,
left: 5,
bottom: 5,
child: GestureDetector(
onTap: () => getLostData(pos),
child: DottedBorder(
color: CommonColor.colorE3,
strokeWidth: 1,
radius: const Radius.circular(4),
child: Center(
child: RichText(
textAlign: TextAlign.center,
text: TextSpan(children: [
WidgetSpan(
child: Image.asset(
UserFeedBackImgs.user_feedback_camare,
width: 14,
package: "qmsd_flutter_user_feedback",
)),
const TextSpan(
text: '\n',
),
TextSpan(
text: UserFeedBackString.feedback_ud_img,
style: TextStyle(
color: CommonColor.color99,
fontSize: 9,
height: 2))
])),
),
),
))
],
);
}
Future<void> getLostData(int pos) async {
final ImagePicker picker = ImagePicker();
final XFile? image =
await picker.pickImage(source: ImageSource.gallery, imageQuality: 70);
if (image != null) imgFeed.insert(pos, image);
setState(() {});
}
}
......@@ -29,6 +29,7 @@ dev_dependencies:
# The following section is specific to Flutter packages.
flutter:
# This section identifies this Flutter project as a plugin project.
# The 'pluginClass' specifies the class (in Java, Kotlin, Swift, Objective-C, etc.)
# which should be registered in the plugin registry. This is required for
......@@ -55,6 +56,8 @@ flutter:
web:
pluginClass: QmsdFlutterUserFeedbackWeb
fileName: qmsd_flutter_user_feedback_web.dart
assets:
- images/
# To add assets to your plugin package, add an assets section, like this:
# assets:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment