diff --git a/lib/pages/destination/destination_controller.dart b/lib/pages/destination/destination_controller.dart index 90ab589..2cda607 100644 --- a/lib/pages/destination/destination_controller.dart +++ b/lib/pages/destination/destination_controller.dart @@ -904,6 +904,11 @@ class DestinationController extends GetxController { indexController.loadLocationsBound(); } }); + centerMapToCurrentLocation(); + } + + void centerMapToCurrentLocation() { + indexController.mapController.move(LatLng(currentLat, currentLon), 17.0); } void connectionChanged(String val) { diff --git a/lib/widgets/map_widget.dart b/lib/widgets/map_widget.dart index bb55dae..ad909f1 100644 --- a/lib/widgets/map_widget.dart +++ b/lib/widgets/map_widget.dart @@ -176,10 +176,10 @@ class _MapWidgetState extends State { } void _centerMapOnUser() { - indexController.mapController.move( - LatLng( - destinationController.currentLat, destinationController.currentLon), - 17.0); + print("showBottomSheet ${destinationController.shouldShowBottomSheet}"); + if (destinationController.shouldShowBottomSheet) { + destinationController.centerMapToCurrentLocation(); + } } @override