view.dart 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. title: Obx(() => Text(controller.title.value,
  31. style:
  32. TextStyle(fontSize: 17.sp, color: ColorName.primaryTextColor))),
  33. leading: IconButton(
  34. icon: SizedBox(
  35. width: 24.w, height: 24.w, child: Assets.images.iconBack.image()),
  36. // Custom icon
  37. onPressed: () {
  38. Get.back();
  39. },
  40. ),
  41. ),
  42. body: _buildContentView(),
  43. );
  44. }
  45. Widget _buildContentView() {
  46. return SafeArea(
  47. child: Container(
  48. padding: EdgeInsets.symmetric(horizontal: 12.w),
  49. child: Column(
  50. crossAxisAlignment: CrossAxisAlignment.start,
  51. children: [
  52. Obx(
  53. () => Text(
  54. controller.title.value,
  55. style: TextStyle(
  56. color: ColorName.secondaryTextColor,
  57. fontSize: 14.sp,
  58. fontWeight: FontWeight.w500,
  59. ),
  60. ),
  61. ),
  62. SizedBox(
  63. height: 12.h,
  64. ),
  65. Container(
  66. decoration: BoxDecoration(
  67. color: "#E9E9E9".toColor(),
  68. borderRadius: BorderRadius.circular(8),
  69. ),
  70. height: 260.h,
  71. child: TextField(
  72. maxLength: 200,
  73. maxLines: null,
  74. cursorColor: ColorName.colorPrimary,
  75. style: TextStyle(
  76. fontSize: 15.sp, color: ColorName.primaryTextColor),
  77. decoration: InputDecoration(
  78. counterText: '',
  79. border: InputBorder.none,
  80. fillColor: Colors.transparent,
  81. hintText: "请输入您的投诉内容",
  82. hintStyle: TextStyle(
  83. fontSize: 15.sp, color: ColorName.tertiaryTextColor),
  84. contentPadding: const EdgeInsets.all(12).w,
  85. ),
  86. onChanged: (value) {
  87. controller.numCount.value = value.length;
  88. controller.content.value = value;
  89. },
  90. ),
  91. ),
  92. SizedBox(
  93. height: 13.h,
  94. ),
  95. Row(
  96. mainAxisAlignment: MainAxisAlignment.end,
  97. children: [
  98. Obx(
  99. () => Text(
  100. "${controller.numCount}/200",
  101. style: TextStyle(
  102. color: ColorName.tertiaryTextColor,
  103. fontSize: 12.sp,
  104. ),
  105. ),
  106. ),
  107. ],
  108. ),
  109. const Spacer(),
  110. GestureDetector(
  111. onTap: () => controller.requestSubmit(),
  112. child: Container(
  113. height: 48.w,
  114. alignment: Alignment.center,
  115. decoration: BoxDecoration(
  116. gradient: LinearGradient(
  117. colors: ['#6177F2'.color, '#8B9DFF'.color],
  118. begin: Alignment.centerLeft,
  119. end: Alignment.centerRight,
  120. stops: const [0.0, 1.0],
  121. ),
  122. borderRadius: BorderRadius.circular(8.w),
  123. ),
  124. child: Text(
  125. "提交",
  126. style: TextStyle(
  127. fontWeight: FontWeight.bold,
  128. fontSize: 16.sp,
  129. color: Colors.white,
  130. ),
  131. ),
  132. ),
  133. ),
  134. ],
  135. ),
  136. ),
  137. );
  138. }
  139. }