import 'package:cached_network_image/cached_network_image.dart'; import 'package:dating_touchme_app/components/page_appbar.dart'; import 'package:dating_touchme_app/controller/home/report_controller.dart'; import 'package:dating_touchme_app/extension/ex_widget.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 ReportPage extends StatelessWidget { final String id; const ReportPage({super.key, required this.id}); void _showAvatarPopup(ReportController 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( init: ReportController(id: id), builder: (controller){ return Scaffold( appBar: PageAppbar(title: "举报中心"), body: SingleChildScrollView( child: Container( padding: EdgeInsets.only( top: 6.w, right: 10.w, left: 20.w ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.start, children: [ Text( "请选择举报的原因", style: TextStyle( fontSize: 12.w, color: const Color.fromRGBO(144, 144, 144, 1) ), ), ], ), SizedBox(height: 9.w ,), SizedBox( height: 32.w, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "资料作假", style: TextStyle( fontSize: 12.w, color: const Color.fromRGBO(51, 51, 51, 1), fontWeight: FontWeight.w500 ), ), Checkbox( value: controller.checked.value == 1, onChanged: (value) { controller.checked.value = 1; }, activeColor: const Color.fromRGBO(117, 98, 249, 1), side: const BorderSide(color: Colors.grey), shape: const CircleBorder(), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, ), ], ), ), SizedBox( height: 32.w, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "色情低俗", style: TextStyle( fontSize: 13.w, color: const Color.fromRGBO(51, 51, 51, 1), fontWeight: FontWeight.w500 ), ), Checkbox( value: controller.checked.value == 2, onChanged: (value) { controller.checked.value = 2; }, activeColor: const Color.fromRGBO(117, 98, 249, 1), side: const BorderSide(color: Colors.grey), shape: const CircleBorder(), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, ), ], ), ), SizedBox( height: 32.w, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "涉政/涉独", style: TextStyle( fontSize: 13.w, color: const Color.fromRGBO(51, 51, 51, 1), fontWeight: FontWeight.w500 ), ), Checkbox( value: controller.checked.value == 3, onChanged: (value) { controller.checked.value = 3; }, activeColor: const Color.fromRGBO(117, 98, 249, 1), side: const BorderSide(color: Colors.grey), shape: const CircleBorder(), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, ), ], ), ), SizedBox( height: 32.w, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "违法违禁", style: TextStyle( fontSize: 13.w, color: const Color.fromRGBO(51, 51, 51, 1), fontWeight: FontWeight.w500 ), ), Checkbox( value: controller.checked.value == 4, onChanged: (value) { controller.checked.value = 4; }, activeColor: const Color.fromRGBO(117, 98, 249, 1), side: const BorderSide(color: Colors.grey), shape: const CircleBorder(), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, ), ], ), ), SizedBox( height: 32.w, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "未成年相关", style: TextStyle( fontSize: 13.w, color: const Color.fromRGBO(51, 51, 51, 1), fontWeight: FontWeight.w500 ), ), Checkbox( value: controller.checked.value == 5, onChanged: (value) { controller.checked.value = 5; }, activeColor: const Color.fromRGBO(117, 98, 249, 1), side: const BorderSide(color: Colors.grey), shape: const CircleBorder(), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, ), ], ), ), SizedBox( height: 32.w, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "欺诈/广告/引导第三方交易", style: TextStyle( fontSize: 13.w, color: const Color.fromRGBO(51, 51, 51, 1), fontWeight: FontWeight.w500 ), ), Checkbox( value: controller.checked.value == 6, onChanged: (value) { controller.checked.value = 6; }, activeColor: const Color.fromRGBO(117, 98, 249, 1), side: const BorderSide(color: Colors.grey), shape: const CircleBorder(), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, ), ], ), ), SizedBox( height: 32.w, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "恶意骚扰/侮辱谩骂", style: TextStyle( fontSize: 13.w, color: const Color.fromRGBO(51, 51, 51, 1), fontWeight: FontWeight.w500 ), ), Checkbox( value: controller.checked.value == 7, onChanged: (value) { controller.checked.value = 7; }, activeColor: const Color.fromRGBO(117, 98, 249, 1), side: const BorderSide(color: Colors.grey), shape: const CircleBorder(), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, ), ], ), ), SizedBox( height: 32.w, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "其他", style: TextStyle( fontSize: 13.w, color: const Color.fromRGBO(51, 51, 51, 1), fontWeight: FontWeight.w500 ), ), Checkbox( value: controller.checked.value == 8, onChanged: (value) { controller.checked.value = 8; }, activeColor: const Color.fromRGBO(117, 98, 249, 1), side: const BorderSide(color: Colors.grey), shape: const CircleBorder(), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, ), ], ), ), SizedBox(height: 29.w ,), Row( mainAxisAlignment: MainAxisAlignment.start, children: [ Text( "图片证据(选填)", style: TextStyle( fontSize: 13.w, color: const Color.fromRGBO(144, 144, 144, 1) ), ), ], ), SizedBox(height: 13.w ,), Wrap( spacing: 10.w, runSpacing: 10.w, children: [ ...controller.imgList.map((e){ return Stack( children: [ CachedNetworkImage( imageUrl: e, width: 80.w, height: 80.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: 80.w, height: 80.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: 13.w, color: const Color.fromRGBO(144, 144, 144, 1), ), ), ).onTap((){ _showAvatarPopup(controller); }) ], ), SizedBox(height: 15.w ,), Row( mainAxisAlignment: MainAxisAlignment.start, children: [ Text( "投诉内容(选填)", style: TextStyle( fontSize: 13.w, color: const Color.fromRGBO(144, 144, 144, 1) ), ), ], ), Container( padding: EdgeInsets.all(17.w), decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(8.w)), border: Border.all(width: 1, color: const Color.fromRGBO(224, 224, 224, 1)) ), child: TextField( controller: controller.messageController.value, minLines: 3, // 多行 maxLines: 3, // 自适应高度 style: TextStyle( fontSize: ScreenUtil().setWidth(12), 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(4.0)), ), enabledBorder: const OutlineInputBorder( borderSide: BorderSide.none, borderRadius: BorderRadius.all(Radius.circular(4.0)), ), ), onChanged: (value){ controller.message.value = value; }, ), ), SizedBox(height: 16.w ,), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "同时加入黑名单", style: TextStyle( fontSize: 13.w, color: const Color.fromRGBO(51, 51, 51, 1), fontWeight: FontWeight.w500 ), ), TDSwitch( isOn: controller.blockUser.value, trackOnColor: const Color.fromRGBO(117, 98, 249, 1), onChanged: (bool e){ print(e); controller.blockUser.value = e; return e; }, ), ], ), SizedBox(height: 53.w ,), Container( width: 325.w, height: 45.w, decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(45.w)), color: Color.fromRGBO(117, 98, 249, controller.checked.value != 0 ? 1 : .6) ), child: Center( child: Text( "提交", style: TextStyle( fontSize: 18.w, color: Colors.white, fontWeight: FontWeight.w500 ), ), ), ).onTap((){ controller.sendReport(); }) ], ), ), ), ); }, ); } }