Skip to content

Commit

Permalink
M3-209 Refactor : MapController와 MyPlaceController의 변수명, 함수명 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
qjvk2880 committed Aug 9, 2024
1 parent ab6a3cc commit e8dd99b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/controllers/map_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ class MapController extends SuperController {
WakelockPlus.disable();
}

Future<void> deleteLocalStorage(String place) async {
Future<void> deleteMyPlaceFromLocalStorage(String place) async {
await box.remove(place);
}
}
8 changes: 2 additions & 6 deletions lib/controllers/my_place_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class MyPlaceController extends GetxController {
mapStyle = await rootBundle.loadString(darkMapStylePath);
}

Future<void> writeLocalStorage(
Future<void> writeMyPlaceOnLocalStorage(
String place,
double latitude,
double longitude,
Expand All @@ -98,10 +98,6 @@ class MyPlaceController extends GetxController {
update();
}

Future<void> deleteLocalStorage(String place) async {
await box.remove(place);
}

openMyPlaceBottomSheet() {
bottomSheetController.minimize();
Get.bottomSheet(
Expand All @@ -112,7 +108,7 @@ class MyPlaceController extends GetxController {
);
}

void changePlace(int type) {
void changeSelectedPlace(int type) {
selectedPlace.value = type;
if (type == 0) {
myPlaceName.value = "HOME";
Expand Down
8 changes: 4 additions & 4 deletions lib/widgets/map/my_place_bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import '../../constants/app_colors.dart';
import '../../constants/text_styles.dart';
import '../../controllers/my_place_controller.dart';
import '../../service/my_place_service.dart';
import 'place_change_button.dart';
import 'place_change_toggle_button.dart';

// ignore: must_be_immutable
class MyPlaceBottomSheet extends StatelessWidget {
Expand Down Expand Up @@ -59,19 +59,19 @@ class MyPlaceBottomSheet extends StatelessWidget {
SizedBox(
height: 20,
),
PlaceChangeButton(),
PlaceChangeToggleButton(),
Spacer(),
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: InkWell(
borderRadius: BorderRadius.circular(16),
onTap: () async{
onTap: () async {
await myPlaceService.putMyPlaceInfo(
myPlaceController.myPlaceName.value,
myPlaceController.selectedLatitude.value,
myPlaceController.selectedLongitude.value,);

await myPlaceController.writeLocalStorage(
await myPlaceController.writeMyPlaceOnLocalStorage(
myPlaceController.myPlaceName.value,
myPlaceController.selectedLatitude.value,
myPlaceController.selectedLongitude.value,);
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/map/my_place_button_icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class MyPlaceButtonIcon extends StatelessWidget {
),
),
onPressed: () async {
mapController.deleteLocalStorage(place);
mapController.deleteMyPlaceFromLocalStorage(place);
mapController.myPlaceButtonVisible.value = false;
myPlaceService.deleteMyPlaceInfo(place);
Get.back();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import 'package:get/get.dart';
import '../../constants/app_colors.dart';
import '../../controllers/my_place_controller.dart';

class PlaceChangeButton extends StatelessWidget {
PlaceChangeButton({super.key});
class PlaceChangeToggleButton extends StatelessWidget {
PlaceChangeToggleButton({super.key});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -48,7 +48,7 @@ class PlaceChangeButton extends StatelessWidget {
);
},
borderWidth: 0.0,
onChanged: (i) => myPlaceController.changePlace(i),
onChanged: (i) => myPlaceController.changeSelectedPlace(i),
),
);
});
Expand Down

0 comments on commit e8dd99b

Please sign in to comment.