view.dart 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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: TextField(
  77. maxLength: 200,
  78. maxLines: null,
  79. cursorColor: ColorName.colorPrimary,
  80. style: TextStyle(
  81. fontSize: 15.sp, color: ColorName.primaryTextColor),
  82. decoration: InputDecoration(
  83. counterText: '',
  84. border: InputBorder.none,
  85. fillColor: Colors.transparent,
  86. hintText: "请输入您的投诉内容",
  87. hintStyle: TextStyle(
  88. fontSize: 15.sp, color: ColorName.tertiaryTextColor),
  89. contentPadding: const EdgeInsets.all(12).w,
  90. ),
  91. onChanged: (value) {
  92. controller.numCount.value = value.length;
  93. controller.content.value = value;
  94. },
  95. ),
  96. ),
  97. SizedBox(
  98. height: 13.h,
  99. ),
  100. Row(
  101. mainAxisAlignment: MainAxisAlignment.end,
  102. children: [
  103. Obx(
  104. () => Text(
  105. "${controller.numCount}/200",
  106. style: TextStyle(
  107. color: ColorName.tertiaryTextColor,
  108. fontSize: 12.sp,
  109. ),
  110. ),
  111. ),
  112. ],
  113. ),
  114. const Spacer(),
  115. GestureDetector(
  116. onTap: () => controller.requestSubmit(),
  117. child: Container(
  118. height: 48.w,
  119. alignment: Alignment.center,
  120. decoration: BoxDecoration(
  121. gradient: LinearGradient(
  122. colors: ['#6177F2'.color, '#8B9DFF'.color],
  123. begin: Alignment.centerLeft,
  124. end: Alignment.centerRight,
  125. stops: const [0.0, 1.0],
  126. ),
  127. borderRadius: BorderRadius.circular(8.w),
  128. ),
  129. child: Text(
  130. "提交",
  131. style: TextStyle(
  132. fontWeight: FontWeight.bold,
  133. fontSize: 16.sp,
  134. color: Colors.white,
  135. ),
  136. ),
  137. ),
  138. ),
  139. SizedBox(height: 28.h)
  140. ],
  141. ),
  142. ),
  143. );
  144. }
  145. }