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

add onCameraIdle method like google map #759

Closed
masoudpaidar opened this issue Oct 13, 2020 · 6 comments
Closed

add onCameraIdle method like google map #759

masoudpaidar opened this issue Oct 13, 2020 · 6 comments

Comments

@masoudpaidar
Copy link

There is onPositionChanged option in flutter_map but it gets called every time the position is changing, which is a lot. As soon as the user touched the screen, the onPositionChanged gets called until the user stops touching the screen,
but there is no option to call a method when camera movement has ended like a onCameraIdle in the google map

@maRci002
Copy link
Contributor

In #719 you can listen to events

  StreamSubscription<MapEvent> subscription;

  @override
  void initState() {
    super.initState();
    mapController = MapController();

    subscription = mapController.mapEventStream.listen(onMapEvent);
  }

  void onMapEvent(MapEvent mapEvent) {
    if (mapEvent is MapEventMoveEnd) {
      // do something
    }
  }

  @override
  void dispose() {
    subscription?.cancel();
    super.dispose();
  }

@masoudpaidar
Copy link
Author

HI @maRci002
but for this problem i don not know what is the MapEvent and when i use it i have a error can you explanation more pls?

@jiazeh
Copy link

jiazeh commented Dec 10, 2020

Hi @masoudpaidar You can check MapEvent on here and here

Hope it helps..

@maRci002
Copy link
Contributor

@jiazeh is right.

I'll soon finish that PR (little docs + fix when no event triggered when mapController.fitBounds called), I was a little busy :)

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Mar 21, 2021
@github-actions
Copy link

This issue was closed because it has been stalled for 5 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants