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
onMoveStart onMoveEnd implementation #148
Comments
+1, I'd like to see this feature |
I need something like that too. I want to fetch some data from the server according to the map position every time the map stop moving. |
I know the issue has been open for a while, yet I allow myself to post my onMoveEnd workaround here, hoping to save time for the ones having a similar problem in the future :) So in my case I'm using Timer to detect when the position hasn't changed for a while. First, I create a variable to store my Timer: Timer _mapMovementTimer; Then, within the onPositionChanged callback: onPositionChanged: (MapPosition position, bool hasGesture, bool fromUser) {
if(_mapMovementTimer != null)
_mapMovementTimer.cancel();
_mapMovementTimer = Timer(Duration(milliseconds: 750), () {
// Here, the map didn't moved for 750ms
BlocProvider.of<PointsBloc>(context).requestPointsInZone(position.bounds);
});
}, The counter is canceled and restarted each time the user pan or zoom the map. If onPositionChanged callback is not called for 750ms (if the map didn't moved), then I request my points in the given zone. You can change the Duration of the Timer to have a quicker/slower reaction. |
+1 |
I did not understand exactly what John has suggested, but maybe you guys can help: |
The problem with this solution comes when you want to center the map again and the user is still touching the screen but not moving the map. |
I ended up using the following workaround, maybe it works for you as well:
|
Check out: #719
|
Hello again,
There are two map event leaflet js on the map - onMoveStart and onMoveEnd.
Because i'm using big DB - about two dozen M markers i use them in them web client to get an initial bounds and zoom before drag and at the end to call backend and get lists with the markers that have to stay, be removed from the memory or add to the new screen.
Is there a chance to have these events "from the box" with callback at the map that of course to be corresponded with the mapcontroller for zoom and move or should be better to implement workaround monkey job wrap with gesturedetector using onDrag events?
have some relation to https://github.com/apptreesoftware/flutter_map/issues/138 but move and zoom are required too.
The text was updated successfully, but these errors were encountered: