index.dart 3.3KB

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