151 lines
5.6 KiB
Dart
151 lines
5.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class FeedbackPage extends StatefulWidget {
|
|
const FeedbackPage({super.key});
|
|
|
|
@override
|
|
State<FeedbackPage> createState() => _FeedbackPageState();
|
|
}
|
|
|
|
class _FeedbackPageState extends State<FeedbackPage> {
|
|
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<String>(
|
|
decoration: const InputDecoration(
|
|
labelText: '是否匿名',
|
|
border: OutlineInputBorder(),
|
|
),
|
|
value: anonymous,
|
|
items:
|
|
['否', '是']
|
|
.map(
|
|
(value) => DropdownMenuItem(
|
|
value: value,
|
|
child: Text(
|
|
value,
|
|
style: TextStyle(fontSize: 14),
|
|
),
|
|
),
|
|
)
|
|
.toList(),
|
|
onChanged: (value) => setState(() => anonymous = value!),
|
|
),
|
|
const SizedBox(height: 16),
|
|
DropdownButtonFormField<String>(
|
|
decoration: const InputDecoration(
|
|
labelText: '意見類型',
|
|
border: OutlineInputBorder(),
|
|
),
|
|
value: feedbackType,
|
|
items:
|
|
['建議', '問題', '其他']
|
|
.map(
|
|
(value) => DropdownMenuItem(
|
|
value: value,
|
|
child: Text(
|
|
value,
|
|
style: TextStyle(fontSize: 14),
|
|
),
|
|
),
|
|
)
|
|
.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,
|
|
),
|
|
style: TextStyle(fontSize: 13),
|
|
),
|
|
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('取消'),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|