答案 0 :(得分:2)
在GoogleMap对象上设置以下属性:
myLocationButtonEnabled: false,
myLocationEnabled: true,
使用google_maps_flutter:^ 0.5.13
答案 1 :(得分:0)
就目前的情况而言,这是不可能的,唯一可行的解决方法是设计您的UI以阻止它。
答案 2 :(得分:0)
我通过添加此功能解决了这个问题
void setInitialLocation() async {
currentLocation = await location.getLocation();
destinationLocation = LOC.LocationData.fromMap({
"latitude": currentLocation.latitude,
"longitude": currentLocation.longitude
});
CameraPosition cPosition = CameraPosition(
zoom: CAMERA_ZOOM,
tilt: CAMERA_TILT,
bearing: CAMERA_BEARING,
target: LatLng(currentLocation.latitude, currentLocation.longitude),
);
final GoogleMapController controller = await _controller.future;
controller
.animateCamera(CameraUpdate.newCameraPosition(cPosition))
.then((value) {
setState(() {
isCameraMoved = false;
});
});
}
并将此小部件添加到googleMap下的堆栈中:
Align(
alignment: Alignment.topRight,
child: Container(
height: 60,
width: 60,
padding: EdgeInsets.all(10.0),
child: FloatingActionButton(
backgroundColor: Colors.white,
heroTag: 'recenterr',
onPressed: () {
setInitialLocation();
},
child: Icon(
Icons.my_location,
color: Colors.grey,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
side: BorderSide(color: Color(0xFFECEDF1))),
),
),
),