feedback_view.dart 6.3 KB

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