From 4eb4fb918bb4951341197057ca78bcd49f31a1bb Mon Sep 17 00:00:00 2001 From: jasonchenwork Date: Tue, 3 Jun 2025 17:50:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Eicon=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=B4=BB=E5=8B=95=E8=A9=B3=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/icons/community.png | Bin 0 -> 655 bytes assets/icons/emergency.png | Bin 0 -> 370 bytes assets/icons/package.png | Bin 0 -> 501 bytes assets/icons/payment.png | Bin 0 -> 845 bytes assets/icons/repair.png | Bin 0 -> 324 bytes assets/icons/visitor.png | Bin 0 -> 876 bytes lib/activity.dart | 10 ++- lib/activity_detail.dart | 160 +++++++++++++++++++++++++++++++++++++ lib/feedback.dart | 11 ++- lib/home_content_page.dart | 32 +------- lib/personal_page.dart | 55 +++++-------- pubspec.yaml | 1 + 12 files changed, 198 insertions(+), 71 deletions(-) create mode 100644 assets/icons/community.png create mode 100644 assets/icons/emergency.png create mode 100644 assets/icons/package.png create mode 100644 assets/icons/payment.png create mode 100644 assets/icons/repair.png create mode 100644 assets/icons/visitor.png create mode 100644 lib/activity_detail.dart diff --git a/assets/icons/community.png b/assets/icons/community.png new file mode 100644 index 0000000000000000000000000000000000000000..436ed63500a76c1de4e34fd2a89e817136a25483 GIT binary patch literal 655 zcmV;A0&x9_P)LauK8Z6-6$JolWLd#C%w!%GGXSp0tK?VV5UK^xA}GaDfi~99lN-pF zLIKP45KXJ%9qq0o$;^6zBN_d4PQ27lEkh955|#$fy51DeRG@>rCOT1GZs-AprH9{~hio z???qyHZ*Hq&HH1Xw?ggdQfPgI-qG91hECT{j$q-5v_~a9Q zCcl$k{UWf=`X;h-G4Ms}FM-)VhF4WShtL*hmv(ZDJeWqnO;|dT*liBf2+ob1?-(0G z&e-1ua74Z(UuBU4{}tyu+7>dmIiOR(){z7I02%@Gk{8GmiUJ#a0sA5+Sf?Uz!q1;) z^D?J<9dOQioOl87&A)3E1^QS&>?Q}UIc%252jne9flh8h-YL++Iu(H!KfjpGhNj?h z;0!2^ulD*6=|RBH@dKLuVICyJZ4>|i002ovPDHLkV1nrV8X^Dy literal 0 HcmV?d00001 diff --git a/assets/icons/emergency.png b/assets/icons/emergency.png new file mode 100644 index 0000000000000000000000000000000000000000..33e7ea7a2887e72b9cb886995f649d93c37a390c GIT binary patch literal 370 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC&H|6fVg?3oVGw3ym^DX&fq_xQ z)5S5QV$R!}>%CY4MUH>$7n|%Tz@sK^9?5brPw+cyj@0(7&#Xt>Kd`zqdm8+b2{V*% z?P+?^VUQS^Huqxn_wy%y9?JY~^!)fwKZ}@S$CbVnwuZ-KF`l+KqI)lZ=gMNqR9^QT zhkplLHkM4_yKQm!FF$WT*MN&!4#D0RCh6<{tKgzAUE>}FceKdU;gYUdZ?l&jTu=N!-Pj6xH zmD?5W+u&#UEZZhMMsvAa?1Gv62@RDwe46EkefqVGP3oa*89JAz00WW1)78&qol`;+ E09c=oy8r+H literal 0 HcmV?d00001 diff --git a/assets/icons/package.png b/assets/icons/package.png new file mode 100644 index 0000000000000000000000000000000000000000..f9266273af16985f2419c9bc7e6537c915e519d2 GIT binary patch literal 501 zcmVr@st_M)QiprFrS zV_rc)+f)`J{yacLR0JUq!IV)uO=U=A;TBuWEW6ogcJLm!&CJ;|`(NX94zreOCboByfJ4b# zltS8^0C)w4fdSwaxR+%#1iZKauqt`GzP24{TS+>=i7)HZ*WQq0u&2|c0(=1Dl67Y2 zKbO8y;4O&&TavRG;Mow*cG3WDfIeUZs0aAofiW5HA}Ijg`ks-D;}HHM@lF9>-2~_d zavfAwu3rXPAqH=W*HgB`F}-^YR4QWN1W=9e30CErT!b=yk+-Q3bCdl>6%+uS0eZTG zYQUwT>H$aU2dSpTQ@3Q+egmLr@s z*IfXZ3&@>!0bn*D*XvV&PG_JD92lw+V+Jag%yKV}5>Wu!fB7O)0CWbzOP7#Ex{1Ro r6XQ>4?R$BD8)0q1P5s0U*rl00000NkvXXu0mjf5+%;2 literal 0 HcmV?d00001 diff --git a/assets/icons/payment.png b/assets/icons/payment.png new file mode 100644 index 0000000000000000000000000000000000000000..576535b5b8b2126d425689bdf476cb53f004d359 GIT binary patch literal 845 zcmV-T1G4;yP)s?%BP zTdn`M*0=VzKFA}FJpLPu1u7yUqujyw1HJ(9h{!jfzmq_r6zxERhcpEcWRp)U?a~)| z5qRQLUaba1W>hPUv@MR5EZEDDm)73N(hDz*V5H)|3NVC6o1^ z>28FTz$b^(y}%!b&VKKaZiJ(g#KT13uxytmu~{OUqhTV@3~T|4WP3A-?RD7{Y0bl+ z3Dg1w4!hpK>m)(Fl1%~y!1166wCGUUHKa<1vpI#*cp%$-T5CQY2SH$mbh}dQD)A&f zb_PLUqjaaTAaGJXHU&YTUb-^iZ3e-=0Vc^uLl6Y)YA{dwKEO2KV+w(r%~Y*1ECBun z)rIU{UI`45w534coot5!o8=>rF60)kUChQdmTLmtEwMZS2l5#pM0M0;_ zPb{ro1cn6=V74;coti_yt%yjCS8dG#R)j!GJYutQnMo3iPV+<5ld|0-zIw%1>_@7SAUOfo+O#^NX- zwutH70qzY`-!vY}Zh5@T@xT;QYlrt|W6XN?)~O2jUA(&D<4py{ox&@H{N`qStGf}h z6G)qh%xdwq$l%CV67S4&a0*ar(U-q0_wex{W{a~m0qxIonjN;}_J;V23HNSQ9F@4WjPLp589MN01oz?Nd{|e@=I@1KE SXh%@!FnGH9xvX7HlS{*c;((hB$nyaE0gZC8O|3C5WYtOFM5AAb!;ZS69^9$+qz9{}-U;3Uv1@8|cWCyOJC>SuLP0jrSDE;rLAcfWXA3yL>LBu;zyV z<&xw4G<(U|T?@b`uyHWdRDfk*NrkB_ax< zEI?%9YzJn!ms5#!)U#ru+#-2p z*pg)NkT27s>o)VGt-`41=&Z6)vPl~PR-_WtdyV?bJHuJGJ6LZ?KxrxhVp4-?1%8X; zWmliL1@g_LfeqrUb9)CmbG$RaR8ZNmPYQ>2|Slzt&!9rG}L-ritKdtdE`^TSq2z0fvr;O>2vK8ljT0ZkAUS^ zLW>a4bs#5~df}6N0~S#wB=i;1y%dAERdT9Rz { children: [ TextButton( onPressed: () { - // TODO : 查看詳情 + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => + const ActivityDetailPage(activityId: 2), + ), + ); }, style: ElevatedButton.styleFrom( backgroundColor: Colors.transparent, diff --git a/lib/activity_detail.dart b/lib/activity_detail.dart new file mode 100644 index 0000000..9168961 --- /dev/null +++ b/lib/activity_detail.dart @@ -0,0 +1,160 @@ +import 'package:flutter/material.dart'; +import 'package:http/http.dart' as http; +import 'dart:convert'; + +class ActivityDetailPage extends StatefulWidget { + final int activityId; + + const ActivityDetailPage({super.key, required this.activityId}); + + @override + State createState() => _ActivityDetailPageState(); +} + +class _ActivityDetailPageState extends State { + Map? activity; + bool isLoading = true; + + // 切換為 false 就會改為從 API 載入資料 + final bool useMockData = true; + + @override + void initState() { + super.initState(); + fetchActivityDetail(); + } + + Future fetchActivityDetail() async { + if (useMockData) { + //await Future.delayed(const Duration(seconds: 1)); // 模擬延遲 + setState(() { + activity = { + "title": "🎉 社區春季市集", + "time": "2025/04/27(日)10:00 - 16:00", + "location": "中庭花園", + "desc": "市集將有手作小物、美食攤販及親子遊戲活動,歡迎全體住戶參與!", + "image": "https://picsum.photos/id/1011/600/300", + "canRegister": true, + }; + isLoading = false; + }); + } else { + try { + final response = await http.get( + // API 位置 + Uri.parse('https://your-api.com/activities/${widget.activityId}'), + ); + if (response.statusCode == 200) { + setState(() { + activity = json.decode(response.body); + isLoading = false; + }); + } else { + throw Exception('Failed to load activity'); + } + } catch (e) { + setState(() { + isLoading = false; + activity = null; + }); + } + } + } + + void _showRegisterDialog() { + int peopleCount = 1; + showDialog( + context: context, + builder: (context) { + return AlertDialog( + title: const Text('確認報名'), + content: DropdownButtonFormField( + value: peopleCount, + items: + [1, 2, 3, 4] + .map((e) => DropdownMenuItem(value: e, child: Text('$e 人'))) + .toList(), + onChanged: (value) { + if (value != null) peopleCount = value; + }, + decoration: const InputDecoration(labelText: '選擇報名人數'), + ), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context), + child: const Text('取消'), + ), + ElevatedButton( + onPressed: () { + Navigator.pop(context); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + '已報名活動 ID ${widget.activityId},人數:$peopleCount', + ), + ), + ); + }, + child: const Text('確認報名'), + ), + ], + ); + }, + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: const Text('活動詳情')), + body: + isLoading + ? const Center(child: CircularProgressIndicator()) + : activity == null + ? const Center(child: Text('找不到該活動。')) + : SingleChildScrollView( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ClipRRect( + borderRadius: BorderRadius.circular(12), + child: Image.network( + activity!['image'], + fit: BoxFit.cover, + ), + ), + const SizedBox(height: 16), + Text( + activity!['title'], + style: const TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(height: 8), + Text( + '時間:${activity!['time']}', + style: const TextStyle(color: Colors.grey), + ), + const SizedBox(height: 4), + Text( + '地點:${activity!['location']}', + style: const TextStyle(color: Colors.grey), + ), + const SizedBox(height: 12), + Text(activity!['desc']), + const SizedBox(height: 24), + if (activity!['canRegister'] == true) + Center( + child: ElevatedButton( + onPressed: _showRegisterDialog, + child: const Text('我要報名'), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/feedback.dart b/lib/feedback.dart index bf1d2f0..bebad14 100644 --- a/lib/feedback.dart +++ b/lib/feedback.dart @@ -50,7 +50,10 @@ class _FeedbackPageState extends State { .map( (value) => DropdownMenuItem( value: value, - child: Text(value), + child: Text( + value, + style: TextStyle(fontSize: 14), + ), ), ) .toList(), @@ -68,7 +71,10 @@ class _FeedbackPageState extends State { .map( (value) => DropdownMenuItem( value: value, - child: Text(value), + child: Text( + value, + style: TextStyle(fontSize: 14), + ), ), ) .toList(), @@ -84,6 +90,7 @@ class _FeedbackPageState extends State { border: OutlineInputBorder(), floatingLabelBehavior: FloatingLabelBehavior.always, ), + style: TextStyle(fontSize: 13), ), const SizedBox(height: 24), Row( diff --git a/lib/home_content_page.dart b/lib/home_content_page.dart index b20e18f..7479d6b 100644 --- a/lib/home_content_page.dart +++ b/lib/home_content_page.dart @@ -94,36 +94,6 @@ class HomeContentPage extends StatelessWidget { ), const SizedBox(width: 8), NotificationIcon(), - /*Stack( - children: [ - IconButton( - icon: const Icon(Icons.notifications), - onPressed: () { - // TODO: 跳轉到通知頁 - }, - ), - Positioned( - right: 8, - top: 8, - child: Container( - padding: const EdgeInsets.all(2), - decoration: BoxDecoration( - color: Colors.red, - borderRadius: BorderRadius.circular(10), - ), - constraints: const BoxConstraints( - minWidth: 16, - minHeight: 16, - ), - child: const Text( - '3', - style: TextStyle(color: Colors.white, fontSize: 10), - textAlign: TextAlign.center, - ), - ), - ), - ], - ),*/ ], ), ], @@ -219,7 +189,7 @@ class HomeContentPage extends StatelessWidget { childAspectRatio: 1, children: [ _buildQuickButton(context, '報修', 'assets/icons/repair.png'), - _buildQuickButton(context, '包裹', 'assets/icons/mail.png'), + _buildQuickButton(context, '包裹', 'assets/icons/package.png'), _buildQuickButton(context, '訪客', 'assets/icons/visitor.png'), _buildQuickButton(context, '繳費', 'assets/icons/payment.png'), _buildQuickButton(context, '社區互動', 'assets/icons/community.png'), diff --git a/lib/personal_page.dart b/lib/personal_page.dart index 60c71ea..665b6f7 100644 --- a/lib/personal_page.dart +++ b/lib/personal_page.dart @@ -21,30 +21,6 @@ class PersonalPage extends StatelessWidget { 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), @@ -139,19 +115,24 @@ class PersonalPage extends StatelessWidget { ), 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), - ), - ], + // 左邊社區資訊,右邊預留空間避免被按鈕擋住 + Padding( + padding: const EdgeInsets.only(right: 120), // 預留右上角空間 + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: const [ + Text('社區地址:新北市板橋區幸福路 88 號', style: TextStyle(fontSize: 12)), + SizedBox(height: 6), + Text('管理室電話:02-2233-4455', style: TextStyle(fontSize: 12)), + SizedBox(height: 6), + Text( + '管委會 Email:service@garden-community.tw', + style: TextStyle(fontSize: 12), + ), + ], + ), ), + // 右上角意見箱按鈕 Positioned( top: 0, right: 0, @@ -194,7 +175,7 @@ class PersonalPage extends StatelessWidget { mainAxisSpacing: 12, physics: const NeverScrollableScrollPhysics(), children: [ - _buildMenuItem('繳費通知', 'receipt.png', () { + _buildMenuItem('繳費通知', 'payment.png', () { showModalBottomSheet( context: context, isScrollControlled: true, diff --git a/pubspec.yaml b/pubspec.yaml index 1e9de26..e4a6f74 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -54,6 +54,7 @@ dev_dependencies: flutter: assets: - assets/images/ + - assets/icons/ # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class.