From 5bec8024a6f0fe7eb5f69ad46139c8a7632f45b6 Mon Sep 17 00:00:00 2001 From: Nyeong Date: Mon, 27 Nov 2023 16:47:41 +0900 Subject: [PATCH 1/4] =?UTF-8?q?#14=20Feat:=20=ED=8E=B8=EC=A7=80=ED=95=A8?= =?UTF-8?q?=20=ED=99=94=EB=A9=B4=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- unibond/lib/main.dart | 26 +++--- .../screens/letter/letter_box_screen.dart | 72 +++++++++------- .../screens/letter/letter_list_screen.dart | 83 +++++++++++++++++++ .../screens/letter/letter_read_screen.dart | 16 +++- .../screens/letter/letter_write_screen.dart | 21 ++++- unibond/pubspec.lock | 50 +++++------ unibond/pubspec.yaml | 1 + 7 files changed, 196 insertions(+), 73 deletions(-) create mode 100644 unibond/lib/view/screens/letter/letter_list_screen.dart diff --git a/unibond/lib/main.dart b/unibond/lib/main.dart index 6a561be..e4fe24d 100644 --- a/unibond/lib/main.dart +++ b/unibond/lib/main.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import 'package:unibond/view/screens/community/post_detail_screen.dart'; -import 'package:unibond/view/screens/user/login_screen.dart'; +import 'package:unibond/view/screens/letter/letter_box_screen.dart'; void main() { runApp(const MaterialApp( @@ -15,14 +14,19 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return GetMaterialApp( - title: 'Flutter Demo', - theme: ThemeData( - colorScheme: ColorScheme.fromSeed(seedColor: Colors.blueAccent), - useMaterial3: true, - ), - home: DetailScreen( - id: 0, - ), // 임시 스플래시화면 - ); + title: 'Flutter Demo', + theme: ThemeData( + colorScheme: ColorScheme.fromSeed(seedColor: Colors.blueAccent), + useMaterial3: true, + ), + home: LetterBoxScreen(fakeEnvelopes: [ + LetterEnvelope(date: '2023-10-15', sender: '지지진'), + LetterEnvelope(date: '2023-10-14', sender: '진지지'), + //추가 편지봉투를 여기에 추가 + ]) + // home: DetailScreen( + // id: 0, + // ), // 임시 스플래시화면 + ); } } diff --git a/unibond/lib/view/screens/letter/letter_box_screen.dart b/unibond/lib/view/screens/letter/letter_box_screen.dart index 4946580..a8c6b55 100644 --- a/unibond/lib/view/screens/letter/letter_box_screen.dart +++ b/unibond/lib/view/screens/letter/letter_box_screen.dart @@ -1,20 +1,22 @@ import 'package:flutter/material.dart'; +import 'package:get/get.dart'; import 'package:unibond/view/screens/home_screen.dart'; +import 'package:unibond/view/screens/letter/letter_list_screen.dart'; import 'package:unibond/view/screens/user/profile_screen.dart'; import 'package:unibond/view/widgets/navigator.dart'; -@override -Widget build(BuildContext context) { - return MaterialApp( - home: LetterBoxScreen( - fakeEnvelopes: [ - LetterEnvelope(date: '2023-10-15', sender: '지지진'), - LetterEnvelope(date: '2023-10-14', sender: '진지지'), - //추가 편지봉투를 여기에 추가 - ], - ), - ); -} +// @override +// Widget build(BuildContext context) { +// return MaterialApp( +// home: LetterBoxScreen( +// fakeEnvelopes: [ +// LetterEnvelope(date: '2023-10-15', sender: '지지진'), +// LetterEnvelope(date: '2023-10-14', sender: '진지지'), +// //추가 편지봉투를 여기에 추가 +// ], +// ), +// ); +// } class LetterEnvelope { final String date; @@ -34,30 +36,38 @@ class LetterBoxScreen extends StatelessWidget { return Scaffold( appBar: AppBar( title: const Text('편지함'), + automaticallyImplyLeading: false, ), body: ListView.builder( itemCount: fakeEnvelopes.length, itemBuilder: (context, index) { final envelope = fakeEnvelopes[index]; - return Card( - elevation: 4, // 그림자 효과 추가 - margin: const EdgeInsets.all(8.0), // 여백 추가 - child: Container( - padding: const EdgeInsets.all(16.0), // 내용 여백 추가 - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text(envelope.date, - style: const TextStyle(fontWeight: FontWeight.bold)), - const Icon(Icons.mail_outline), // 편지 아이콘 - ], - ), - const SizedBox(height: 8), // 간격 추가 - Text('보낸 사람: ${envelope.sender}'), - ], + return GestureDetector( + onTap: () { + // TODO: 각 편지를 구분하는 id 넘기기 + Get.to(() => const LetterList()); + }, + child: Card( + elevation: 4, // 그림자 효과 추가 + margin: const EdgeInsets.all(8.0), // 여백 추가 + child: Container( + padding: const EdgeInsets.all(16.0), // 내용 여백 추가 + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(envelope.date, + style: + const TextStyle(fontWeight: FontWeight.bold)), + const Icon(Icons.mail_outline), // 편지 아이콘 + ], + ), + const SizedBox(height: 8), // 간격 추가 + Text('보낸 사람: ${envelope.sender}'), + ], + ), ), ), ); diff --git a/unibond/lib/view/screens/letter/letter_list_screen.dart b/unibond/lib/view/screens/letter/letter_list_screen.dart new file mode 100644 index 0000000..8300326 --- /dev/null +++ b/unibond/lib/view/screens/letter/letter_list_screen.dart @@ -0,0 +1,83 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:unibond/domain/letter/letter.dart'; +import 'package:unibond/view/screens/letter/letter_read_screen.dart'; + +class LetterList extends StatelessWidget { + const LetterList({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + centerTitle: true, + title: const Text('편지 내용'), + leading: IconButton( + icon: const Icon(Icons.arrow_back_ios), + onPressed: () { + Get.back(); + }, + ), + ), + body: Column( + children: [ + Expanded( + child: ListView.builder( + itemCount: 10, // 예제를 위한 임시 데이터 수 + itemBuilder: (context, index) { + return Padding( + padding: const EdgeInsets.all(16.0), + child: GestureDetector( + onTap: () { + Get.to(LetterReadScreen( + letter: Letter( + id: 1, + receiverId: 2, + title: "저는 오늘 행복한 하루를 보냈어요.", + content: "마음이 잘 통하는 친구를 만난 것 같거든요.", + isliked: true), + )); + }, + child: Card( + elevation: 4.0, // 카드 그림자 깊이 + child: Container( + padding: const EdgeInsets.all(16.0), + width: 300, + height: 200, + child: const Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "From. 오지지", + style: TextStyle( + fontSize: 14, fontWeight: FontWeight.bold), + ), + Center( + child: Text( + "저는 오늘 행복한 하루를 보냈어요", + style: TextStyle( + fontSize: 18, fontWeight: FontWeight.bold), + ), + ), + Align( + alignment: Alignment.bottomRight, + child: Text( + "2023-11-27", + style: TextStyle(fontSize: 12), + ), + ), + ], + ), + ), + ), + ), + ); + }, + ), + ), + ], + ), + ); + } +} diff --git a/unibond/lib/view/screens/letter/letter_read_screen.dart b/unibond/lib/view/screens/letter/letter_read_screen.dart index c86425c..c3bbbc8 100644 --- a/unibond/lib/view/screens/letter/letter_read_screen.dart +++ b/unibond/lib/view/screens/letter/letter_read_screen.dart @@ -1,5 +1,8 @@ import 'package:flutter/material.dart'; +import 'package:get/get.dart'; import 'package:unibond/domain/letter/letter.dart'; +import 'package:unibond/view/screens/letter/letter_write_screen.dart'; +import 'package:unibond/view/widgets/custon_elevated_button.dart'; class LetterReadScreen extends StatefulWidget { final Letter letter; @@ -15,11 +18,12 @@ class _LetterReadScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: const Text("받은 편지"), + centerTitle: true, + title: const Text('받은 편지'), leading: IconButton( - icon: const Icon(Icons.arrow_back), + icon: const Icon(Icons.arrow_back_ios), onPressed: () { - Navigator.pop(context); + Get.back(); }, ), actions: [ @@ -41,6 +45,7 @@ class _LetterReadScreenState extends State { child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Text( widget.letter.title, @@ -56,6 +61,11 @@ class _LetterReadScreenState extends State { fontSize: 18, ), ), + CustomElevatedButton( + text: "답장 쓰기", + screenRoute: () { + Get.to(() => const LetterWriteScreen()); + }) ], ), ), diff --git a/unibond/lib/view/screens/letter/letter_write_screen.dart b/unibond/lib/view/screens/letter/letter_write_screen.dart index 3136c89..1ca1db1 100644 --- a/unibond/lib/view/screens/letter/letter_write_screen.dart +++ b/unibond/lib/view/screens/letter/letter_write_screen.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:get/get.dart'; class LetterWriteScreen extends StatefulWidget { const LetterWriteScreen({super.key}); @@ -22,11 +23,12 @@ class _LetterWriteScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: const Text("편지 작성"), + centerTitle: true, + title: const Text('작성중인 편지'), leading: IconButton( - icon: const Icon(Icons.arrow_back), + icon: const Icon(Icons.arrow_back_ios), onPressed: () { - Navigator.pop(context); + Get.back(); }, ), actions: [ @@ -34,6 +36,8 @@ class _LetterWriteScreenState extends State { icon: const Icon(Icons.send), onPressed: () { // 편지 전송하는 코드 추가 + // showToast(); + Get.back(); // 이전 화면 이동 }, ) ], @@ -67,3 +71,14 @@ class _LetterWriteScreenState extends State { ); } } + +// void showToast() { +// Fluttertoast.showToast( +// msg: "전송이 완료되었습니다", +// toastLength: Toast.LENGTH_SHORT, +// gravity: ToastGravity.BOTTOM, +// timeInSecForIosWeb: 1, +// backgroundColor: Colors.grey, +// textColor: Colors.white, +// fontSize: 16.0); +// } diff --git a/unibond/pubspec.lock b/unibond/pubspec.lock index 0d45917..ae58bdd 100644 --- a/unibond/pubspec.lock +++ b/unibond/pubspec.lock @@ -37,10 +37,10 @@ packages: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.17.1" cupertino_icons: dependency: "direct main" description: @@ -91,6 +91,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.18.1" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" lints: dependency: transitive description: @@ -103,26 +111,26 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.15" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.2.0" meta: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.9.1" path: dependency: transitive description: @@ -140,26 +148,26 @@ packages: dependency: transitive description: name: source_span - sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.9.1" stack_trace: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.1" string_scanner: dependency: transitive description: @@ -180,10 +188,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.5.1" validators: dependency: "direct main" description: @@ -200,13 +208,5 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - web: - dependency: transitive - description: - name: web - sha256: "14f1f70c51119012600c5f1f60ca68efda5a9b6077748163c6af2893ec5df8fc" - url: "https://pub.dev" - source: hosted - version: "0.2.1-beta" sdks: - dart: ">=3.2.0-157.0.dev <4.0.0" + dart: ">=3.0.6 <4.0.0" diff --git a/unibond/pubspec.yaml b/unibond/pubspec.yaml index 4bf52ce..7512c1e 100644 --- a/unibond/pubspec.yaml +++ b/unibond/pubspec.yaml @@ -37,6 +37,7 @@ dependencies: get: ^4.6.5 validators: ^3.0.0 intl: ^0.18.1 + # fluttertoast: ^8.2.4 dev_dependencies: flutter_test: From 962b600263bb232257e536ee12443f49322540cb Mon Sep 17 00:00:00 2001 From: Nyeong Date: Mon, 27 Nov 2023 20:50:50 +0900 Subject: [PATCH 2/4] =?UTF-8?q?#14=20Chore:=20fluttertoast=EB=A5=BC=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C=20=EC=84=A4=EC=A0=95=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- unibond/android/app/build.gradle | 6 ++++-- unibond/pubspec.lock | 14 ++++++++++++++ unibond/pubspec.yaml | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/unibond/android/app/build.gradle b/unibond/android/app/build.gradle index f464b96..4f2cc62 100644 --- a/unibond/android/app/build.gradle +++ b/unibond/android/app/build.gradle @@ -8,7 +8,8 @@ if (localPropertiesFile.exists()) { def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") + // throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") + throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") } def flutterVersionCode = localProperties.getProperty('flutter.versionCode') @@ -48,7 +49,8 @@ android { applicationId "com.example.unibond" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. - minSdkVersion flutter.minSdkVersion + // minSdkVersion flutter.minSdkVersion // changed bc of fluttertoast; requires a higher Android SDK version. + minSdkVersion 21 targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName diff --git a/unibond/pubspec.lock b/unibond/pubspec.lock index ae58bdd..d41b02d 100644 --- a/unibond/pubspec.lock +++ b/unibond/pubspec.lock @@ -75,6 +75,19 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + fluttertoast: + dependency: "direct main" + description: + name: fluttertoast + sha256: dfdde255317af381bfc1c486ed968d5a43a2ded9c931e87cbecd88767d6a71c1 + url: "https://pub.dev" + source: hosted + version: "8.2.4" get: dependency: "direct main" description: @@ -210,3 +223,4 @@ packages: version: "2.1.4" sdks: dart: ">=3.0.6 <4.0.0" + flutter: ">=1.10.0" diff --git a/unibond/pubspec.yaml b/unibond/pubspec.yaml index 7512c1e..288087e 100644 --- a/unibond/pubspec.yaml +++ b/unibond/pubspec.yaml @@ -37,7 +37,7 @@ dependencies: get: ^4.6.5 validators: ^3.0.0 intl: ^0.18.1 - # fluttertoast: ^8.2.4 + fluttertoast: ^8.2.4 dev_dependencies: flutter_test: From 2e3543f27ca87d0699827ba60e1898e08fbc512d Mon Sep 17 00:00:00 2001 From: Nyeong Date: Mon, 27 Nov 2023 20:51:16 +0900 Subject: [PATCH 3/4] =?UTF-8?q?#14=20Feat:=20toat=20message=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screens/letter/letter_write_screen.dart | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/unibond/lib/view/screens/letter/letter_write_screen.dart b/unibond/lib/view/screens/letter/letter_write_screen.dart index 1ca1db1..c825d4b 100644 --- a/unibond/lib/view/screens/letter/letter_write_screen.dart +++ b/unibond/lib/view/screens/letter/letter_write_screen.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:fluttertoast/fluttertoast.dart'; import 'package:get/get.dart'; class LetterWriteScreen extends StatefulWidget { @@ -36,7 +37,7 @@ class _LetterWriteScreenState extends State { icon: const Icon(Icons.send), onPressed: () { // 편지 전송하는 코드 추가 - // showToast(); + showToastMessage(); Get.back(); // 이전 화면 이동 }, ) @@ -72,13 +73,14 @@ class _LetterWriteScreenState extends State { } } -// void showToast() { -// Fluttertoast.showToast( -// msg: "전송이 완료되었습니다", -// toastLength: Toast.LENGTH_SHORT, -// gravity: ToastGravity.BOTTOM, -// timeInSecForIosWeb: 1, -// backgroundColor: Colors.grey, -// textColor: Colors.white, -// fontSize: 16.0); -// } +void showToastMessage() { + Fluttertoast.showToast( + msg: "전송이 완료되었습니다", + toastLength: Toast.LENGTH_SHORT, + gravity: ToastGravity.BOTTOM, + timeInSecForIosWeb: 2, + backgroundColor: Colors.grey, + textColor: Colors.white, + fontSize: 16.0, + ); +} From 73c6004db571ffebddf49b042cf1a8fe6a71b5b9 Mon Sep 17 00:00:00 2001 From: codeJiwon Date: Mon, 1 Jan 2024 14:21:52 +0900 Subject: [PATCH 4/4] =?UTF-8?q?#14=20=ED=8E=B8=EC=A7=80=ED=95=A8=20?= =?UTF-8?q?=EB=B0=8F=20=ED=8E=B8=EC=A7=80=EB=A6=AC=EC=8A=A4=ED=8A=B8=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- unibond/lib/main.dart | 5 +- .../screens/letter/letter_box_screen.dart | 94 ++++++++++--- .../screens/letter/letter_list_screen.dart | 125 +++++++++++------- unibond/pubspec.lock | 70 ++++++---- 4 files changed, 194 insertions(+), 100 deletions(-) diff --git a/unibond/lib/main.dart b/unibond/lib/main.dart index e4fe24d..3f5b165 100644 --- a/unibond/lib/main.dart +++ b/unibond/lib/main.dart @@ -15,13 +15,10 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) { return GetMaterialApp( title: 'Flutter Demo', - theme: ThemeData( - colorScheme: ColorScheme.fromSeed(seedColor: Colors.blueAccent), - useMaterial3: true, - ), home: LetterBoxScreen(fakeEnvelopes: [ LetterEnvelope(date: '2023-10-15', sender: '지지진'), LetterEnvelope(date: '2023-10-14', sender: '진지지'), + LetterEnvelope(date: '2023-10-14', sender: '지진지'), //추가 편지봉투를 여기에 추가 ]) // home: DetailScreen( diff --git a/unibond/lib/view/screens/letter/letter_box_screen.dart b/unibond/lib/view/screens/letter/letter_box_screen.dart index a8c6b55..947fe47 100644 --- a/unibond/lib/view/screens/letter/letter_box_screen.dart +++ b/unibond/lib/view/screens/letter/letter_box_screen.dart @@ -5,19 +5,6 @@ import 'package:unibond/view/screens/letter/letter_list_screen.dart'; import 'package:unibond/view/screens/user/profile_screen.dart'; import 'package:unibond/view/widgets/navigator.dart'; -// @override -// Widget build(BuildContext context) { -// return MaterialApp( -// home: LetterBoxScreen( -// fakeEnvelopes: [ -// LetterEnvelope(date: '2023-10-15', sender: '지지진'), -// LetterEnvelope(date: '2023-10-14', sender: '진지지'), -// //추가 편지봉투를 여기에 추가 -// ], -// ), -// ); -// } - class LetterEnvelope { final String date; final String sender; @@ -25,33 +12,96 @@ class LetterEnvelope { LetterEnvelope({required this.date, required this.sender}); } -class LetterBoxScreen extends StatelessWidget { - final List fakeEnvelopes; - +class LetterBoxScreen extends StatefulWidget { const LetterBoxScreen({Key? key, required this.fakeEnvelopes}) : super(key: key); + final List fakeEnvelopes; + + @override + _LetterBoxScreenState createState() => _LetterBoxScreenState(); +} + +class _LetterBoxScreenState extends State { + int currentIndex = 0; + @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: const Text('편지함'), + title: Row( + children: [ + GestureDetector( + onTap: () { + setState(() { + currentIndex = 0; + }); + }, + child: Text( + '편지함', + style: TextStyle( + fontWeight: currentIndex == 0 + ? FontWeight.bold + : FontWeight.normal), + ), + ), + const SizedBox(width: 16), + GestureDetector( + onTap: () { + setState(() { + currentIndex = 1; + }); + }, + child: Text( + '좋아함', + style: TextStyle( + fontWeight: currentIndex == 1 + ? FontWeight.bold + : FontWeight.normal), + ), + ), + ], + ), automaticallyImplyLeading: false, ), body: ListView.builder( - itemCount: fakeEnvelopes.length, + itemCount: widget.fakeEnvelopes.length, itemBuilder: (context, index) { - final envelope = fakeEnvelopes[index]; + final envelope = widget.fakeEnvelopes[index]; + final List> colorSets = [ + [Color(0xFFD08EFF), Color(0xFFFFACC6)], + [Color(0xFFFF88AC), Color(0xFFFFE9CC)], + [Color(0xFF99B9FF), Color(0xFFCA80FF)], + ]; + + final colorSet = colorSets[index % colorSets.length]; + return GestureDetector( onTap: () { // TODO: 각 편지를 구분하는 id 넘기기 - Get.to(() => const LetterList()); + Get.to( + () => LetterList( + backgroundColor1: colorSet[0], + backgroundColor2: colorSet[1], + sender: envelope.sender, + date: envelope.date, + ), + ); }, child: Card( elevation: 4, // 그림자 효과 추가 - margin: const EdgeInsets.all(8.0), // 여백 추가 + margin: const EdgeInsets.all(20.0), // 여백 추가 child: Container( + height: 180, + width: 160, padding: const EdgeInsets.all(16.0), // 내용 여백 추가 + decoration: BoxDecoration( + gradient: LinearGradient( + colors: colorSet, + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -61,7 +111,6 @@ class LetterBoxScreen extends StatelessWidget { Text(envelope.date, style: const TextStyle(fontWeight: FontWeight.bold)), - const Icon(Icons.mail_outline), // 편지 아이콘 ], ), const SizedBox(height: 8), // 간격 추가 @@ -94,6 +143,7 @@ class LetterBoxScreen extends StatelessWidget { fakeEnvelopes: [ LetterEnvelope(date: '2023-10-15', sender: '지지진'), LetterEnvelope(date: '2023-10-14', sender: '진지지'), + LetterEnvelope(date: '2023-10-14', sender: '지진지'), ], )), ); diff --git a/unibond/lib/view/screens/letter/letter_list_screen.dart b/unibond/lib/view/screens/letter/letter_list_screen.dart index 8300326..96ef649 100644 --- a/unibond/lib/view/screens/letter/letter_list_screen.dart +++ b/unibond/lib/view/screens/letter/letter_list_screen.dart @@ -4,7 +4,18 @@ import 'package:unibond/domain/letter/letter.dart'; import 'package:unibond/view/screens/letter/letter_read_screen.dart'; class LetterList extends StatelessWidget { - const LetterList({super.key}); + final Color backgroundColor1; + final Color backgroundColor2; + final String sender; + final String date; + + const LetterList({ + required this.backgroundColor1, + required this.backgroundColor2, + required this.sender, + required this.date, + Key? key, + }) : super(key: key); @override Widget build(BuildContext context) { @@ -19,64 +30,76 @@ class LetterList extends StatelessWidget { }, ), ), - body: Column( - children: [ - Expanded( - child: ListView.builder( - itemCount: 10, // 예제를 위한 임시 데이터 수 - itemBuilder: (context, index) { - return Padding( - padding: const EdgeInsets.all(16.0), - child: GestureDetector( - onTap: () { - Get.to(LetterReadScreen( - letter: Letter( - id: 1, - receiverId: 2, - title: "저는 오늘 행복한 하루를 보냈어요.", - content: "마음이 잘 통하는 친구를 만난 것 같거든요.", - isliked: true), - )); - }, - child: Card( - elevation: 4.0, // 카드 그림자 깊이 - child: Container( - padding: const EdgeInsets.all(16.0), - width: 300, - height: 200, - child: const Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "From. 오지지", - style: TextStyle( - fontSize: 14, fontWeight: FontWeight.bold), + body: Center( + child: Stack( + alignment: Alignment.center, + children: List.generate( + 10, + (index) { + double topPosition = index * 50.0; + + Color backgroundColor = + index.isEven ? backgroundColor1 : backgroundColor2; + + return Positioned( + top: topPosition, + child: GestureDetector( + onTap: () { + Get.to(LetterReadScreen( + letter: Letter( + id: 1, + receiverId: 2, + title: "저는 오늘 행복한 하루를 보냈어요.", + content: "마음이 잘 통하는 친구를 만난 것 같거든요.", + isliked: true, + ), + )); + }, + child: Card( + elevation: 4.0, // 카드 그림자 깊이 + child: Container( + padding: const EdgeInsets.all(16.0), + width: 300, + height: 200, + decoration: BoxDecoration( + color: backgroundColor, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "2023-11-27", + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, ), - Center( - child: Text( - "저는 오늘 행복한 하루를 보냈어요", - style: TextStyle( - fontSize: 18, fontWeight: FontWeight.bold), + ), + Center( + child: Text( + "저는 오늘 행복한 하루를 보냈어요", + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, ), ), - Align( - alignment: Alignment.bottomRight, - child: Text( - "2023-11-27", - style: TextStyle(fontSize: 12), - ), + ), + Align( + alignment: Alignment.bottomRight, + child: Text( + "From. $sender", + style: TextStyle(fontSize: 12), ), - ], - ), + ), + ], ), ), ), - ); - }, - ), + ), + ); + }, ), - ], + ), ), ); } diff --git a/unibond/pubspec.lock b/unibond/pubspec.lock index d41b02d..6573afa 100644 --- a/unibond/pubspec.lock +++ b/unibond/pubspec.lock @@ -37,10 +37,10 @@ packages: dependency: transitive description: name: collection - sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.1" + version: "1.18.0" cupertino_icons: dependency: "direct main" description: @@ -104,14 +104,30 @@ packages: url: "https://pub.dev" source: hosted version: "0.18.1" - js: + leak_tracker: dependency: transitive description: - name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + name: leak_tracker + sha256: e45c31f458d01fd9ef4a214feb2e153b72d5b1907435f4332b1637a2f348c021 url: "https://pub.dev" source: hosted - version: "0.6.7" + version: "9.0.18" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "54808cfcfa87dbc0d74c61ac063d624adf1bd5c0407301f32b06c783c60dc4ca" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "7e71be3c161472f6c9158ac8875dd8de575060d60b5d159ebca3600ea32c9116" + url: "https://pub.dev" + source: hosted + version: "1.0.6" lints: dependency: transitive description: @@ -124,34 +140,34 @@ packages: dependency: transitive description: name: matcher - sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.15" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.11.0" path: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" sky_engine: dependency: transitive description: flutter @@ -161,26 +177,26 @@ packages: dependency: transitive description: name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" string_scanner: dependency: transitive description: @@ -201,10 +217,10 @@ packages: dependency: transitive description: name: test_api - sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "0.6.1" validators: dependency: "direct main" description: @@ -221,6 +237,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + url: "https://pub.dev" + source: hosted + version: "13.0.0" sdks: - dart: ">=3.0.6 <4.0.0" + dart: ">=3.2.0-0 <4.0.0" flutter: ">=1.10.0"