rorystephenson / flutter_map_marker_popup

Popups for flutter_map markers
BSD 3-Clause "New" or "Revised" License
103 stars 84 forks source link

Popup.mapXXX and Mapcontroller.move #28

Closed berkayoruc closed 3 years ago

berkayoruc commented 3 years ago

Hi guys. If popup snap on map and popup ontap runs mapcontroller.move function, after that I cannot move anywhere on map. Did you ever face this problem?

rorystephenson commented 3 years ago

Hi @berkayoruc, no I haven't had this problem. If you give a minimal example that demonstrates the issues I can have a look.

berkayoruc commented 3 years ago

You can see the code here.

rorystephenson commented 3 years ago

Thanks @berkayoruc . So changing state (by calling mapcontroller.move) should not be done in a builder. It should happen as a result of a tap or something else since otherwise you can end up in a build loop which is possibly what's happening here: the popup builds which calls move and thus the popup builds again and calls move again etc etc.

Can you describe what functionality you're hoping to achieve? Maybe that the map moves to the marker when the marker is tapped?

berkayoruc commented 3 years ago

Oh, thank you for explanation. I want to change center of map to tapped marker coordinates.

rorystephenson commented 3 years ago

No problem :). I've just uploaded a new version (1.0.1) which adds a new option, markerCenterAnimation. For backwards compatibility the markers are not centered on tap by default, so you just need to add that option as follows:

PopupMarkerLayerWidget(
  options: PopupMarkerLayerOptions(
    markerCenterAnimation: MarkerCenterAnimation(), // Note: You can specify a custom duration/curve if you want
    // ...
  ),
  // ...
)
berkayoruc commented 3 years ago

So, we can close issue. Thak you so much😄