意見箱介面設計
This commit is contained in:
parent
a054a7acd5
commit
f98c3ed9f0
143
lib/feedback.dart
Normal file
143
lib/feedback.dart
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
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),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.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),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.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('取消'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'login_page.dart';
|
import 'login_page.dart';
|
||||||
import 'edit_profile.dart';
|
import 'edit_profile.dart';
|
||||||
|
import 'feedback.dart';
|
||||||
|
|
||||||
class PersonalPage extends StatelessWidget {
|
class PersonalPage extends StatelessWidget {
|
||||||
const PersonalPage({super.key});
|
const PersonalPage({super.key});
|
||||||
@ -153,6 +154,10 @@ class PersonalPage extends StatelessWidget {
|
|||||||
child: OutlinedButton(
|
child: OutlinedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// TODO: 意見箱按鈕
|
// TODO: 意見箱按鈕
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) => const FeedbackPage()),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
style: OutlinedButton.styleFrom(
|
style: OutlinedButton.styleFrom(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user