user_feedback_page.dart 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. import 'package:news_app/constant/size_res.dart';
  4. import 'package:news_app/widget/my_txt.dart';
  5. /// @author: bo.zeng
  6. /// @email: cnhbwds@gmail.com
  7. /// @date: 2025 2025/4/9 16:00
  8. /// @description:
  9. class UserFeedbackPage extends StatefulWidget {
  10. const UserFeedbackPage({super.key});
  11. @override
  12. State<UserFeedbackPage> createState() => _UserFeedbackPageState();
  13. }
  14. class _UserFeedbackPageState extends State<UserFeedbackPage> {
  15. final TextEditingController _controller = TextEditingController();
  16. @override
  17. void initState() {
  18. super.initState();
  19. _controller.addListener(() {
  20. setState(() {});
  21. });
  22. }
  23. @override
  24. void dispose() {
  25. _controller.dispose();
  26. super.dispose();
  27. }
  28. @override
  29. Widget build(BuildContext context) {
  30. return Scaffold(
  31. backgroundColor: Colors.white,
  32. appBar: AppBar(
  33. title: myTxt(
  34. text: '意见反馈',
  35. fontSize: 18.sp,
  36. fontWeight: FontWeight.bold,
  37. ),
  38. centerTitle: true,
  39. ),
  40. body: SafeArea(
  41. child: Padding(
  42. padding: EdgeInsets.all(horizontalPadding),
  43. child: Column(
  44. crossAxisAlignment: CrossAxisAlignment.start,
  45. children: [
  46. Container(
  47. padding: EdgeInsets.all(horizontalPadding),
  48. decoration: BoxDecoration(
  49. color: Colors.grey.shade100,
  50. borderRadius: BorderRadius.circular(10),
  51. ),
  52. child: Column(
  53. children: [
  54. TextField(
  55. controller: _controller,
  56. maxLines: 5,
  57. maxLength: 200,
  58. decoration: InputDecoration(
  59. hintText: '请输入您想反馈的问题',
  60. border: InputBorder.none,
  61. contentPadding: EdgeInsets.zero,
  62. hintStyle: TextStyle(color: Colors.grey),
  63. counterText: '',
  64. ),
  65. ),
  66. Align(
  67. alignment: Alignment.bottomRight,
  68. child: Text(
  69. '${_controller.text.length}/200',
  70. style: TextStyle(color: Colors.grey),
  71. ),
  72. ),
  73. ],
  74. ),
  75. ),
  76. Spacer(),
  77. SizedBox(
  78. width: double.infinity,
  79. height: 50.h,
  80. child: ElevatedButton(
  81. style: ElevatedButton.styleFrom(
  82. backgroundColor: Colors.blue,
  83. shape: RoundedRectangleBorder(
  84. borderRadius: BorderRadius.circular(25),
  85. ),
  86. ),
  87. onPressed: () {},
  88. child: Text(
  89. '提交',
  90. style: TextStyle(fontSize: 18, color: Colors.white),
  91. ),
  92. ),
  93. ),
  94. SizedBox(height: 20),
  95. ],
  96. ),
  97. ),
  98. ),
  99. );
  100. }
  101. }