import 'package:electronic_assistant/base/base_page.dart'; import 'package:electronic_assistant/module/main/drawer/complaint/controller.dart'; import 'package:electronic_assistant/resource/assets.gen.dart'; import 'package:electronic_assistant/resource/colors.gen.dart'; import 'package:electronic_assistant/utils/expand.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; class ComplaintOpinionPage extends BasePage { const ComplaintOpinionPage({super.key}); @override bool immersive() { return true; } // 点击空白处收起键盘 @override void backgroundOnTapEvent() { super.backgroundOnTapEvent(); FocusScope.of(Get.context!).requestFocus(FocusNode()); } @override Widget buildBody(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, backgroundColor: Colors.transparent, appBar: AppBar( systemOverlayStyle: SystemUiOverlayStyle.dark, backgroundColor: Colors.transparent, titleTextStyle: TextStyle( color: ColorName.primaryTextColor, fontSize: 17.sp, ), centerTitle: true, title: Obx(() => Text(controller.title.value, style: TextStyle(fontSize: 17.sp, color: ColorName.primaryTextColor))), leading: IconButton( icon: SizedBox( width: 24.w, height: 24.w, child: Assets.images.iconBack.image()), // Custom icon onPressed: () { Get.back(); }, ), ), body: _buildContentView(), ); } Widget _buildContentView() { return SafeArea( child: Container( padding: EdgeInsets.symmetric(horizontal: 12.w), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Obx( () => Text( controller.title.value, style: TextStyle( color: ColorName.secondaryTextColor, fontSize: 14.sp, fontWeight: FontWeight.w500, ), ), ), SizedBox( height: 12.h, ), Container( decoration: BoxDecoration( color: "#E9E9E9".toColor(), borderRadius: BorderRadius.circular(8), ), height: 260.h, child: Obx( () => TextField( maxLength: 200, maxLines: null, cursorColor: ColorName.colorPrimary, style: TextStyle( fontSize: 15.sp, color: ColorName.primaryTextColor), decoration: InputDecoration( counterText: '', border: InputBorder.none, fillColor: Colors.transparent, hintText: controller.title.value == "投诉举报" ? "请输入您的投诉内容" : "请输入您的意见建议", hintStyle: TextStyle( fontSize: 15.sp, color: ColorName.tertiaryTextColor), contentPadding: const EdgeInsets.all(12).w, ), onChanged: (value) { controller.numCount.value = value.length; controller.content.value = value; }, ), ), ), SizedBox( height: 13.h, ), Row( mainAxisAlignment: MainAxisAlignment.end, children: [ Obx( () => Text( "${controller.numCount}/200", style: TextStyle( color: ColorName.tertiaryTextColor, fontSize: 12.sp, ), ), ), ], ), const Spacer(), GestureDetector( onTap: () => controller.requestSubmit(), child: Container( height: 48.w, alignment: Alignment.center, decoration: BoxDecoration( gradient: LinearGradient( colors: ['#6177F2'.color, '#8B9DFF'.color], begin: Alignment.centerLeft, end: Alignment.centerRight, stops: const [0.0, 1.0], ), borderRadius: BorderRadius.circular(8.w), ), child: Text( "提交", style: TextStyle( fontWeight: FontWeight.bold, fontSize: 16.sp, color: Colors.white, ), ), ), ), SizedBox(height: 28.h) ], ), ), ); } }