index.dart 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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: Positioned(
  51. left: 20.w,
  52. top: 5.w,
  53. child: Row(
  54. children: [
  55. Image.asset(
  56. 'images/icons/feedbackIcon.png',
  57. width: 15.w,
  58. ),
  59. Text(
  60. '请留下您宝贵的意见和建议!',
  61. style: TextStyle(
  62. fontSize: 17.sp,
  63. letterSpacing: 2,
  64. color: Color(0xFFBEBDBD)),
  65. ),
  66. ],
  67. ),
  68. ),
  69. ),
  70. ),
  71. Positioned(
  72. bottom: 25.h,
  73. child: DefaultButton(
  74. color: const Color(0xffffffff),
  75. backColor: const Color(0xFFFF703B),
  76. width: 345.w,
  77. height: 49.h,
  78. text: '提交',
  79. onPressed: () {
  80. if (text() == '') {
  81. Fluttertoast.showToast(msg: '请输入内容哦');
  82. } else {
  83. feedback(text()).then((value) {
  84. Fluttertoast.showToast(msg: '提交成功!');
  85. Get.back();
  86. });
  87. }
  88. },
  89. margin: const EdgeInsets.all(0),
  90. fontSize: 20.sp,
  91. radius: 24.5.w,
  92. ),
  93. ),
  94. ],
  95. ),
  96. );
  97. }
  98. }