2025-04-29 16:13:50 +08:00
|
|
|
|
import 'package:flutter/material.dart';
|
2025-05-09 14:31:29 +08:00
|
|
|
|
import 'login_page.dart';
|
|
|
|
|
import 'edit_profile.dart';
|
2025-05-09 14:47:54 +08:00
|
|
|
|
import 'feedback.dart';
|
2025-05-09 16:49:13 +08:00
|
|
|
|
import 'reapair.dart';
|
2025-06-02 14:37:05 +08:00
|
|
|
|
import 'visitor.dart';
|
|
|
|
|
import 'package.dart';
|
|
|
|
|
import 'bill.dart';
|
2025-04-29 16:13:50 +08:00
|
|
|
|
|
|
|
|
|
class PersonalPage extends StatelessWidget {
|
|
|
|
|
const PersonalPage({super.key});
|
|
|
|
|
|
|
|
|
|
@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, fontSize: 20),
|
|
|
|
|
),
|
|
|
|
|
centerTitle: true,
|
|
|
|
|
leading: IconButton(
|
|
|
|
|
icon: Image.asset('assets/icons/back.png', width: 24, height: 24),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
actions: [
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: Image.asset(
|
|
|
|
|
'assets/icons/notification.png',
|
|
|
|
|
width: 24,
|
|
|
|
|
height: 24,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
// TODO: 通知按鈕事件
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: Image.asset('assets/icons/qr.png', width: 24, height: 24),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
// TODO: QR碼按鈕事件
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
body: ListView(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
children: [
|
|
|
|
|
_buildProfileSection(context),
|
|
|
|
|
const SizedBox(height: 10),
|
|
|
|
|
_buildCommunityInfoSection(context),
|
|
|
|
|
const SizedBox(height: 10),
|
|
|
|
|
_buildQuickMenu(context),
|
|
|
|
|
const SizedBox(height: 10),
|
|
|
|
|
_buildNotificationsSection(),
|
|
|
|
|
const SizedBox(height: 30),
|
2025-05-09 14:31:29 +08:00
|
|
|
|
_buildLogoutButton(context),
|
2025-04-29 16:13:50 +08:00
|
|
|
|
const SizedBox(height: 60),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _buildProfileSection(BuildContext context) {
|
|
|
|
|
return Container(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
GestureDetector(
|
|
|
|
|
onTap: () {
|
|
|
|
|
// TODO: 點擊頭像事件
|
|
|
|
|
},
|
|
|
|
|
child: const CircleAvatar(
|
|
|
|
|
radius: 30,
|
|
|
|
|
backgroundImage: AssetImage('assets/images/avatar.png'),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 16),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: const [
|
|
|
|
|
Text(
|
|
|
|
|
'林小安',
|
|
|
|
|
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 4),
|
|
|
|
|
Text(
|
|
|
|
|
'住戶編號:B205',
|
|
|
|
|
style: TextStyle(fontSize: 14, color: Colors.grey),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'社區:綠光花園',
|
|
|
|
|
style: TextStyle(fontSize: 14, color: Colors.grey),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
TextButton(
|
|
|
|
|
onPressed: () {
|
2025-05-09 14:31:29 +08:00
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => const EditProfilePage(),
|
|
|
|
|
),
|
|
|
|
|
);
|
2025-04-29 16:13:50 +08:00
|
|
|
|
},
|
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
side: const BorderSide(color: Colors.green),
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(20),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: const Text(
|
|
|
|
|
'✏️ 修改',
|
|
|
|
|
style: TextStyle(fontSize: 13, color: Colors.green),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _buildCommunityInfoSection(BuildContext context) {
|
|
|
|
|
return Container(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
|
),
|
|
|
|
|
child: Stack(
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: const [
|
|
|
|
|
Text('社區地址:新北市板橋區幸福路 88 號', style: TextStyle(fontSize: 14)),
|
|
|
|
|
SizedBox(height: 6),
|
|
|
|
|
Text('管理室電話:02-2233-4455', style: TextStyle(fontSize: 14)),
|
|
|
|
|
SizedBox(height: 6),
|
|
|
|
|
Text(
|
|
|
|
|
'管委會 Email:service@garden-community.tw',
|
|
|
|
|
style: TextStyle(fontSize: 14),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Positioned(
|
|
|
|
|
top: 0,
|
|
|
|
|
right: 0,
|
|
|
|
|
child: OutlinedButton(
|
|
|
|
|
onPressed: () {
|
2025-05-09 14:47:54 +08:00
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(builder: (context) => const FeedbackPage()),
|
|
|
|
|
);
|
2025-04-29 16:13:50 +08:00
|
|
|
|
},
|
|
|
|
|
style: OutlinedButton.styleFrom(
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(20),
|
|
|
|
|
),
|
|
|
|
|
side: const BorderSide(color: Colors.grey),
|
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 14,
|
|
|
|
|
vertical: 6,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: const Text('📝 意見箱', style: TextStyle(fontSize: 13)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _buildQuickMenu(BuildContext context) {
|
|
|
|
|
return Container(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
|
),
|
|
|
|
|
child: GridView.count(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
crossAxisCount: 4,
|
|
|
|
|
crossAxisSpacing: 12,
|
|
|
|
|
mainAxisSpacing: 12,
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
children: [
|
|
|
|
|
_buildMenuItem('繳費通知', 'receipt.png', () {
|
2025-06-02 14:37:05 +08:00
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
|
builder: (_) => BillPageWrapper(),
|
|
|
|
|
);
|
2025-04-29 16:13:50 +08:00
|
|
|
|
}),
|
|
|
|
|
_buildMenuItem('報修申請', 'repair.png', () {
|
2025-06-02 14:37:05 +08:00
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
|
builder: (_) => const RepairPageWrapper(),
|
2025-05-09 16:49:13 +08:00
|
|
|
|
);
|
2025-04-29 16:13:50 +08:00
|
|
|
|
}),
|
|
|
|
|
_buildMenuItem('包裹通知', 'package.png', () {
|
2025-06-02 14:37:05 +08:00
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
|
builder: (context) => PackagePageWrapper(),
|
|
|
|
|
);
|
2025-04-29 16:13:50 +08:00
|
|
|
|
}),
|
|
|
|
|
_buildMenuItem('訪客', 'visitor.png', () {
|
2025-06-02 14:37:05 +08:00
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
|
builder: (context) => const VisitorPageWrapper(),
|
|
|
|
|
);
|
2025-04-29 16:13:50 +08:00
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _buildMenuItem(
|
|
|
|
|
String label,
|
|
|
|
|
String iconAssetName,
|
|
|
|
|
VoidCallback onTap,
|
|
|
|
|
) {
|
|
|
|
|
return GestureDetector(
|
|
|
|
|
onTap: onTap,
|
|
|
|
|
child: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: const Color(0xFFF1F1F1),
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
GestureDetector(
|
|
|
|
|
onTap: onTap,
|
|
|
|
|
child: Image.asset(
|
|
|
|
|
'assets/icons/$iconAssetName',
|
|
|
|
|
width: 28,
|
|
|
|
|
height: 28,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 6),
|
|
|
|
|
Text(label, style: const TextStyle(fontSize: 12)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _buildNotificationsSection() {
|
|
|
|
|
return Container(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: const [
|
|
|
|
|
Text('📢 最新通知', style: TextStyle(fontSize: 16)),
|
|
|
|
|
SizedBox(height: 10),
|
|
|
|
|
Divider(),
|
|
|
|
|
Text('水塔清洗公告(4/18 上午停水)', style: TextStyle(fontSize: 14)),
|
|
|
|
|
Divider(),
|
|
|
|
|
Text('您有 1 件包裹尚未領取', style: TextStyle(fontSize: 14)),
|
|
|
|
|
Divider(),
|
|
|
|
|
Text('電梯定期保養預告(4/20)', style: TextStyle(fontSize: 14)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-09 14:31:29 +08:00
|
|
|
|
Widget _buildLogoutButton(BuildContext context) {
|
2025-04-29 16:13:50 +08:00
|
|
|
|
return Center(
|
|
|
|
|
child: ElevatedButton.icon(
|
|
|
|
|
onPressed: () {
|
2025-05-09 14:31:29 +08:00
|
|
|
|
Navigator.pushReplacement(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(builder: (context) => const LoginPage()),
|
|
|
|
|
);
|
2025-04-29 16:13:50 +08:00
|
|
|
|
},
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
backgroundColor: const Color(0xFFF08080),
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(24),
|
|
|
|
|
),
|
|
|
|
|
shadowColor: Colors.black,
|
|
|
|
|
elevation: 6,
|
|
|
|
|
),
|
2025-05-09 14:31:29 +08:00
|
|
|
|
/*icon: GestureDetector(
|
|
|
|
|
onTap: () {},
|
2025-04-29 16:13:50 +08:00
|
|
|
|
child: Image.asset('assets/icons/logout.png', width: 18, height: 18),
|
2025-05-09 14:31:29 +08:00
|
|
|
|
),*/
|
2025-06-02 14:37:05 +08:00
|
|
|
|
label: const Text(
|
|
|
|
|
'登出',
|
|
|
|
|
style: TextStyle(fontSize: 16, color: Colors.white),
|
|
|
|
|
),
|
2025-04-29 16:13:50 +08:00
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|