You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
174 lines
6.8 KiB
174 lines
6.8 KiB
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import '../controllers/feedback_controller.dart';
|
|
|
|
class FeedbackView extends GetView<FeedbackController> {
|
|
const FeedbackView({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
|
|
|
|
return Scaffold(
|
|
backgroundColor: isDarkMode ? Colors.black : Colors.grey[100],
|
|
appBar: AppBar(
|
|
elevation: 0,
|
|
backgroundColor: isDarkMode ? Colors.black : Colors.white,
|
|
leading: IconButton(
|
|
icon: Icon(
|
|
Icons.arrow_back_ios,
|
|
size: 20.sp,
|
|
color: isDarkMode ? Colors.white : Colors.black,
|
|
),
|
|
onPressed: () => Get.back(),
|
|
),
|
|
title: Text(
|
|
'feedback'.tr, // 帮助与反馈
|
|
style: TextStyle(
|
|
fontSize: 17.sp,
|
|
fontWeight: FontWeight.w600,
|
|
color: isDarkMode ? Colors.white : Colors.black,
|
|
),
|
|
),
|
|
centerTitle: true,
|
|
),
|
|
body: GestureDetector(
|
|
onTap: () => FocusScope.of(context).unfocus(),
|
|
child: Form(
|
|
key: controller.formKey,
|
|
child: ListView(
|
|
padding: EdgeInsets.all(16.w),
|
|
children: [
|
|
// 顶部提示文字
|
|
Text(
|
|
'feedbackDescription'.tr, // 请描述您遇到的问题或建议
|
|
style: TextStyle(
|
|
fontSize: 14.sp,
|
|
color: isDarkMode ? Colors.white70 : Colors.black54,
|
|
),
|
|
),
|
|
SizedBox(height: 16.h),
|
|
|
|
// 反馈内容输入框 - 统一容器样式
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
// 保持适合各自模式的背景色
|
|
color: isDarkMode ? Colors.grey[800] : Colors.white,
|
|
// 统一圆角
|
|
borderRadius: BorderRadius.circular(16.r),
|
|
// 统一阴影效果 - 关键改进点
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: isDarkMode
|
|
? Colors.black.withOpacity(0.3)
|
|
: Colors.black.withOpacity(0.08),
|
|
blurRadius: 12,
|
|
offset: const Offset(0, 4),
|
|
spreadRadius: 0,
|
|
),
|
|
],
|
|
// 统一边框样式 - 关键改进点
|
|
border: Border.all(
|
|
color: isDarkMode ? Colors.grey[700]! : Colors.grey[200]!,
|
|
width: 1.5,
|
|
),
|
|
),
|
|
child: Padding(
|
|
padding:
|
|
EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h),
|
|
child: TextFormField(
|
|
controller: controller.feedbackController,
|
|
maxLines: 8,
|
|
maxLength: 500,
|
|
style: TextStyle(
|
|
color: isDarkMode ? Colors.white : Colors.black87,
|
|
fontSize: 14.sp,
|
|
height: 1.4,
|
|
),
|
|
decoration: InputDecoration(
|
|
hintText: 'feedbackHint'.tr, // 请输入您的反馈内容...
|
|
hintStyle: TextStyle(
|
|
color: isDarkMode ? Colors.grey[400] : Colors.grey[500],
|
|
fontSize: 14.sp,
|
|
),
|
|
border: InputBorder.none,
|
|
focusedBorder: InputBorder.none,
|
|
counterStyle: TextStyle(
|
|
color: isDarkMode ? Colors.grey[400] : Colors.grey[600],
|
|
fontSize: 12.sp,
|
|
),
|
|
contentPadding: EdgeInsets.zero,
|
|
fillColor: Colors.transparent,
|
|
filled: true,
|
|
),
|
|
validator: (value) {
|
|
if (value == null || value.trim().isEmpty) {
|
|
return 'feedbackRequired'.tr; // 请输入反馈内容
|
|
}
|
|
return null;
|
|
},
|
|
),
|
|
),
|
|
),
|
|
SizedBox(height: 40.h),
|
|
|
|
// 提交按钮 - 统一容器样式
|
|
Obx(() => Container(
|
|
// 统一按钮容器装饰
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(16.r),
|
|
// 统一阴影效果
|
|
boxShadow: controller.isSubmitting.value
|
|
? []
|
|
: [
|
|
BoxShadow(
|
|
color: Colors.blue.withOpacity(0.3),
|
|
blurRadius: 8,
|
|
offset: const Offset(0, 4),
|
|
spreadRadius: 0,
|
|
),
|
|
],
|
|
),
|
|
child: ElevatedButton(
|
|
onPressed: controller.isSubmitting.value
|
|
? null
|
|
: controller.submitFeedback,
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: controller.isSubmitting.value
|
|
? Colors.grey[400]
|
|
: Colors.blue[600],
|
|
padding: EdgeInsets.symmetric(vertical: 14.h),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(16.r),
|
|
),
|
|
elevation: 0,
|
|
shadowColor: Colors.transparent,
|
|
),
|
|
child: controller.isSubmitting.value
|
|
? SizedBox(
|
|
height: 20.h,
|
|
width: 20.h,
|
|
child: CircularProgressIndicator(
|
|
strokeWidth: 2.w,
|
|
valueColor: const AlwaysStoppedAnimation<Color>(
|
|
Colors.white),
|
|
),
|
|
)
|
|
: Text(
|
|
'submit'.tr, // 提交
|
|
style: TextStyle(
|
|
fontSize: 16.sp,
|
|
fontWeight: FontWeight.w600,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
)),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|