From ab7e40241ff48e1000a13f5f465447bec0a9942a Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Wed, 14 Aug 2024 11:52:38 +0900 Subject: [PATCH 1/9] =?UTF-8?q?M3-292=20Feat=20:=20=EC=A7=80=EB=8F=84=20?= =?UTF-8?q?=EC=A4=91=EC=95=99=20=EC=A2=8C=ED=91=9C=EB=A1=9C=20=EC=9E=A5?= =?UTF-8?q?=EC=86=8C=20=EB=93=B1=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/controllers/my_place_controller.dart | 13 +----- lib/screens/my_place_screen.dart | 58 ++++++++++++++++-------- 2 files changed, 40 insertions(+), 31 deletions(-) diff --git a/lib/controllers/my_place_controller.dart b/lib/controllers/my_place_controller.dart index ddd8aaef..d2689540 100644 --- a/lib/controllers/my_place_controller.dart +++ b/lib/controllers/my_place_controller.dart @@ -49,18 +49,7 @@ class MyPlaceController extends GetxController { bottomSheetController.minimize(); } - void updateMarker(LatLng latLng) { - markers.clear(); - markers.add( - Marker( - markerId: MarkerId('clicked_position'), - position: latLng, - infoWindow: InfoWindow( - title: 'Clicked Position', - snippet: 'Lat: ${latLng.latitude}, Lng: ${latLng.longitude}', - ), - ), - ); + void updateCoordinate(LatLng latLng) { selectedLatitude.value = latLng.latitude; selectedLongitude.value = latLng.longitude; } diff --git a/lib/screens/my_place_screen.dart b/lib/screens/my_place_screen.dart index ff8b5cbb..059f3310 100644 --- a/lib/screens/my_place_screen.dart +++ b/lib/screens/my_place_screen.dart @@ -13,25 +13,29 @@ class MyPlaceScreen extends StatelessWidget { Widget build(BuildContext context) { final MyPlaceController myPlaceController = Get.put(MyPlaceController()); - return Scaffold( - appBar: AppBar( - leading: IconButton( - onPressed: () { - Get.back(); - }, - icon: Icon( - Icons.arrow_back_ios, - color: AppColors.buttonColor, - ), + final PreferredSizeWidget appBar = AppBar( + leading: IconButton( + onPressed: () { + Get.back(); + }, + icon: Icon( + Icons.arrow_back_ios, + color: AppColors.buttonColor, ), - backgroundColor: AppColors.background, - title: Text( - '내 장소 등록', - style: TextStyle( - color: AppColors.textPrimary, - ), + ), + backgroundColor: AppColors.background, + title: Text( + '내 장소 등록', + style: TextStyle( + color: AppColors.textPrimary, ), ), + ); + + final double appBarHeight = appBar.preferredSize.height; + + return Scaffold( + appBar: appBar, body: Obx(() { if (myPlaceController.isLoading.value) { return const Center( @@ -60,8 +64,24 @@ class MyPlaceScreen extends StatelessWidget { myLocationEnabled: false, style: myPlaceController.mapStyle, markers: Set.of(myPlaceController.markers), - onTap: (LatLng latLng) { - myPlaceController.updateMarker(latLng); + onCameraIdle: () async { + final GoogleMapController? controller = + myPlaceController.googleMapController; + LatLng center = LatLng( + LocationService().currentLocation!.latitude!, + LocationService().currentLocation!.longitude!, + ); + if (controller != null) { + center = await controller.getLatLng( + ScreenCoordinate( + x: MediaQuery.of(context).size.width ~/ 2, + y: (MediaQuery.of(context).size.height-appBarHeight) ~/ 2, + ), + ); + } else { + print('googlemap is null'); + } + myPlaceController.updateCoordinate(center); }, ); }, @@ -82,7 +102,7 @@ class MyPlaceScreen extends StatelessWidget { child: Text( '등록', style: TextStyle( - color: AppColors.textPrimary, + color: AppColors.textBlack, fontSize: 15, fontWeight: FontWeight.w700, ), From a9327e0eae8c58a51752f979ac82b737423fa5e3 Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Wed, 14 Aug 2024 13:59:14 +0900 Subject: [PATCH 2/9] =?UTF-8?q?M3-292=20Feat=20:=20=EC=A7=80=EB=8F=84=20?= =?UTF-8?q?=ED=95=80=20=EC=9D=B4=EB=AF=B8=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/images/green_map_pin.png | Bin 0 -> 7124 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 assets/images/green_map_pin.png diff --git a/assets/images/green_map_pin.png b/assets/images/green_map_pin.png new file mode 100644 index 0000000000000000000000000000000000000000..3cd907d33acc2f0ed83b38b0f86ede256746cfdb GIT binary patch literal 7124 zcmV;_8!P0AP)Py5j!8s8RCr$PTnm^@<@*19>$>-zs~Kj@xaEF3D5O&=cc;@urJ_)XDCOXgIwVIT zl1S--LXJxmT}XdIouYFJWkQjWOEd15x$Mi@Ypw75Kkv8p$iL_RJe|<&8OM5_-Dvi# z+xuJZ`~KeF`+kez(pKgzz{>m;Ub;YB0;wE41eZX%1XAf)KnS4%V2m-R0F zU*4ce&ehFYeRcg+*XNc;(8?7^t5z+qH}~!N53l&-!yaz2orW|3emJP;(@{B{!Dj#( z16&san)bpSt;~Y--0bJNj(B{;n+U*6z58md&OL1qu9b`fMiGil7mC8+a+{a} zm>@`m{7E0$xB|G0K`;$)TtExJXDRTVc95+k!`gQYxhuZ_mV5yOS#bQQ3B$%bJZkoZ zGwp>tQkewl_Wrj%yW+$5hNDq})o|PZe?c`9;dBjQEeZ!wKofA_0^9*KQ+kZX1r!db zf;@`DQ6N9kqd0+T!VnrXOTc70bgsa6io@N00tctP4QxCqy5D~LtZ`GHd9*>L21OUn z#OHscG6zzpo}K5dU9;w1++NRVHS}&{e>TI>fCZu3fCPp^;p7<%3Jeb{K_CH&5KzFu z8GQg(0fZfesV5`K!w}&Jd zr`0YvfAe0LBa|tS+IH_S_mfTQdaFHK@|J^cQ}a?RoDMh$X%09Dq>>Vd5a56>Em$km3GSqZ#E8Ah~kJ^2>2O5^(hlzlwY7qgDadt zS5$DK+vH=6%ubQd14`y8`luSBRtTzTN@5tXg8&!s874TV_-G(%xiD=Vjjf8vy0>NGxfReT_!-9zhYsl-VgQs0$my^P5;&lhf*Rq=?_EosffBo z&{Y)#Pb3!{AU+P5 zP=tZBpdZzbo7npIxxj~e_{=G<_IkL_gNx7IyccHAG652*n@7;l%&0eY2#RVLI2EuE z5g|a0g*VrRDgc8>f*{~1jH!S|%piIeNc8`bEyxh)fhENvFyTr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z-RRv)yKF=ooXQd?unXX)hMrXc`=+f1rv2Mp^VWuzojbRS+e-z{7u<3U65ageH($5* zo4ucPtn==pI9!7x$ihgrO*Aa1h=1Ka+N}|2_SOCk+pa!eL&bCdau3qNC2w}^IrzSJ z5@+54tz#`jQUub1D$Eam!jHoiiV0($eQ@-kk+b4yne+8&4ms z<|l$E|_v!NcTP}P|&#!AjJrcyh zJElf&Z1|^lK3wrXJ<2UQu?xQ_Kw7kXQTrYPdVE}W)Lksl^>Xap{4I(GED?)en0L!P z_x4$J38XS$0V-~d>d8l0lS=;1lO9S~`N~{@<-5Y-u#;3CntH!x!i&O_=q5YeapRk7 zKmYKq0ZXR&W)1mks8y}@>%M$-yc!K3lMYKmNp1 z{U!~6a$b1=;n%M5q55I$I9z+H-k&#fnEy96O%%pBka8|J_9eQs03C$IW}~_0jFywfo1q4QosNm1n;f z*cTN@)2F}GY3R@qt4IEAM7L+3d3yQpWwg>h?nMRC#*G^@I{xYAO>eDO+P+JtPH}m~ z% Date: Wed, 14 Aug 2024 14:57:31 +0900 Subject: [PATCH 3/9] =?UTF-8?q?M3-292=20Feat=20:=20=EB=82=B4=20=EC=9E=A5?= =?UTF-8?q?=EC=86=8C=20=EB=93=B1=EB=A1=9D=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/controllers/my_place_controller.dart | 16 ++++ lib/main.dart | 2 +- lib/screens/map_screen.dart | 3 +- lib/screens/my_place_screen.dart | 86 ++++++++++++++------ lib/widgets/map/current_location_button.dart | 24 +++++- lib/widgets/map/my_place_bottom_sheet.dart | 10 +-- 6 files changed, 106 insertions(+), 35 deletions(-) diff --git a/lib/controllers/my_place_controller.dart b/lib/controllers/my_place_controller.dart index d2689540..d97da9a3 100644 --- a/lib/controllers/my_place_controller.dart +++ b/lib/controllers/my_place_controller.dart @@ -32,6 +32,7 @@ class MyPlaceController extends GetxController { RxBool isLoading = true.obs; final RxDouble selectedLatitude = 37.503640.obs; final RxDouble selectedLongitude = 127.044829.obs; + RxBool isCameraTrackingUser = true.obs; final RxString myPlaceName = "HOME".obs; final RxInt selectedPlace = 0.obs; @@ -112,4 +113,19 @@ class MyPlaceController extends GetxController { getSelectedPlace() { return selectedPlace.value; } + + setCameraOnCurrentLocation() { + isCameraTrackingUser = true.obs; + + currentCameraPosition = CameraPosition( + target: LatLng( + _locationService.currentLocation!.latitude!, + _locationService.currentLocation!.longitude!, + ), + zoom: 16.0, + ); + googleMapController?.animateCamera( + CameraUpdate.newCameraPosition(currentCameraPosition), + ); + } } diff --git a/lib/main.dart b/lib/main.dart index fcf9a77e..35776ac1 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -32,7 +32,7 @@ Future main() async { ]); await dotenv.load(fileName: ".env"); await GetStorage.init(); - final MainController mainController = MainController(); + final MainController mainController = Get.put(MainController()); await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, ); diff --git a/lib/screens/map_screen.dart b/lib/screens/map_screen.dart index ce7923be..24716d8e 100644 --- a/lib/screens/map_screen.dart +++ b/lib/screens/map_screen.dart @@ -56,6 +56,7 @@ class MapScreen extends StatelessWidget { mapController.googleMapController = ctrl; }, myLocationEnabled: true, + myLocationButtonEnabled: false, style: mapController.mapStyle, polygons: Set.of(mapController.pixels), ), @@ -98,7 +99,7 @@ class MapScreen extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ PixelCountInfo(count: 128), - CurrentLocationButton(), + CurrentLocationButton(checkController: "map",), ], ), ), diff --git a/lib/screens/my_place_screen.dart b/lib/screens/my_place_screen.dart index 059f3310..4938a5a7 100644 --- a/lib/screens/my_place_screen.dart +++ b/lib/screens/my_place_screen.dart @@ -5,6 +5,8 @@ import 'package:google_maps_flutter/google_maps_flutter.dart'; import '../constants/app_colors.dart'; import '../controllers/my_place_controller.dart'; import '../service/location_service.dart'; +import '../widgets/map/current_location_button.dart'; +import '../widgets/map/my_place_button.dart'; class MyPlaceScreen extends StatelessWidget { MyPlaceScreen({super.key}); @@ -12,6 +14,8 @@ class MyPlaceScreen extends StatelessWidget { @override Widget build(BuildContext context) { final MyPlaceController myPlaceController = Get.put(MyPlaceController()); + final double mapPinHeight = 60; + final double mapPinWidth = mapPinHeight * 0.85; final PreferredSizeWidget appBar = AppBar( leading: IconButton( @@ -31,6 +35,11 @@ class MyPlaceScreen extends StatelessWidget { ), ), ); + final Widget mapPinImage = Image.asset( + 'assets/images/green_map_pin.png', + height: mapPinHeight, + width: mapPinWidth, + ); final double appBarHeight = appBar.preferredSize.height; @@ -62,6 +71,7 @@ class MyPlaceScreen extends StatelessWidget { myPlaceController.googleMapController = ctrl; }, myLocationEnabled: false, + zoomControlsEnabled: false, style: myPlaceController.mapStyle, markers: Set.of(myPlaceController.markers), onCameraIdle: () async { @@ -72,12 +82,15 @@ class MyPlaceScreen extends StatelessWidget { LocationService().currentLocation!.longitude!, ); if (controller != null) { - center = await controller.getLatLng( - ScreenCoordinate( - x: MediaQuery.of(context).size.width ~/ 2, - y: (MediaQuery.of(context).size.height-appBarHeight) ~/ 2, - ), - ); + LatLngBounds visibleRegion = + await controller.getVisibleRegion(); + center = LatLng( + (visibleRegion.northeast.latitude + + visibleRegion.southwest.latitude) / + 2, + (visibleRegion.northeast.longitude + + visibleRegion.southwest.longitude) / + 2); } else { print('googlemap is null'); } @@ -87,27 +100,52 @@ class MyPlaceScreen extends StatelessWidget { }, ), Positioned( - top: 20, - right: 10, - child: GestureDetector( - onTap: () { - myPlaceController.openMyPlaceBottomSheet(); - }, - child: Container( - padding: EdgeInsets.symmetric(vertical: 7, horizontal: 20), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: AppColors.primary, + top: (MediaQuery.of(context).size.height - appBarHeight) / 2 - + (mapPinHeight - 2), + left: + (MediaQuery.of(context).size.width / 2) - (mapPinWidth / 2), + child: mapPinImage, + ), + Positioned( + bottom: 15, + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Padding( + padding: const EdgeInsets.only(right: 10.0), + child: CurrentLocationButton( + checkController: "myPlace", + ), ), - child: Text( - '등록', - style: TextStyle( - color: AppColors.textBlack, - fontSize: 15, - fontWeight: FontWeight.w700, + Padding( + padding: const EdgeInsets.all(10), + child: GestureDetector( + onTap: () { + myPlaceController.openMyPlaceBottomSheet(); + }, + child: Container( + width: MediaQuery.of(context).size.width - 20, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: AppColors.primary, + ), + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Center( + child: Text( + '등록', + style: TextStyle( + color: AppColors.textBlack, + fontSize: 20, + fontWeight: FontWeight.w700, + ), + ), + ), + ), + ), ), ), - ), + ], ), ), ], diff --git a/lib/widgets/map/current_location_button.dart b/lib/widgets/map/current_location_button.dart index 646f922f..a99db29a 100644 --- a/lib/widgets/map/current_location_button.dart +++ b/lib/widgets/map/current_location_button.dart @@ -3,19 +3,35 @@ import 'package:get/get.dart'; import '../../constants/app_colors.dart'; import '../../controllers/map_controller.dart'; +import '../../controllers/my_place_controller.dart'; class CurrentLocationButton extends StatefulWidget { - const CurrentLocationButton({super.key}); + final String checkController; + const CurrentLocationButton({super.key, required this.checkController}); @override createState() => _CurrentLocationButtonState(); } class _CurrentLocationButtonState extends State { - final MapController mapController = Get.find(); + late final dynamic _controller; Color _buttonColor = AppColors.backgroundSecondary; // 기본 배경 색상 final Color _pressedColor = Colors.grey; // 눌렀을 때의 배경 색상 + @override + void initState(){ + super.initState(); + _initializeController(); + } + + void _initializeController(){ + if(widget.checkController=="map"){ + _controller = Get.find(); + }else{ + _controller = Get.find(); + } + } + void _onPointerDown(DragDownDetails event) { setState(() { _buttonColor = _pressedColor; @@ -32,8 +48,8 @@ class _CurrentLocationButtonState extends State { Widget build(BuildContext context) { return GestureDetector( onTap: () { - mapController.setCameraOnCurrentLocation(); - mapController.isCameraTrackingUser = true.obs; + _controller.setCameraOnCurrentLocation(); + _controller.isCameraTrackingUser = true.obs; }, onPanDown: _onPointerDown, onPanEnd: (details) => _onPointerUp(), diff --git a/lib/widgets/map/my_place_bottom_sheet.dart b/lib/widgets/map/my_place_bottom_sheet.dart index ca46a266..1f0550e1 100644 --- a/lib/widgets/map/my_place_bottom_sheet.dart +++ b/lib/widgets/map/my_place_bottom_sheet.dart @@ -68,10 +68,10 @@ class MyPlaceBottomSheet extends StatelessWidget { child: InkWell( borderRadius: BorderRadius.circular(16), onTap: () async { - await myPlaceService.putMyPlaceInfo( - myPlaceController.myPlaceName.value, - myPlaceController.selectedLatitude.value, - myPlaceController.selectedLongitude.value,); + // await myPlaceService.putMyPlaceInfo( + // myPlaceController.myPlaceName.value, + // myPlaceController.selectedLatitude.value, + // myPlaceController.selectedLongitude.value,); await myPlaceController.writeMyPlaceOnLocalStorage( myPlaceController.myPlaceName.value, @@ -94,7 +94,7 @@ class MyPlaceBottomSheet extends StatelessWidget { '장소등록', style: TextStyle( fontSize: 20, - color: AppColors.textPrimary, + color: AppColors.textBlack, fontWeight: FontWeight.w700, ), ), From d957c817241b86af1e96869e17600b3387ae46fa Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:05:20 +0900 Subject: [PATCH 4/9] M3-292 Feat : dart fix --- lib/screens/my_place_screen.dart | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/screens/my_place_screen.dart b/lib/screens/my_place_screen.dart index 4938a5a7..4a66f410 100644 --- a/lib/screens/my_place_screen.dart +++ b/lib/screens/my_place_screen.dart @@ -6,7 +6,6 @@ import '../constants/app_colors.dart'; import '../controllers/my_place_controller.dart'; import '../service/location_service.dart'; import '../widgets/map/current_location_button.dart'; -import '../widgets/map/my_place_button.dart'; class MyPlaceScreen extends StatelessWidget { MyPlaceScreen({super.key}); @@ -14,8 +13,8 @@ class MyPlaceScreen extends StatelessWidget { @override Widget build(BuildContext context) { final MyPlaceController myPlaceController = Get.put(MyPlaceController()); - final double mapPinHeight = 60; - final double mapPinWidth = mapPinHeight * 0.85; + const double mapPinHeight = 60; + const double mapPinWidth = mapPinHeight * 0.85; final PreferredSizeWidget appBar = AppBar( leading: IconButton( @@ -85,14 +84,13 @@ class MyPlaceScreen extends StatelessWidget { LatLngBounds visibleRegion = await controller.getVisibleRegion(); center = LatLng( - (visibleRegion.northeast.latitude + - visibleRegion.southwest.latitude) / - 2, - (visibleRegion.northeast.longitude + - visibleRegion.southwest.longitude) / - 2); - } else { - print('googlemap is null'); + (visibleRegion.northeast.latitude + + visibleRegion.southwest.latitude) / + 2, + (visibleRegion.northeast.longitude + + visibleRegion.southwest.longitude) / + 2, + ); } myPlaceController.updateCoordinate(center); }, From fdc59325136780e42e7a18c48b8937d941ff47e7 Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:15:17 +0900 Subject: [PATCH 5/9] M3-292 Feat : dart fix --- lib/controllers/my_place_controller.dart | 6 ++++-- lib/widgets/map/my_place_bottom_sheet.dart | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/controllers/my_place_controller.dart b/lib/controllers/my_place_controller.dart index d97da9a3..4f9b8c05 100644 --- a/lib/controllers/my_place_controller.dart +++ b/lib/controllers/my_place_controller.dart @@ -30,8 +30,8 @@ class MyPlaceController extends GetxController { RxList markers = [].obs; RxBool isLoading = true.obs; - final RxDouble selectedLatitude = 37.503640.obs; - final RxDouble selectedLongitude = 127.044829.obs; + late final RxDouble selectedLatitude; + late final RxDouble selectedLongitude; RxBool isCameraTrackingUser = true.obs; final RxString myPlaceName = "HOME".obs; final RxInt selectedPlace = 0.obs; @@ -42,6 +42,8 @@ class MyPlaceController extends GetxController { @override void onInit() async { super.onInit(); + selectedLongitude.value =_locationService.currentLocation!.longitude!; + selectedLatitude.value = _locationService.currentLocation!.latitude!; await _loadMapStyle(); await initCurrentLocation(); } diff --git a/lib/widgets/map/my_place_bottom_sheet.dart b/lib/widgets/map/my_place_bottom_sheet.dart index 1f0550e1..3a29973d 100644 --- a/lib/widgets/map/my_place_bottom_sheet.dart +++ b/lib/widgets/map/my_place_bottom_sheet.dart @@ -68,10 +68,10 @@ class MyPlaceBottomSheet extends StatelessWidget { child: InkWell( borderRadius: BorderRadius.circular(16), onTap: () async { - // await myPlaceService.putMyPlaceInfo( - // myPlaceController.myPlaceName.value, - // myPlaceController.selectedLatitude.value, - // myPlaceController.selectedLongitude.value,); + await myPlaceService.putMyPlaceInfo( + myPlaceController.myPlaceName.value, + myPlaceController.selectedLatitude.value, + myPlaceController.selectedLongitude.value,); await myPlaceController.writeMyPlaceOnLocalStorage( myPlaceController.myPlaceName.value, From cf21f1faf0c11a7142cc3c544aa711ad1586eece Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Wed, 14 Aug 2024 16:22:49 +0900 Subject: [PATCH 6/9] =?UTF-8?q?M3-292=20Feat=20:=20=EC=A7=80=EB=8F=84=20?= =?UTF-8?q?=EC=A2=8C=ED=91=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/controllers/my_place_controller.dart | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/controllers/my_place_controller.dart b/lib/controllers/my_place_controller.dart index 4f9b8c05..360132ba 100644 --- a/lib/controllers/my_place_controller.dart +++ b/lib/controllers/my_place_controller.dart @@ -30,8 +30,8 @@ class MyPlaceController extends GetxController { RxList markers = [].obs; RxBool isLoading = true.obs; - late final RxDouble selectedLatitude; - late final RxDouble selectedLongitude; + final RxDouble selectedLatitude = 37.566422.obs; + final RxDouble selectedLongitude = 126.977948.obs; RxBool isCameraTrackingUser = true.obs; final RxString myPlaceName = "HOME".obs; final RxInt selectedPlace = 0.obs; @@ -42,8 +42,6 @@ class MyPlaceController extends GetxController { @override void onInit() async { super.onInit(); - selectedLongitude.value =_locationService.currentLocation!.longitude!; - selectedLatitude.value = _locationService.currentLocation!.latitude!; await _loadMapStyle(); await initCurrentLocation(); } @@ -59,7 +57,6 @@ class MyPlaceController extends GetxController { Future initCurrentLocation() async { try { - await LocationService().initCurrentLocation(); currentCameraPosition = CameraPosition( target: LatLng( _locationService.currentLocation!.latitude!, From e7e2b73b6ae9d02825d857520a0e384ba3e9659c Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Wed, 14 Aug 2024 19:19:01 +0900 Subject: [PATCH 7/9] =?UTF-8?q?M3-292=20Feat=20:=20LF=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/utils/dio_service.dart | 44 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/utils/dio_service.dart b/lib/utils/dio_service.dart index 3f2881ca..44cbfad4 100644 --- a/lib/utils/dio_service.dart +++ b/lib/utils/dio_service.dart @@ -42,9 +42,9 @@ class DioService { return handler.next(response); }, onError: ( - DioException dioException, - ErrorInterceptorHandler errorInterceptorHandler, - ) async { + DioException dioException, + ErrorInterceptorHandler errorInterceptorHandler, + ) async { if (dioException.response?.statusCode == HttpStatus.unauthorized) { try { ReissueResponse reissueResponse = await reissueToken(); @@ -52,7 +52,7 @@ class DioService { userManager.setRefreshToken(reissueResponse.refreshToken!); Response resendResponse = - await resendRequest(dioException, reissueResponse); + await resendRequest(dioException, reissueResponse); errorInterceptorHandler.resolve(resendResponse); debugPrint('-------------refresh---------------'); } catch (err) { @@ -69,9 +69,9 @@ class DioService { } Future> resendRequest( - DioException dioException, - ReissueResponse reissueResponse, - ) async { + DioException dioException, + ReissueResponse reissueResponse, + ) async { final options = dioException.requestOptions; final dio = Dio(); options.headers.addAll({ @@ -87,7 +87,7 @@ class DioService { var response = await dio .post("$baseUrl/auth/reissue", data: {"refreshToken": refreshToken}); ReissueResponse reissueResponse = - ReissueResponse.fromJson(response.data["data"]); + ReissueResponse.fromJson(response.data["data"]); UserManager().setTokenReissued(); return reissueResponse; } @@ -102,11 +102,11 @@ class DioService { options.extra['requestTimestamp'] = requestTimestamp; debugPrint( '---------------[Request - $requestTimestamp]---------------\n' - '[Method] : ${options.method}\n' - '[Path] : ${options.path}\n' - '[Headers] : ${options.headers}\n' - '[Query Parameters] : ${options.queryParameters}\n' - '[Body] : ${options.data}', + '[Method] : ${options.method}\n' + '[Path] : ${options.path}\n' + '[Headers] : ${options.headers}\n' + '[Query Parameters] : ${options.queryParameters}\n' + '[Body] : ${options.data}', ); } } @@ -118,10 +118,10 @@ class DioService { var requestDuration = requestEndTime.difference(requestTimestamp); debugPrint( '\n---------------[Response - $requestTimestamp]---------------\n' - '[Status Code] : ${response.statusCode}\n' - '[Data] : ${response.data}\n' - '[Duration] : ${requestDuration.inMilliseconds} ms\n' - '----------------------------------------------\n', + '[Status Code] : ${response.statusCode}\n' + '[Data] : ${response.data}\n' + '[Duration] : ${requestDuration.inMilliseconds} ms\n' + '----------------------------------------------\n', ); } } @@ -129,10 +129,10 @@ class DioService { void logError(DioException dioException) { debugPrint( '\n---------------[Response - ERROR]---------------\n' - '[Status Code] : ${dioException.response?.statusCode}\n' - '[Message]: ${dioException.message}' - '[Data] : ${dioException.response?.data}\n' - '----------------------------------------------\n', + '[Status Code] : ${dioException.response?.statusCode}\n' + '[Message]: ${dioException.message}' + '[Data] : ${dioException.response?.data}\n' + '----------------------------------------------\n', ); } -} +} \ No newline at end of file From 6d3341a58f4f13d762bd760d4f254f8d051f5b25 Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Fri, 16 Aug 2024 03:24:43 +0900 Subject: [PATCH 8/9] =?UTF-8?q?M3-292=20Feat=20:=20getput=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/main.dart b/lib/main.dart index 35776ac1..c8a30551 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -32,7 +32,7 @@ Future main() async { ]); await dotenv.load(fileName: ".env"); await GetStorage.init(); - final MainController mainController = Get.put(MainController()); + final MainController mainController = Get.put(MainController(), permanent: true); await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, ); From 8692dba788d74e1b258d5a47abab64c7be4022bd Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Sat, 17 Aug 2024 01:56:09 +0900 Subject: [PATCH 9/9] =?UTF-8?q?M3-292=20Feat=20:=20=EC=BB=A8=ED=8A=B8?= =?UTF-8?q?=EB=A1=A4=EB=9F=AC=20=EC=84=A0=EC=96=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index c8a30551..dbc40135 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -32,15 +32,15 @@ Future main() async { ]); await dotenv.load(fileName: ".env"); await GetStorage.init(); - final MainController mainController = Get.put(MainController(), permanent: true); await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, ); - mainController.checkVersion(); KakaoSdk.init(nativeAppKey: dotenv.env['NATIVE_APP_KEY']!); LocationService().initBackgroundLocation(); String initialRoute = await AuthService().isLogin() ? '/main' : '/permission'; + final MainController mainController = Get.put(MainController(), permanent: true); + mainController.checkVersion(); runApp( MyApp( initialRoute: initialRoute,