view.dart 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. import 'package:electronic_assistant/base/base_page.dart';
  2. import 'package:electronic_assistant/module/main/drawer/complaint/controller.dart';
  3. import 'package:electronic_assistant/resource/assets.gen.dart';
  4. import 'package:electronic_assistant/resource/colors.gen.dart';
  5. import 'package:electronic_assistant/utils/expand.dart';
  6. import 'package:flutter/material.dart';
  7. import 'package:flutter/services.dart';
  8. import 'package:flutter_screenutil/flutter_screenutil.dart';
  9. import 'package:get/get.dart';
  10. class ComplaintOpinionPage extends BasePage<ComplaintOpinionController> {
  11. const ComplaintOpinionPage({super.key});
  12. @override
  13. bool immersive() {
  14. return true;
  15. }
  16. // 点击空白处收起键盘
  17. @override
  18. void backgroundOnTapEvent() {
  19. super.backgroundOnTapEvent();
  20. FocusScope.of(Get.context!).requestFocus(FocusNode());
  21. }
  22. @override
  23. Widget buildBody(BuildContext context) {
  24. return Scaffold(
  25. resizeToAvoidBottomInset: false,
  26. backgroundColor: Colors.transparent,
  27. appBar: AppBar(
  28. systemOverlayStyle: SystemUiOverlayStyle.dark,
  29. backgroundColor: Colors.transparent,
  30. titleTextStyle: TextStyle(
  31. color: ColorName.primaryTextColor,
  32. fontSize: 17.sp,
  33. ),
  34. centerTitle: true,
  35. title: Obx(() => Text(controller.title.value,
  36. style:
  37. TextStyle(fontSize: 17.sp, color: ColorName.primaryTextColor))),
  38. leading: IconButton(
  39. icon: SizedBox(
  40. width: 24.w, height: 24.w, child: Assets.images.iconBack.image()),
  41. // Custom icon
  42. onPressed: () {
  43. Get.back();
  44. },
  45. ),
  46. ),
  47. body: _buildContentView(),
  48. );
  49. }
  50. Widget _buildContentView() {
  51. return SafeArea(
  52. child: Container(
  53. padding: EdgeInsets.symmetric(horizontal: 12.w),
  54. child: Column(
  55. crossAxisAlignment: CrossAxisAlignment.start,
  56. children: [
  57. Obx(
  58. () => Text(
  59. controller.title.value,
  60. style: TextStyle(
  61. color: ColorName.secondaryTextColor,
  62. fontSize: 14.sp,
  63. fontWeight: FontWeight.w500,
  64. ),
  65. ),
  66. ),
  67. SizedBox(
  68. height: 12.h,
  69. ),
  70. Container(
  71. decoration: BoxDecoration(
  72. color: "#E9E9E9".toColor(),
  73. borderRadius: BorderRadius.circular(8),
  74. ),
  75. height: 260.h,
  76. child: Obx(
  77. () => TextField(
  78. maxLength: 200,
  79. maxLines: null,
  80. cursorColor: ColorName.colorPrimary,
  81. style: TextStyle(
  82. fontSize: 15.sp, color: ColorName.primaryTextColor),
  83. decoration: InputDecoration(
  84. counterText: '',
  85. border: InputBorder.none,
  86. fillColor: Colors.transparent,
  87. hintText: controller.title.value == "投诉举报"
  88. ? "请输入您的投诉内容"
  89. : "请输入您的意见建议",
  90. hintStyle: TextStyle(
  91. fontSize: 15.sp, color: ColorName.tertiaryTextColor),
  92. contentPadding: const EdgeInsets.all(12).w,
  93. ),
  94. onChanged: (value) {
  95. controller.numCount.value = value.length;
  96. controller.content.value = value;
  97. },
  98. ),
  99. ),
  100. ),
  101. SizedBox(
  102. height: 13.h,
  103. ),
  104. Row(
  105. mainAxisAlignment: MainAxisAlignment.end,
  106. children: [
  107. Obx(
  108. () => Text(
  109. "${controller.numCount}/200",
  110. style: TextStyle(
  111. color: ColorName.tertiaryTextColor,
  112. fontSize: 12.sp,
  113. ),
  114. ),
  115. ),
  116. ],
  117. ),
  118. const Spacer(),
  119. GestureDetector(
  120. onTap: () => controller.requestSubmit(),
  121. child: Container(
  122. height: 48.w,
  123. alignment: Alignment.center,
  124. decoration: BoxDecoration(
  125. gradient: LinearGradient(
  126. colors: ['#6177F2'.color, '#8B9DFF'.color],
  127. begin: Alignment.centerLeft,
  128. end: Alignment.centerRight,
  129. stops: const [0.0, 1.0],
  130. ),
  131. borderRadius: BorderRadius.circular(8.w),
  132. ),
  133. child: Text(
  134. "提交",
  135. style: TextStyle(
  136. fontWeight: FontWeight.bold,
  137. fontSize: 16.sp,
  138. color: Colors.white,
  139. ),
  140. ),
  141. ),
  142. ),
  143. SizedBox(height: 28.h)
  144. ],
  145. ),
  146. ),
  147. );
  148. }
  149. }