Search code examples
flutterhere-apiheremaps

How to Attach a Pan Gesture Listener on Flutter HERE SDK?


I want to trigger else block in this method while the user is navigating the maps with the pan gesture.

  void setTracking(bool isTracking) {
    if (isTracking) {
      _visualNavigator.cameraMode = CameraTrackingMode.enabled;

    } else {
      _visualNavigator.cameraMode = CameraTrackingMode.disabled;
    }
  }

In this way, the user will be able to look at other places on the map while using the navigation. How can I do that?


Solution

  • Here is the solution;

     void _trackingOffOnPanGesture(){
        _hereMapController.gestures.panListener = PanListener((state, origin, translation, velocity) {
          _visualNavigator!.cameraMode = CameraTrackingMode.disabled;
        });
      }