diff --git a/lib/feedback.dart b/lib/feedback.dart new file mode 100644 index 0000000..bf1d2f0 --- /dev/null +++ b/lib/feedback.dart @@ -0,0 +1,143 @@ +import 'package:flutter/material.dart'; + +class FeedbackPage extends StatefulWidget { + const FeedbackPage({super.key}); + + @override + State createState() => _FeedbackPageState(); +} + +class _FeedbackPageState extends State { + String anonymous = '否'; + String feedbackType = '建議'; + final TextEditingController feedbackController = TextEditingController(); + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: const Color(0xFFF7F8FA), + appBar: AppBar( + backgroundColor: const Color(0xFF9EAF9F), + title: const Text( + '意見回饋', + style: TextStyle(fontWeight: FontWeight.bold), + ), + centerTitle: true, + leading: IconButton( + icon: const Icon(Icons.arrow_back, color: Colors.white), + onPressed: () => Navigator.pop(context), + ), + ), + body: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Container( + padding: const EdgeInsets.all(20), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + ), + child: Column( + children: [ + DropdownButtonFormField( + decoration: const InputDecoration( + labelText: '是否匿名', + border: OutlineInputBorder(), + ), + value: anonymous, + items: + ['否', '是'] + .map( + (value) => DropdownMenuItem( + value: value, + child: Text(value), + ), + ) + .toList(), + onChanged: (value) => setState(() => anonymous = value!), + ), + const SizedBox(height: 16), + DropdownButtonFormField( + decoration: const InputDecoration( + labelText: '意見類型', + border: OutlineInputBorder(), + ), + value: feedbackType, + items: + ['建議', '問題', '其他'] + .map( + (value) => DropdownMenuItem( + value: value, + child: Text(value), + ), + ) + .toList(), + onChanged: (value) => setState(() => feedbackType = value!), + ), + const SizedBox(height: 16), + TextFormField( + controller: feedbackController, + maxLines: 5, + decoration: const InputDecoration( + labelText: '內容', + hintText: '請輸入您的意見或建議...', + border: OutlineInputBorder(), + floatingLabelBehavior: FloatingLabelBehavior.always, + ), + ), + const SizedBox(height: 24), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: const Color(0xFF4CAF50), + foregroundColor: Colors.white, + padding: const EdgeInsets.symmetric( + horizontal: 24, + vertical: 10, + ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(24), + ), + ), + onPressed: () { + if (feedbackController.text.trim().isEmpty) { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('請輸入內容')), + ); + return; + } + // TODO: Handle submit logic + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('感謝您的意見回饋!')), + ); + }, + child: const Text('送出'), + ), + const SizedBox(width: 16), + ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: const Color(0xFFCCCCCC), + foregroundColor: Colors.black, + padding: const EdgeInsets.symmetric( + horizontal: 24, + vertical: 10, + ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(24), + ), + ), + onPressed: () => Navigator.pop(context), + child: const Text('取消'), + ), + ], + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/personal_page.dart b/lib/personal_page.dart index 2bbaf22..f1faa4b 100644 --- a/lib/personal_page.dart +++ b/lib/personal_page.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'login_page.dart'; import 'edit_profile.dart'; +import 'feedback.dart'; class PersonalPage extends StatelessWidget { const PersonalPage({super.key}); @@ -153,6 +154,10 @@ class PersonalPage extends StatelessWidget { child: OutlinedButton( onPressed: () { // TODO: 意見箱按鈕 + Navigator.push( + context, + MaterialPageRoute(builder: (context) => const FeedbackPage()), + ); }, style: OutlinedButton.styleFrom( shape: RoundedRectangleBorder(