import 'package:flutter/material.dart'; /// 反馈问题:一个最简的提交表单。 class FeedbackPage extends StatefulWidget { const FeedbackPage({super.key}); @override State createState() => _FeedbackPageState(); } class _FeedbackPageState extends State { final TextEditingController _text = TextEditingController(); @override void dispose() { _text.dispose(); super.dispose(); } void _submit() { ScaffoldMessenger.of(context).showSnackBar( const SnackBar( content: Text('反馈已记录(示例,尚未接入后端)'), behavior: SnackBarBehavior.floating, ), ); _text.clear(); } @override Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); final ColorScheme colors = theme.colorScheme; return Scaffold( appBar: AppBar(title: const Text('反馈问题')), body: ListView( padding: const EdgeInsets.fromLTRB(16, 16, 16, 32), children: [ Text('描述一下遇到的问题或建议', style: theme.textTheme.titleSmall), const SizedBox(height: 12), TextField( controller: _text, minLines: 5, maxLines: 10, decoration: InputDecoration( hintText: '例如:在学习页点击「开始学习」没有反应', filled: true, fillColor: colors.surfaceContainerLow, border: OutlineInputBorder( borderRadius: BorderRadius.circular(16), borderSide: BorderSide(color: colors.outlineVariant), ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(16), borderSide: BorderSide(color: colors.outlineVariant), ), ), ), const SizedBox(height: 8), Text( '提交时会附带应用版本与设备信息,方便定位问题。', style: theme.textTheme.bodySmall?.copyWith( color: colors.onSurfaceVariant, ), ), const SizedBox(height: 20), FilledButton( onPressed: _submit, style: FilledButton.styleFrom( minimumSize: const Size.fromHeight(48), ), child: const Text('提交反馈'), ), ], ), ); } }