Skip to content

GoogleMaps: Detect if camera move was started by user #50931

Description

@carlowenig

Hi there,

I'd like to detect if a camera move was started by the user by dragging the map.
Is there any implementation of this or any trick I could use to detect it?

I tied wrapping the GoogleMap widget inside a GestureDetector, but this does not seem to work, because the GestureDetector consumes the events, so they will not be propageted to the map widget.

As I have seen, there exists such a feature in the Android Maps SDK when using the onCameraMoveStarted callback. It contains a reason parameter which is REASON_GESTURE if the map was moved by a user gesture. If there's no other way, I would propose to add this feature.

Thanks!

Activity

  1. Pilaba commented on Feb 17, 2020

    @Pilaba

    Wrap the map in a Listener widget

            Listener(
                onPointerDown: (e) {
                  print("USER IS DRAGGING");
                  print(e);
                },
                child: GoogleMap(
                  compassEnabled: false,
                  myLocationButtonEnabled: false,
                  myLocationEnabled: true,
                  mapToolbarEnabled: false,
                  rotateGesturesEnabled: true,
                  minMaxZoomPreference: MinMaxZoomPreference.unbounded,
                  mapType: MapType.normal,
                  initialCameraPosition: CameraPosition( target: LatLng(19.2869271, -103.7435041), zoom: 14.4746 ),
                ),
            ),
    
  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    and removed on Feb 18, 2020
  3. carlowenig commented on Feb 19, 2020

    @carlowenig
    Author

    Works perfectly, thanks!

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Feb 19, 2020
  5. github-actions commented on Aug 22, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  6. locked as resolved and limited conversation to collaborators on Aug 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions