mapbox-maps-flutter
mapbox-maps-flutter copied to clipboard
Can I have access to events like onMoveEnd?
I need to update the data on my map if it possible at the end of, for example, the camera movement, to avoid getting too much data from my API. I've already done this in web by using onDragEnd
but I can't find a simple way to do this in this plugin. I basically need something like these Events, or the equivalent for the camera position.
Is there a way to do this? I found mapboxMap.addListener()
but I'm not sure about how it works and if it can listen to those events.
I think you can do it with below code in latest version.
MapWidget (
onMapIdleListener : (mapIdleEventData) {
// any function
}
)
I think you can do it with below code in latest version.
MapWidget ( onMapIdleListener : (mapIdleEventData) { // any function } )
keep in mind that onMapIdleListener returns when the map is idle so when the map is loaded for the first time it will take some seconds to fire. Then when the scroll ends it will fire pretty fast.
Currently has a bug on Android devices that not trigger onMapIdleListener
when move camera
The README says that listening for events is supported, but it doesn't seem like so. I also need to be able to listen for events like touchstart, but I can't find a way to do it. Hopefully someone from Mapbox will help us.
I managed to implement a similar functionality by wrapping the MapWidget
in a GestureDetector
and using the coordinateForPixel
method.
I managed to implement a similar functionality by wrapping the
MapWidget
in aGestureDetector
and using thecoordinateForPixel
method.
can you sure sample code of how you implemented it?