Newaj
Newaj

Reputation: 4448

Unable to drag marker on google map in flutter

I'm using google_maps_flutter: ^0.5.24+1 plugin. I can't drag the marker inside map even though draggable property is set true. Whats wrong here? My code :

                return GoogleMap(
                  initialCameraPosition: CameraPosition(
                    target: LatLng(placemark.position.latitude,
                        placemark.position.longitude),
                    zoom: 18,
                  ),
                  markers: Set<Marker>.of(
                    <Marker> [
                      Marker(
                        markerId: MarkerId("home"),
                        position: LatLng(placemark.position.latitude, placemark.position.longitude),
                        icon: BitmapDescriptor.defaultMarker,
                        infoWindow: InfoWindow(
                          title: placemark.name
                        ),
                        draggable: true,
                      ),
                    ]
                  ),
                  onMapCreated: (mapController) {
                    googleMapController = mapController;
                  },
                );

Upvotes: 2

Views: 3153

Answers (1)

Omatt
Omatt

Reputation: 10529

You need to long press the Marker to trigger the drag event. To debug, you can use the onDrag() property to see if the drag event has been started.

Upvotes: 3

Related Questions