You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
460 lines
19 KiB
460 lines
19 KiB
import 'package:cached_network_image/cached_network_image.dart';
|
|
import 'package:dating_touchme_app/components/page_appbar.dart';
|
|
import 'package:dating_touchme_app/controller/mine/real_feedback_controller.dart';
|
|
import 'package:dating_touchme_app/extension/ex_widget.dart';
|
|
import 'package:dating_touchme_app/generated/assets.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:tdesign_flutter/tdesign_flutter.dart';
|
|
|
|
|
|
class RealFeedbackPage extends StatelessWidget {
|
|
final int type;
|
|
const RealFeedbackPage({super.key, required this.type});
|
|
|
|
|
|
|
|
|
|
void _showAvatarPopup(RealFeedbackController controller){
|
|
Navigator.of(Get.context!).push(
|
|
TDSlidePopupRoute(
|
|
slideTransitionFrom: SlideTransitionFrom.bottom,
|
|
builder: (context) {
|
|
return Container(
|
|
height: 176,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(12.0),
|
|
topRight: Radius.circular(12.0),
|
|
),
|
|
),
|
|
child: Column(
|
|
children: [
|
|
ClipRRect(
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(12.0),
|
|
topRight: Radius.circular(12.0),
|
|
),
|
|
child: TDCell(
|
|
arrow: false,
|
|
titleWidget: Center(
|
|
child: Text('拍照', style: TextStyle(fontSize: 16.w, color: const Color.fromRGBO(51, 51, 51, 1))),
|
|
),
|
|
style: TDCellStyle(
|
|
padding: EdgeInsets.all(TDTheme.of(context).spacer16),
|
|
clickBackgroundColor: TDTheme.of(context).bgColorContainerHover,
|
|
cardBorderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(12.0),
|
|
topRight: Radius.circular(12.0),
|
|
)
|
|
),
|
|
onClick: (cell) async{
|
|
Navigator.pop(context);
|
|
|
|
if(9 - controller.imgList.length == 1){
|
|
|
|
await controller.handleCameraCapture();
|
|
} else {
|
|
if(controller.imgList.length >= 9){
|
|
|
|
SmartDialog.showToast('超出数量限制,请先删除再尝试上传');
|
|
return;
|
|
}
|
|
await controller.handleCameraCapture();
|
|
}
|
|
},
|
|
),
|
|
),
|
|
const TDDivider(),
|
|
TDCell(
|
|
arrow: false,
|
|
titleWidget: Center(
|
|
child: Text('从相册选择'),
|
|
),
|
|
onClick: (cell) async{
|
|
Navigator.pop(context);
|
|
if(9 - controller.imgList.length == 1){
|
|
await controller.handleGallerySelection();
|
|
} else {
|
|
if(controller.imgList.length >= 9){
|
|
|
|
SmartDialog.showToast('超出数量限制,请先删除再尝试上传');
|
|
return;
|
|
}
|
|
await controller.handleMultiGallerySelection();
|
|
}
|
|
},
|
|
),
|
|
Expanded(
|
|
child: Container(
|
|
color: Color(0xFFF3F3F3),
|
|
),
|
|
),
|
|
TDCell(
|
|
arrow: false,
|
|
titleWidget: Center(
|
|
child: Text('取消'),
|
|
),
|
|
onClick: (cell){
|
|
Navigator.pop(context);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GetX<RealFeedbackController>(
|
|
init: RealFeedbackController(type: type),
|
|
builder: (controller){
|
|
return Stack(
|
|
children: [
|
|
Container(
|
|
width: 375.w,
|
|
height: 812.h,
|
|
color: Colors.white,
|
|
),
|
|
Positioned(
|
|
top: -320.w,
|
|
left: -270.w,
|
|
child: Image.asset(
|
|
Assets.imagesFeedbackBg,
|
|
width: 971.75.w,
|
|
height: 781.25.w,
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
Positioned(
|
|
top: 53.w,
|
|
left: 207.w,
|
|
child: Image.asset(
|
|
Assets.imagesFeedbackIcon,
|
|
width: 140.w,
|
|
height: 140.w,
|
|
),
|
|
),
|
|
Scaffold(
|
|
appBar: PageAppbar(title: "", backgroundColor: Colors.transparent,),
|
|
backgroundColor: Colors.transparent,
|
|
body: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
padding: EdgeInsets.symmetric(
|
|
vertical: 22.w,
|
|
horizontal: 14.w
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
"意见反馈",
|
|
style: TextStyle(
|
|
fontSize: 21.w,
|
|
fontWeight: FontWeight.w500
|
|
),
|
|
),
|
|
SizedBox(height: 5.w,),
|
|
Text(
|
|
"Hi,给出你的小建议吧~",
|
|
style: TextStyle(
|
|
fontSize: 13.w,
|
|
fontWeight: FontWeight.w500
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Container(
|
|
width: 375.w,
|
|
padding: EdgeInsets.symmetric(
|
|
vertical: 11.w,
|
|
horizontal: 14.w
|
|
),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(9.w)),
|
|
color: Colors.white
|
|
),
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
RichText(
|
|
text: TextSpan(
|
|
style: TextStyle(
|
|
fontSize: 16.w,
|
|
fontWeight: FontWeight.w500
|
|
),
|
|
children: [
|
|
TextSpan(
|
|
text: "选择问题的类型",
|
|
style: TextStyle(
|
|
color: const Color.fromRGBO(51, 51, 51, 1)
|
|
)
|
|
),
|
|
TextSpan(
|
|
text: "*",
|
|
style: TextStyle(
|
|
color: const Color.fromRGBO(248, 85, 66, 1)
|
|
)
|
|
)
|
|
]
|
|
),
|
|
),
|
|
SizedBox(height: 11.w,),
|
|
Wrap(
|
|
alignment: WrapAlignment.spaceBetween,
|
|
spacing: 10.w,
|
|
runSpacing: 10.w,
|
|
children: [
|
|
...controller.tagList.asMap().entries.map((entry){
|
|
return TagItem(item: entry.value, index: entry.key, active: controller.active.value, changeActive: controller.changeActive,);
|
|
}),
|
|
],
|
|
),
|
|
SizedBox(height: 20.w,),
|
|
RichText(
|
|
text: TextSpan(
|
|
style: TextStyle(
|
|
fontSize: 16.w,
|
|
fontWeight: FontWeight.w500
|
|
),
|
|
children: [
|
|
TextSpan(
|
|
text: "问题描述",
|
|
style: TextStyle(
|
|
color: const Color.fromRGBO(51, 51, 51, 1)
|
|
)
|
|
),
|
|
TextSpan(
|
|
text: "*",
|
|
style: TextStyle(
|
|
color: const Color.fromRGBO(248, 85, 66, 1)
|
|
)
|
|
)
|
|
]
|
|
),
|
|
),
|
|
SizedBox(height: 11.w,),
|
|
Container(
|
|
padding: EdgeInsets.all(14.w),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.all(Radius.circular(8.w)),
|
|
color: const Color.fromRGBO(245, 245, 245, 1)
|
|
),
|
|
child: TextField(
|
|
controller: controller.messageController.value,
|
|
maxLength: 500, // 上限
|
|
minLines: 5, // 多行
|
|
maxLines: 5, // 自适应高度
|
|
style: TextStyle(
|
|
fontSize: ScreenUtil().setWidth(13),
|
|
height: 1
|
|
),
|
|
decoration: InputDecoration(
|
|
contentPadding: EdgeInsets.symmetric(
|
|
vertical: 0,
|
|
horizontal: 0
|
|
),
|
|
hintText: "请输入您的宝贵的建议",
|
|
|
|
border: const OutlineInputBorder(
|
|
borderSide: BorderSide.none, // 这将移除边框 // 可选:设置圆角
|
|
),
|
|
// 如果你希望聚焦时和未聚焦时都没有边框,也可以设置 focusedBorder 和 enabledBorder
|
|
focusedBorder: const OutlineInputBorder(
|
|
borderSide: BorderSide.none,
|
|
borderRadius: BorderRadius.all(Radius.circular(8.0)),
|
|
),
|
|
enabledBorder: const OutlineInputBorder(
|
|
borderSide: BorderSide.none,
|
|
borderRadius: BorderRadius.all(Radius.circular(8.0)),
|
|
),
|
|
),
|
|
onChanged: (value){
|
|
controller.message.value = value;
|
|
},
|
|
),
|
|
),
|
|
SizedBox(height: 10.w,),
|
|
Wrap(
|
|
spacing: 10.w,
|
|
runSpacing: 10.w,
|
|
children: [
|
|
...controller.imgList.map((e){
|
|
return Stack(
|
|
children: [
|
|
CachedNetworkImage(
|
|
imageUrl: e,
|
|
width: 70.w,
|
|
height: 70.w,
|
|
fit: BoxFit.cover,
|
|
),
|
|
Positioned(
|
|
left: 5.w,
|
|
top: 5.w,
|
|
child: Container(
|
|
width: 20.w,
|
|
height: 20.w,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.all(Radius.circular(20.w)),
|
|
color: const Color.fromRGBO(0, 0, 0, .3)
|
|
),
|
|
child: Icon(
|
|
Icons.close,
|
|
size: 20.w,
|
|
),
|
|
).onTap((){
|
|
controller.imgList.remove(e);
|
|
|
|
}),
|
|
)
|
|
],
|
|
);
|
|
}),
|
|
Container(
|
|
width: 70.w,
|
|
height: 70.w,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.all(Radius.circular(8.w)),
|
|
border: Border.all(width: 1, color: const Color.fromRGBO(224, 224, 224, 1))
|
|
),
|
|
child: Center(
|
|
child: Icon(
|
|
Icons.add,
|
|
size: 18.w,
|
|
color: const Color.fromRGBO(144, 144, 144, 1),
|
|
),
|
|
),
|
|
).onTap((){
|
|
_showAvatarPopup(controller);
|
|
})
|
|
],
|
|
),
|
|
SizedBox(height: 10.w,),
|
|
Text(
|
|
"上传问题截图可以让问题快速解决!",
|
|
style: TextStyle(
|
|
fontSize: 11.w,
|
|
color: const Color.fromRGBO(189, 189, 189, 1)
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.symmetric(vertical: 30.w),
|
|
child: Container(
|
|
width: 350.w,
|
|
height: 45.w,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.all(Radius.circular(45.w)),
|
|
gradient: LinearGradient(
|
|
begin: Alignment.centerLeft, // 90deg: 从左到右
|
|
end: Alignment.centerRight,
|
|
colors: [
|
|
Color.fromRGBO(131, 89, 255, 1), // 起点颜色
|
|
Color.fromRGBO(77, 127, 231, 1), // 中间颜色
|
|
Color.fromRGBO(61, 138, 224, 1), // 终点颜色
|
|
],
|
|
stops: [0.0, 0.7753, 1.0], // 对应 0%、77.53%、100%
|
|
),
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
"确认",
|
|
style: TextStyle(
|
|
fontSize: 18.w,
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.w500
|
|
),
|
|
),
|
|
),
|
|
),
|
|
).onTap((){
|
|
controller.sendFeedback();
|
|
})
|
|
],
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
)
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
class TagItem extends StatefulWidget {
|
|
final Map item;
|
|
final int index;
|
|
final int active;
|
|
final void Function(int) changeActive;
|
|
const TagItem({super.key, required this.item, required this.index, required this.active, required this.changeActive});
|
|
|
|
@override
|
|
State<TagItem> createState() => _TagItemState();
|
|
}
|
|
|
|
class _TagItemState extends State<TagItem> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Stack(
|
|
children: [
|
|
Container(
|
|
padding: EdgeInsets.symmetric(
|
|
vertical: 9.w,
|
|
horizontal: 14.w
|
|
),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.all(Radius.circular(8.w)),
|
|
border: Border.all(width: 1, color: widget.item["value"] == widget.active ? const Color.fromRGBO(117, 98, 249, 1) : const Color.fromRGBO(207, 207, 207, 1)),
|
|
color: widget.item["value"] == widget.active ? const Color.fromRGBO(194, 195, 255, 0.2) : Colors.transparent
|
|
),
|
|
child: Text(
|
|
widget.item["label"],
|
|
style: TextStyle(
|
|
fontSize: 13.w
|
|
),
|
|
),
|
|
).onTap((){
|
|
widget.changeActive(widget.item["value"]);
|
|
}),
|
|
if(widget.active == widget.item["value"])Positioned(
|
|
bottom: 0,
|
|
right: 0,
|
|
child: Container(
|
|
width: 17.w,
|
|
height: 13.w,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(8.w),
|
|
bottomRight: Radius.circular(8.w)
|
|
),
|
|
color: const Color.fromRGBO(117, 98, 249, 1)
|
|
),
|
|
child: Center(
|
|
child: Image.asset(
|
|
Assets.imagesCheck,
|
|
width: 6.w,
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|