index.dart 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import 'package:farmer_client/widgets/DefaultButton.dart';
  2. import 'package:farmer_client/widgets/layout/BasicPage.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:flutter_screenutil/flutter_screenutil.dart';
  5. import 'package:fluttertoast/fluttertoast.dart';
  6. import 'package:get/get.dart';
  7. import '../../services/main.dart';
  8. class Feedback extends BasicPage {
  9. final text=Rx<String>('');
  10. final isEdit=Rx<bool>(false);
  11. @override
  12. Widget builder(BuildContext context) {
  13. naviTitle = '意见反馈';
  14. return Container(
  15. height: 700.h,
  16. padding: EdgeInsets.all(15.w),
  17. child: Stack(
  18. children: [
  19. Container(
  20. margin: EdgeInsets.fromLTRB(0, 0, 0, 50.h),
  21. padding: EdgeInsets.symmetric(vertical: 5.w, horizontal: 18.5.w),
  22. decoration: BoxDecoration(
  23. color: const Color(0xFFfefefe),
  24. borderRadius: BorderRadius.all(Radius.circular(10.w)),
  25. border: Border.all(
  26. color: const Color(0xcc000000),
  27. width: 1.h,
  28. style: BorderStyle.solid)),
  29. child: TextFormField(
  30. minLines: 6,
  31. maxLines: 6,
  32. style: TextStyle(fontSize: 17.sp, height: 1.5),
  33. decoration: const InputDecoration(
  34. isCollapsed: true,
  35. border: InputBorder.none,
  36. counterText: '', //去掉计数
  37. floatingLabelBehavior: FloatingLabelBehavior.never,
  38. ),
  39. onTap: () {
  40. isEdit.value=true;
  41. },
  42. onChanged: (e) {
  43. text.value = e;
  44. },
  45. ),
  46. ),
  47. Obx(()=>
  48. Visibility(
  49. visible:!isEdit(),
  50. child:
  51. Positioned(
  52. left: 20.w,
  53. top: 5.w,
  54. child: Row(
  55. children: [
  56. Image.asset(
  57. 'images/icons/feedbackIcon.png',
  58. width: 15.w,
  59. ),
  60. Text(
  61. '请留下您宝贵的意见和建议!',
  62. style: TextStyle(
  63. fontSize: 17.sp,
  64. letterSpacing: 2,
  65. color: Color(0xFFBEBDBD)),
  66. ),
  67. ],
  68. ),
  69. ),
  70. ),
  71. ),
  72. Positioned(
  73. bottom: 25.h,
  74. child: DefaultButton(
  75. color: const Color(0xffffffff),
  76. backColor: const Color(0xFFFF703B),
  77. width: 345.w,
  78. height: 49.h,
  79. text: '提交',
  80. onPressed: () {
  81. if (text() == '') {
  82. Fluttertoast.showToast(msg: '请输入内容哦');
  83. } else {
  84. feedback(text()).then((value) {
  85. Fluttertoast.showToast(msg: '提交成功!');
  86. Get.back();
  87. });
  88. }
  89. },
  90. margin: const EdgeInsets.all(0),
  91. fontSize: 20.sp,
  92. radius: 24.5.w,
  93. ),
  94. ),
  95. ],
  96. ),
  97. );
  98. }
  99. }