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 '../controllers/feedback_controller.dart';
  10. class FeedbackView extends BaseView<FeedbackController> {
  11. const FeedbackView({super.key});
  12. @override
  13. PreferredSizeWidget? get appBar => IXAppBar(title: 'Feedback');
  14. @override
  15. Widget buildContent(BuildContext context) {
  16. return Padding(
  17. padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 10.w),
  18. child: Column(
  19. crossAxisAlignment: CrossAxisAlignment.start,
  20. children: [
  21. // 反馈内容输入区域
  22. Expanded(
  23. child: Container(
  24. decoration: BoxDecoration(
  25. color: Get.reactiveTheme.highlightColor,
  26. borderRadius: BorderRadius.circular(12.r),
  27. border: Border.all(
  28. color: Get.reactiveTheme.dividerColor,
  29. width: 1.w,
  30. ),
  31. ),
  32. child: Padding(
  33. padding: EdgeInsets.all(14.w),
  34. child: TextField(
  35. controller: controller.feedbackController,
  36. maxLines: null,
  37. expands: true,
  38. textAlignVertical: TextAlignVertical.top,
  39. cursorHeight: 18.w,
  40. style: TextStyle(
  41. fontSize: 16.sp,
  42. height: 1.4,
  43. color: Get.reactiveTheme.textTheme.bodyLarge!.color,
  44. fontWeight: FontWeight.w400,
  45. ),
  46. decoration: InputDecoration(
  47. hintText:
  48. 'An English version for reference: Describe\nyour issue or suggestion...',
  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: 'Enter your email',
  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. '• Your email address (for our reply)',
  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. 'Send',
  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. }