feedback_view.dart 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. import 'package:flutter_spinkit/flutter_spinkit.dart';
  4. import 'package:get/get.dart';
  5. import 'package:nomo/app/base/base_view.dart';
  6. import 'package:nomo/app/widgets/click_opacity.dart';
  7. import 'package:nomo/app/widgets/ix_app_bar.dart';
  8. import 'package:nomo/config/theme/theme_extensions/theme_extension.dart';
  9. import '../../../../config/translations/strings_enum.dart';
  10. import '../controllers/feedback_controller.dart';
  11. class FeedbackView extends BaseView<FeedbackController> {
  12. const FeedbackView({super.key});
  13. @override
  14. PreferredSizeWidget? get appBar => IXAppBar(
  15. title: Strings.feedback.tr,
  16. onBackPressed: controller.onBackPressed,
  17. );
  18. @override
  19. Widget buildContent(BuildContext context) {
  20. return Padding(
  21. padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 10.w),
  22. child: Column(
  23. crossAxisAlignment: CrossAxisAlignment.start,
  24. children: [
  25. // 反馈内容输入区域
  26. Expanded(
  27. child: Container(
  28. decoration: BoxDecoration(
  29. color: Get.reactiveTheme.highlightColor,
  30. borderRadius: BorderRadius.circular(12.r),
  31. border: Border.all(
  32. color: Get.reactiveTheme.dividerColor,
  33. width: 1.w,
  34. ),
  35. ),
  36. child: Padding(
  37. padding: EdgeInsets.all(14.w),
  38. child: TextField(
  39. controller: controller.feedbackController,
  40. maxLines: null,
  41. expands: true,
  42. textAlignVertical: TextAlignVertical.top,
  43. cursorHeight: 18.w,
  44. focusNode: controller.feedbackFocusNode,
  45. style: TextStyle(
  46. fontSize: 16.sp,
  47. height: 1.4,
  48. color: Get.reactiveTheme.textTheme.bodyLarge!.color,
  49. fontWeight: FontWeight.w400,
  50. ),
  51. decoration: InputDecoration(
  52. hintText: Strings.feedbackPlaceholder.tr,
  53. hintStyle: TextStyle(
  54. fontSize: 16.sp,
  55. height: 1.4,
  56. fontWeight: FontWeight.w400,
  57. color: Get.reactiveTheme.hintColor,
  58. ),
  59. border: InputBorder.none,
  60. contentPadding: EdgeInsets.zero,
  61. ),
  62. ),
  63. ),
  64. ),
  65. ),
  66. 20.verticalSpaceFromWidth,
  67. // 邮箱输入区域
  68. Container(
  69. height: 50.w,
  70. alignment: Alignment.center,
  71. decoration: BoxDecoration(
  72. color: Get.reactiveTheme.highlightColor,
  73. borderRadius: BorderRadius.circular(12.r),
  74. border: Border.all(
  75. color: Get.reactiveTheme.dividerColor,
  76. width: 1.w,
  77. ),
  78. ),
  79. child: Padding(
  80. padding: EdgeInsets.symmetric(horizontal: 14.w),
  81. child: TextField(
  82. controller: controller.emailController,
  83. maxLines: 1, // 邮箱输入通常只需要一行
  84. cursorHeight: 18.w,
  85. scrollPadding: EdgeInsets.zero,
  86. focusNode: controller.emailFocusNode,
  87. style: TextStyle(
  88. fontSize: 16.sp,
  89. height: 1.4,
  90. color: Get.reactiveTheme.textTheme.bodyLarge!.color,
  91. fontWeight: FontWeight.w400,
  92. ),
  93. decoration: InputDecoration(
  94. hintText: Strings.enterYourEmail.tr,
  95. hintStyle: TextStyle(
  96. fontSize: 16.sp,
  97. height: 1.4,
  98. fontWeight: FontWeight.w400,
  99. color: Get.reactiveTheme.hintColor,
  100. ),
  101. border: InputBorder.none,
  102. contentPadding: EdgeInsets.zero,
  103. ),
  104. ),
  105. ),
  106. ),
  107. 10.verticalSpaceFromWidth,
  108. Text(
  109. Strings.emailAddressForReply.tr,
  110. style: TextStyle(
  111. fontSize: 13.sp,
  112. height: 1.4,
  113. fontWeight: FontWeight.w400,
  114. color: Get.reactiveTheme.hintColor,
  115. ),
  116. ),
  117. 30.verticalSpaceFromWidth,
  118. // 发送按钮
  119. Expanded(
  120. child: SafeArea(
  121. child: Container(
  122. alignment: Alignment.bottomCenter,
  123. child: Obx(() {
  124. final canSubmit = controller.canSubmit;
  125. final isSubmitting = controller.isSubmitting.value;
  126. final isEnabled = canSubmit && !isSubmitting;
  127. return ClickOpacity(
  128. onTap: isEnabled ? controller.submitFeedback : null,
  129. child: AnimatedContainer(
  130. duration: const Duration(milliseconds: 200),
  131. width: double.infinity,
  132. height: 50.w,
  133. decoration: BoxDecoration(
  134. color: isEnabled
  135. ? Get.reactiveTheme.primaryColor
  136. : Get.reactiveTheme.highlightColor,
  137. borderRadius: BorderRadius.circular(12.r),
  138. border: Border.all(
  139. color: isEnabled
  140. ? Get.reactiveTheme.primaryColor
  141. : Get.reactiveTheme.dividerColor,
  142. width: 1.w,
  143. ),
  144. ),
  145. child: Center(
  146. child: isSubmitting
  147. ? SpinKitRing(
  148. size: 20.w,
  149. lineWidth: 2.w,
  150. color: Get
  151. .reactiveTheme
  152. .textTheme
  153. .bodyLarge!
  154. .color!,
  155. )
  156. : Text(
  157. Strings.send.tr,
  158. style: TextStyle(
  159. fontSize: 16.sp,
  160. fontWeight: FontWeight.w600,
  161. color: isEnabled
  162. ? Colors.white
  163. : Get.reactiveTheme.hintColor,
  164. ),
  165. ),
  166. ),
  167. ),
  168. );
  169. }),
  170. ),
  171. ),
  172. ),
  173. ],
  174. ),
  175. );
  176. }
  177. }