From 1603c8ba6101e328b224d3d5243156d20028e046 Mon Sep 17 00:00:00 2001 From: godeka Date: Mon, 6 May 2024 12:03:01 +0900 Subject: [PATCH 01/10] =?UTF-8?q?[feat]=20=EB=82=B4=20=EC=9C=84=EC=B9=98?= =?UTF-8?q?=EB=A1=9C=20=EC=A7=80=EC=A0=95=EB=90=9C=20=EC=B9=B4=ED=8E=98=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20Provider=EB=A1=9C=20=EC=A0=80=EC=9E=A5=20#?= =?UTF-8?q?173?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/lib/main.dart | 4 ++++ frontend/lib/screen/cafe_details.dart | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/frontend/lib/main.dart b/frontend/lib/main.dart index 85a996b598..b85dfbfb26 100644 --- a/frontend/lib/main.dart +++ b/frontend/lib/main.dart @@ -51,6 +51,7 @@ class _MyAppState extends State { String? userToken; int _selectedIndex = 0; late List cafeList; // 주변 카페 리스트 + List? myCafe; // 내 위치로 지정된 카페 (카페 ID, 위도, 경도) static late final List _screenOptions; @@ -117,6 +118,9 @@ class _MyAppState extends State { Provider( create: (_) => stompClient, ), + Provider( + create: (_) => myCafe, + ), ], child: MaterialApp( theme: ThemeData( diff --git a/frontend/lib/screen/cafe_details.dart b/frontend/lib/screen/cafe_details.dart index 574a63fed9..f9a4c031c9 100644 --- a/frontend/lib/screen/cafe_details.dart +++ b/frontend/lib/screen/cafe_details.dart @@ -40,6 +40,7 @@ class _CafeDetailsState extends State final places = GoogleMapsPlaces(apiKey: "${dotenv.env['googleApiKey']}"); String photoUrl = ''; List? userList; + List? myCafe; void _startTimer() { print("타이머 시작"); @@ -109,6 +110,7 @@ class _CafeDetailsState extends State stompClient = Provider.of(context); userList = Provider.of>>(context)[widget.cafeId]; + myCafe = Provider.of>(context); return Scaffold( appBar: TopAppBar( @@ -212,6 +214,12 @@ class _CafeDetailsState extends State "test", widget.cafeId, ); + + myCafe = [ + widget.cafeId, + widget.cafeDetailsArguments[6], // 위도 + widget.cafeDetailsArguments[7], // 경도 + ]; }, child: const Text("확인"), ), From afa570e21b3f97e0e11c8cbc777c34b9550c808d Mon Sep 17 00:00:00 2001 From: godeka Date: Mon, 6 May 2024 12:10:43 +0900 Subject: [PATCH 02/10] =?UTF-8?q?[feat]=20=EB=82=B4=20=EC=B9=B4=ED=8E=98?= =?UTF-8?q?=20=EC=A0=95=EB=B3=B4=20Map=20=ED=83=80=EC=9E=85=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20#173?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/lib/main.dart | 2 +- frontend/lib/screen/cafe_details.dart | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/lib/main.dart b/frontend/lib/main.dart index b85dfbfb26..a3410186e9 100644 --- a/frontend/lib/main.dart +++ b/frontend/lib/main.dart @@ -51,7 +51,7 @@ class _MyAppState extends State { String? userToken; int _selectedIndex = 0; late List cafeList; // 주변 카페 리스트 - List? myCafe; // 내 위치로 지정된 카페 (카페 ID, 위도, 경도) + Map? myCafe; // 내 위치로 지정된 카페 (카페 ID, 위도, 경도) static late final List _screenOptions; diff --git a/frontend/lib/screen/cafe_details.dart b/frontend/lib/screen/cafe_details.dart index f9a4c031c9..204cae6053 100644 --- a/frontend/lib/screen/cafe_details.dart +++ b/frontend/lib/screen/cafe_details.dart @@ -40,7 +40,7 @@ class _CafeDetailsState extends State final places = GoogleMapsPlaces(apiKey: "${dotenv.env['googleApiKey']}"); String photoUrl = ''; List? userList; - List? myCafe; + Map? myCafe; void _startTimer() { print("타이머 시작"); @@ -110,7 +110,7 @@ class _CafeDetailsState extends State stompClient = Provider.of(context); userList = Provider.of>>(context)[widget.cafeId]; - myCafe = Provider.of>(context); + myCafe = Provider.of>(context); return Scaffold( appBar: TopAppBar( @@ -215,11 +215,11 @@ class _CafeDetailsState extends State widget.cafeId, ); - myCafe = [ - widget.cafeId, - widget.cafeDetailsArguments[6], // 위도 - widget.cafeDetailsArguments[7], // 경도 - ]; + myCafe = { + "cafeId": widget.cafeId, + "latitude": widget.cafeDetailsArguments[6], // 위도 + "longitude": widget.cafeDetailsArguments[7], // 경도 + }; }, child: const Text("확인"), ), From c53defeee73ef766aa507858dccd8d9975c6ca13 Mon Sep 17 00:00:00 2001 From: godeka Date: Mon, 6 May 2024 12:49:22 +0900 Subject: [PATCH 03/10] =?UTF-8?q?[feat]=20=EB=82=B4=20=EC=9C=84=EC=B9=98?= =?UTF-8?q?=EB=A1=9C=20=EC=A7=80=EC=A0=95=EB=90=9C=20=EC=B9=B4=ED=8E=98?= =?UTF-8?q?=EB=A9=B4=20=EB=B2=84=ED=8A=BC=20=EB=8C=80=EC=8B=A0=20=EB=B9=88?= =?UTF-8?q?=20Container=20#173?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/lib/screen/cafe_details.dart | 94 ++++++++++++++------------- 1 file changed, 50 insertions(+), 44 deletions(-) diff --git a/frontend/lib/screen/cafe_details.dart b/frontend/lib/screen/cafe_details.dart index 204cae6053..7548550b0a 100644 --- a/frontend/lib/screen/cafe_details.dart +++ b/frontend/lib/screen/cafe_details.dart @@ -110,7 +110,7 @@ class _CafeDetailsState extends State stompClient = Provider.of(context); userList = Provider.of>>(context)[widget.cafeId]; - myCafe = Provider.of>(context); + myCafe = Provider.of?>(context); return Scaffold( appBar: TopAppBar( @@ -191,50 +191,56 @@ class _CafeDetailsState extends State ), ), ), - BottomTextButton( - text: "이 카페를 내 위치로 지정하기", - handlePressed: () { - _startTimer(); - - showDialog( - context: context, - builder: (context) { - return AlertDialog( - title: const Text("카페 지정"), - content: Text("${widget.cafeName}을(를) 내 위치로 지정하겠습니까?"), - actions: [ - TextButton( - onPressed: () { - _stopTimer(); - Navigator.pop(context); - - // 카페에 유저 추가 pub 요청 - addUserInCafe( - stompClient, - "test", - widget.cafeId, - ); - - myCafe = { - "cafeId": widget.cafeId, - "latitude": widget.cafeDetailsArguments[6], // 위도 - "longitude": widget.cafeDetailsArguments[7], // 경도 - }; - }, - child: const Text("확인"), - ), - TextButton( - onPressed: () { - _stopTimer(); - Navigator.pop(context); - }, - child: const Text("취소"), - ), - ], + (myCafe != null && myCafe!["cafeId"] == widget.cafeId) + ? Container() + : BottomTextButton( + text: "이 카페를 내 위치로 지정하기", + handlePressed: () { + _startTimer(); + + showDialog( + context: context, + builder: (context) { + return AlertDialog( + title: const Text("카페 지정"), + content: + Text("${widget.cafeName}을(를) 내 위치로 지정하겠습니까?"), + actions: [ + TextButton( + onPressed: () { + _stopTimer(); + Navigator.pop(context); + + // 카페에 유저 추가 pub 요청 + addUserInCafe( + stompClient, + "test", + widget.cafeId, + ); + + myCafe = { + "cafeId": widget.cafeId, + "latitude": + widget.cafeDetailsArguments[6], // 위도 + "longitude": + widget.cafeDetailsArguments[7], // 경도 + }; + }, + child: const Text("확인"), + ), + TextButton( + onPressed: () { + _stopTimer(); + Navigator.pop(context); + }, + child: const Text("취소"), + ), + ], + ); + }, ); - }); - }, - ), + }, + ), ], ), ); From c9baf3446dcfd327cfe356069ecf2af58de67c98 Mon Sep 17 00:00:00 2001 From: godeka Date: Mon, 6 May 2024 14:06:23 +0900 Subject: [PATCH 04/10] =?UTF-8?q?[feat]=20=EB=82=B4=20=EC=9C=84=EC=B9=98?= =?UTF-8?q?=EB=A1=9C=20=EC=A7=80=EC=A0=95=EB=90=9C=20=EC=B9=B4=ED=8E=98=20?= =?UTF-8?q?ChangeNotifierProvider=EB=A1=9C=20=EC=B2=98=EB=A6=AC=20#173?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/lib/main.dart | 10 +++++++--- frontend/lib/model/my_cafe_model.dart | 24 ++++++++++++++++++++++++ frontend/lib/screen/cafe_details.dart | 19 +++++++++---------- 3 files changed, 40 insertions(+), 13 deletions(-) create mode 100644 frontend/lib/model/my_cafe_model.dart diff --git a/frontend/lib/main.dart b/frontend/lib/main.dart index a3410186e9..71e0f0e205 100644 --- a/frontend/lib/main.dart +++ b/frontend/lib/main.dart @@ -10,6 +10,7 @@ import 'package:frontend/screen/chatroom_list_screen.dart'; import 'package:frontend/screen/chat_screen.dart'; import 'package:frontend/screen/search_company_screen.dart'; import 'package:frontend/model/user_model.dart'; +import 'package:frontend/model/my_cafe_model.dart'; import 'package:frontend/screen/coffeechat_req_list.dart'; import 'package:frontend/screen/map_place.dart'; import 'package:frontend/screen/signup_screen.dart'; @@ -51,7 +52,6 @@ class _MyAppState extends State { String? userToken; int _selectedIndex = 0; late List cafeList; // 주변 카페 리스트 - Map? myCafe; // 내 위치로 지정된 카페 (카페 ID, 위도, 경도) static late final List _screenOptions; @@ -118,8 +118,12 @@ class _MyAppState extends State { Provider( create: (_) => stompClient, ), - Provider( - create: (_) => myCafe, + ChangeNotifierProvider( + create: (_) => MyCafeModel( + cafeId: "", + latitude: "", + longitude: "", + ), ), ], child: MaterialApp( diff --git a/frontend/lib/model/my_cafe_model.dart b/frontend/lib/model/my_cafe_model.dart new file mode 100644 index 0000000000..e5e8859c07 --- /dev/null +++ b/frontend/lib/model/my_cafe_model.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; + +class MyCafeModel extends ChangeNotifier { + String cafeId; + String latitude; + String longitude; + + MyCafeModel({ + required this.cafeId, + required this.latitude, + required this.longitude, + }); + + void setMyCafe({ + required String cafeId, + required String latitude, + required String longitude, + }) { + this.cafeId = cafeId; + this.latitude = latitude; + this.longitude = longitude; + notifyListeners(); + } +} diff --git a/frontend/lib/screen/cafe_details.dart b/frontend/lib/screen/cafe_details.dart index 7548550b0a..0efe7ead69 100644 --- a/frontend/lib/screen/cafe_details.dart +++ b/frontend/lib/screen/cafe_details.dart @@ -9,6 +9,7 @@ import 'package:frontend/widgets/top_appbar.dart'; import 'package:frontend/widgets/user_item.dart'; import 'package:frontend/widgets/button/bottom_text_button.dart'; import 'package:frontend/model/user_model.dart'; +import 'package:frontend/model/my_cafe_model.dart'; import 'package:geolocator/geolocator.dart'; import 'package:google_maps_webservice/places.dart'; import 'package:latlong2/latlong.dart' as latlong2; @@ -40,7 +41,7 @@ class _CafeDetailsState extends State final places = GoogleMapsPlaces(apiKey: "${dotenv.env['googleApiKey']}"); String photoUrl = ''; List? userList; - Map? myCafe; + late MyCafeModel myCafe; void _startTimer() { print("타이머 시작"); @@ -110,7 +111,7 @@ class _CafeDetailsState extends State stompClient = Provider.of(context); userList = Provider.of>>(context)[widget.cafeId]; - myCafe = Provider.of?>(context); + myCafe = Provider.of(context); return Scaffold( appBar: TopAppBar( @@ -191,7 +192,7 @@ class _CafeDetailsState extends State ), ), ), - (myCafe != null && myCafe!["cafeId"] == widget.cafeId) + (myCafe.cafeId == widget.cafeId) ? Container() : BottomTextButton( text: "이 카페를 내 위치로 지정하기", @@ -218,13 +219,11 @@ class _CafeDetailsState extends State widget.cafeId, ); - myCafe = { - "cafeId": widget.cafeId, - "latitude": - widget.cafeDetailsArguments[6], // 위도 - "longitude": - widget.cafeDetailsArguments[7], // 경도 - }; + myCafe.setMyCafe( + cafeId: widget.cafeId, + latitude: widget.cafeDetailsArguments[6], + longitude: widget.cafeDetailsArguments[7], + ); }, child: const Text("확인"), ), From f5bbcca0fe40992d6171bdc98629493563d63eeb Mon Sep 17 00:00:00 2001 From: godeka Date: Mon, 6 May 2024 15:01:56 +0900 Subject: [PATCH 05/10] =?UTF-8?q?[style]=20=EC=B9=B4=ED=8E=98=20=EC=A7=80?= =?UTF-8?q?=EC=A0=95=20=EB=8B=A4=EC=9D=B4=EC=96=BC=EB=A1=9C=EA=B7=B8=20?= =?UTF-8?q?=EC=BB=A4=EC=8A=A4=ED=85=80=ED=99=94,=20BottomTwoButtons?= =?UTF-8?q?=EC=97=90=20=ED=81=B4=EB=A6=AD=20=ED=95=B8=EB=93=A4=EB=9F=AC=20?= =?UTF-8?q?=EC=A0=84=EB=8B=AC=20#173?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/lib/screen/cafe_details.dart | 76 +++++++++++-------- .../widgets/button/bottom_two_buttons.dart | 26 ++++++- frontend/lib/widgets/notification_dialog.dart | 2 + frontend/lib/widgets/user_item.dart | 4 +- 4 files changed, 72 insertions(+), 36 deletions(-) diff --git a/frontend/lib/screen/cafe_details.dart b/frontend/lib/screen/cafe_details.dart index 0efe7ead69..f562b85418 100644 --- a/frontend/lib/screen/cafe_details.dart +++ b/frontend/lib/screen/cafe_details.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:frontend/service/stomp_service.dart'; +import 'package:frontend/widgets/button/bottom_two_buttons.dart'; import 'package:provider/provider.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; @@ -202,39 +203,50 @@ class _CafeDetailsState extends State showDialog( context: context, builder: (context) { - return AlertDialog( - title: const Text("카페 지정"), - content: - Text("${widget.cafeName}을(를) 내 위치로 지정하겠습니까?"), - actions: [ - TextButton( - onPressed: () { - _stopTimer(); - Navigator.pop(context); - - // 카페에 유저 추가 pub 요청 - addUserInCafe( - stompClient, - "test", - widget.cafeId, - ); - - myCafe.setMyCafe( - cafeId: widget.cafeId, - latitude: widget.cafeDetailsArguments[6], - longitude: widget.cafeDetailsArguments[7], - ); - }, - child: const Text("확인"), - ), - TextButton( - onPressed: () { - _stopTimer(); - Navigator.pop(context); - }, - child: const Text("취소"), + return Dialog( + backgroundColor: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20), + ), + child: Container( + padding: const EdgeInsets.all(20), + width: 300, + height: 200, + child: Column( + children: [ + const SizedBox( + height: 18, + ), + Text( + "${widget.cafeName}을(를) 내 위치로 표시하겠습니까?", + textAlign: TextAlign.center, + style: const TextStyle(fontSize: 20), + ), + const Expanded(child: SizedBox()), + BottomTwoButtonsSmall( + first: "확인", + second: "취소", + handleFirstClick: () { + _stopTimer(); + + // 카페에 유저 추가 pub 요청 + addUserInCafe( + stompClient, + "test", + widget.cafeId, + ); + + myCafe.setMyCafe( + cafeId: widget.cafeId, + latitude: widget.cafeDetailsArguments[6], + longitude: widget.cafeDetailsArguments[7], + ); + }, + handleSecondClick: _stopTimer, + ), + ], ), - ], + ), ); }, ); diff --git a/frontend/lib/widgets/button/bottom_two_buttons.dart b/frontend/lib/widgets/button/bottom_two_buttons.dart index dc19d95cc2..0d8c4eb633 100644 --- a/frontend/lib/widgets/button/bottom_two_buttons.dart +++ b/frontend/lib/widgets/button/bottom_two_buttons.dart @@ -3,16 +3,26 @@ import 'package:flutter/material.dart'; class BottomTwoButtonsSmall extends StatelessWidget { final String first; final String second; + final Function handleFirstClick; + final Function handleSecondClick; const BottomTwoButtonsSmall({ super.key, required this.first, required this.second, + required this.handleFirstClick, + required this.handleSecondClick, }); @override Widget build(BuildContext context) { - return BottomTwoButtons(width: 110, first: first, second: second); + return BottomTwoButtons( + width: 110, + first: first, + second: second, + handleFirstClick: handleFirstClick, + handleSecondClick: handleSecondClick, + ); } } @@ -20,12 +30,16 @@ class BottomTwoButtons extends StatelessWidget { final double? width; final String first; final String second; + final Function handleFirstClick; + final Function handleSecondClick; const BottomTwoButtons({ super.key, this.width = 130, required this.first, required this.second, + required this.handleFirstClick, + required this.handleSecondClick, }); @override @@ -37,7 +51,10 @@ class BottomTwoButtons extends StatelessWidget { width: width, height: 50, child: ElevatedButton( - onPressed: () {}, + onPressed: () { + Navigator.pop(context); + handleFirstClick(); + }, style: ElevatedButton.styleFrom( foregroundColor: Colors.white, backgroundColor: const Color(0xff212121), @@ -52,7 +69,10 @@ class BottomTwoButtons extends StatelessWidget { width: width, height: 50, child: TextButton( - onPressed: () {}, + onPressed: () { + Navigator.pop(context); + handleSecondClick(); + }, style: TextButton.styleFrom( foregroundColor: Colors.black, ), diff --git a/frontend/lib/widgets/notification_dialog.dart b/frontend/lib/widgets/notification_dialog.dart index 4226de3a9c..1bdb8f9fba 100644 --- a/frontend/lib/widgets/notification_dialog.dart +++ b/frontend/lib/widgets/notification_dialog.dart @@ -104,6 +104,8 @@ class NotificationDialog extends StatelessWidget { : BottomTwoButtonsSmall( first: firstButton, second: secondButton!, + handleFirstClick: () {}, + handleSecondClick: () {}, ), ], ), diff --git a/frontend/lib/widgets/user_item.dart b/frontend/lib/widgets/user_item.dart index 2b0ce6fddb..5fdb9f8a50 100644 --- a/frontend/lib/widgets/user_item.dart +++ b/frontend/lib/widgets/user_item.dart @@ -163,9 +163,11 @@ class ReceivedReqDialog extends StatelessWidget { ), const ColorTextContainer(text: "# 당신의 업무가 궁금해요."), const Expanded(child: SizedBox()), - const BottomTwoButtons( + BottomTwoButtons( first: "수락", second: "거절", + handleFirstClick: () {}, + handleSecondClick: () {}, ), ], ), From 85ac4a5b1c13dacb0bf7e690b19d13e19a88bdc5 Mon Sep 17 00:00:00 2001 From: godeka Date: Mon, 6 May 2024 15:17:35 +0900 Subject: [PATCH 06/10] =?UTF-8?q?[refactor]=20yn=20=EB=8B=A4=EC=9D=B4?= =?UTF-8?q?=EC=96=BC=EB=A1=9C=EA=B7=B8=20=EC=9C=84=EC=A0=AF=ED=99=94=20#17?= =?UTF-8?q?3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/lib/screen/cafe_details.dart | 67 +++++++--------------- frontend/lib/widgets/dialog/yn_dialog.dart | 53 +++++++++++++++++ 2 files changed, 75 insertions(+), 45 deletions(-) create mode 100644 frontend/lib/widgets/dialog/yn_dialog.dart diff --git a/frontend/lib/screen/cafe_details.dart b/frontend/lib/screen/cafe_details.dart index f562b85418..3479aa3f66 100644 --- a/frontend/lib/screen/cafe_details.dart +++ b/frontend/lib/screen/cafe_details.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:frontend/service/stomp_service.dart'; -import 'package:frontend/widgets/button/bottom_two_buttons.dart'; import 'package:provider/provider.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; @@ -9,6 +8,7 @@ import 'package:frontend/widgets/cafe_info.dart'; import 'package:frontend/widgets/top_appbar.dart'; import 'package:frontend/widgets/user_item.dart'; import 'package:frontend/widgets/button/bottom_text_button.dart'; +import 'package:frontend/widgets/dialog/yn_dialog.dart'; import 'package:frontend/model/user_model.dart'; import 'package:frontend/model/my_cafe_model.dart'; import 'package:geolocator/geolocator.dart'; @@ -203,50 +203,27 @@ class _CafeDetailsState extends State showDialog( context: context, builder: (context) { - return Dialog( - backgroundColor: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(20), - ), - child: Container( - padding: const EdgeInsets.all(20), - width: 300, - height: 200, - child: Column( - children: [ - const SizedBox( - height: 18, - ), - Text( - "${widget.cafeName}을(를) 내 위치로 표시하겠습니까?", - textAlign: TextAlign.center, - style: const TextStyle(fontSize: 20), - ), - const Expanded(child: SizedBox()), - BottomTwoButtonsSmall( - first: "확인", - second: "취소", - handleFirstClick: () { - _stopTimer(); - - // 카페에 유저 추가 pub 요청 - addUserInCafe( - stompClient, - "test", - widget.cafeId, - ); - - myCafe.setMyCafe( - cafeId: widget.cafeId, - latitude: widget.cafeDetailsArguments[6], - longitude: widget.cafeDetailsArguments[7], - ); - }, - handleSecondClick: _stopTimer, - ), - ], - ), - ), + return YesOrNoDialog( + content: "${widget.cafeName}을(를) 내 위치로 표시하겠습니까?", + firstButton: "확인", + secondButton: "취소", + handleFirstClick: () { + _stopTimer(); + + // 카페에 유저 추가 pub 요청 + addUserInCafe( + stompClient, + "test", + widget.cafeId, + ); + + myCafe.setMyCafe( + cafeId: widget.cafeId, + latitude: widget.cafeDetailsArguments[6], + longitude: widget.cafeDetailsArguments[7], + ); + }, + handleSecondClick: _stopTimer, ); }, ); diff --git a/frontend/lib/widgets/dialog/yn_dialog.dart b/frontend/lib/widgets/dialog/yn_dialog.dart new file mode 100644 index 0000000000..107958f8c0 --- /dev/null +++ b/frontend/lib/widgets/dialog/yn_dialog.dart @@ -0,0 +1,53 @@ +import 'package:flutter/material.dart'; +import 'package:frontend/widgets/button/bottom_two_buttons.dart'; + +class YesOrNoDialog extends StatelessWidget { + final String content; + final String firstButton; + final String secondButton; + final Function handleFirstClick; + final Function handleSecondClick; + + const YesOrNoDialog({ + super.key, + required this.content, + required this.firstButton, + required this.secondButton, + required this.handleFirstClick, + required this.handleSecondClick, + }); + + @override + Widget build(BuildContext context) { + return Dialog( + backgroundColor: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20), + ), + child: Container( + padding: const EdgeInsets.all(20), + width: 300, + height: 200, + child: Column( + children: [ + const SizedBox( + height: 15, + ), + Text( + content, + textAlign: TextAlign.center, + style: const TextStyle(fontSize: 20), + ), + const Expanded(child: SizedBox()), + BottomTwoButtonsSmall( + first: "확인", + second: "취소", + handleFirstClick: handleFirstClick, + handleSecondClick: handleSecondClick, + ), + ], + ), + ), + ); + } +} From e19c34dbff8826d2f4a3797dd2a18abf757f7b47 Mon Sep 17 00:00:00 2001 From: godeka Date: Mon, 6 May 2024 15:19:49 +0900 Subject: [PATCH 07/10] =?UTF-8?q?[move]=20=ED=91=B8=EC=8B=9C=EC=95=8C?= =?UTF-8?q?=EB=A6=BC=20=EB=8B=A4=EC=9D=B4=EC=96=BC=EB=A1=9C=EA=B7=B8=20dia?= =?UTF-8?q?log=20=ED=8F=B4=EB=8D=94=EB=A1=9C=20=EC=9D=B4=EB=8F=99=20#173?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/lib/widgets/{ => dialog}/notification_dialog.dart | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename frontend/lib/widgets/{ => dialog}/notification_dialog.dart (100%) diff --git a/frontend/lib/widgets/notification_dialog.dart b/frontend/lib/widgets/dialog/notification_dialog.dart similarity index 100% rename from frontend/lib/widgets/notification_dialog.dart rename to frontend/lib/widgets/dialog/notification_dialog.dart From 04940614c5a7edd24d2052a94bece4642f6279c4 Mon Sep 17 00:00:00 2001 From: godeka Date: Mon, 6 May 2024 15:30:18 +0900 Subject: [PATCH 08/10] =?UTF-8?q?[refactor]=20=EB=82=B4=20=EC=9C=84?= =?UTF-8?q?=EC=B9=98=EB=A1=9C=20=EC=A7=80=EC=A0=95=EB=90=9C=20=EC=B9=B4?= =?UTF-8?q?=ED=8E=98=20=EC=86=8D=EC=84=B1=EB=93=A4=20nullable=EB=A1=9C=20#?= =?UTF-8?q?173?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/lib/main.dart | 6 +----- frontend/lib/model/my_cafe_model.dart | 12 ++++++------ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/frontend/lib/main.dart b/frontend/lib/main.dart index 71e0f0e205..74918b9495 100644 --- a/frontend/lib/main.dart +++ b/frontend/lib/main.dart @@ -119,11 +119,7 @@ class _MyAppState extends State { create: (_) => stompClient, ), ChangeNotifierProvider( - create: (_) => MyCafeModel( - cafeId: "", - latitude: "", - longitude: "", - ), + create: (_) => MyCafeModel(), ), ], child: MaterialApp( diff --git a/frontend/lib/model/my_cafe_model.dart b/frontend/lib/model/my_cafe_model.dart index e5e8859c07..4a10bae872 100644 --- a/frontend/lib/model/my_cafe_model.dart +++ b/frontend/lib/model/my_cafe_model.dart @@ -1,14 +1,14 @@ import 'package:flutter/material.dart'; class MyCafeModel extends ChangeNotifier { - String cafeId; - String latitude; - String longitude; + String? cafeId; + String? latitude; + String? longitude; MyCafeModel({ - required this.cafeId, - required this.latitude, - required this.longitude, + this.cafeId, + this.latitude, + this.longitude, }); void setMyCafe({ From 69f21b04ec5c7645c8d7c0e2d91cb479f1fdcfd0 Mon Sep 17 00:00:00 2001 From: godeka Date: Mon, 6 May 2024 15:40:21 +0900 Subject: [PATCH 09/10] =?UTF-8?q?[feat]=20=EC=A7=80=EC=A0=95=20=EC=B9=B4?= =?UTF-8?q?=ED=8E=98=20=EB=B3=80=EA=B2=BD=20#173?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/lib/screen/cafe_details.dart | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/lib/screen/cafe_details.dart b/frontend/lib/screen/cafe_details.dart index 3479aa3f66..3888fcc3fd 100644 --- a/frontend/lib/screen/cafe_details.dart +++ b/frontend/lib/screen/cafe_details.dart @@ -203,13 +203,27 @@ class _CafeDetailsState extends State showDialog( context: context, builder: (context) { + bool setOrChange = myCafe.cafeId == null ? true : false; + String content = setOrChange + ? "${widget.cafeName}을(를) 내 위치로 표시하겠습니까?" + : "${widget.cafeName}을(를) 내 위치로 표시하도록 변경하겠습니까?"; + return YesOrNoDialog( - content: "${widget.cafeName}을(를) 내 위치로 표시하겠습니까?", + content: content, firstButton: "확인", secondButton: "취소", handleFirstClick: () { _stopTimer(); + // 지정 카페 변경인 경우 + if (!setOrChange) { + // 기존 카페에서 유저 삭제 pub 요청 + deleteUserInCafe( + stompClient, + "test", + widget.cafeId, + ); + } // 카페에 유저 추가 pub 요청 addUserInCafe( stompClient, From 73297586fb41a216b42932576bb72d66d58a3cdc Mon Sep 17 00:00:00 2001 From: godeka Date: Mon, 6 May 2024 16:44:27 +0900 Subject: [PATCH 10/10] =?UTF-8?q?[fix]=20=EC=B9=B4=ED=8E=98=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EC=9C=A0=EC=A0=80=20=EC=82=AD=EC=A0=9C=20=EC=8B=9C?= =?UTF-8?q?=20=EA=B8=B0=EC=A1=B4=20=EC=B9=B4=ED=8E=98=20=EC=95=84=EC=9D=B4?= =?UTF-8?q?=EB=94=94=EB=A1=9C=20#173?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/lib/screen/cafe_details.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/lib/screen/cafe_details.dart b/frontend/lib/screen/cafe_details.dart index 3888fcc3fd..906ef658d7 100644 --- a/frontend/lib/screen/cafe_details.dart +++ b/frontend/lib/screen/cafe_details.dart @@ -221,7 +221,7 @@ class _CafeDetailsState extends State deleteUserInCafe( stompClient, "test", - widget.cafeId, + myCafe.cafeId!, ); } // 카페에 유저 추가 pub 요청