Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
carlowenig opened this issue Feb 17, 2020 · 3 comments
Closed

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

carlowenig opened this issue Feb 17, 2020 · 3 comments

Comments

@carlowenig
Copy link

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!

@Pilaba
Copy link

Pilaba commented Feb 17, 2020

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 ),
            ),
        ),

@TahaTesser TahaTesser added waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds and removed created via support template labels Feb 18, 2020
@carlowenig
Copy link
Author

Works perfectly, thanks!

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants