liodali / osm_flutter

OpenStreetMap plugin for flutter
https://pub.dev/packages/flutter_osm_plugin
MIT License
232 stars 97 forks source link

onGeoPointClicked and onLocationChanged functions arent called when defined. #243

Open xyzbilal opened 2 years ago

xyzbilal commented 2 years ago

I dont know what is the problem but these functions doesnt called on OSMFlutter widget. what can be the problem? I edited _CustomPickerLocationState like below for my purpose. I m testing on IPhone simulator

OSMFlutter(
                  controller: widget.controller,
                  markerOption: widget.pickerConfig.advancedMarkerPicker != null
                      ? MarkerOption(
                          advancedPickerMarker:
                              widget.pickerConfig.advancedMarkerPicker,
                        )
                      : null,
                  isPicker: true,
                  mapIsLoading: widget.pickerConfig.loadingWidget,
                  stepZoom: widget.pickerConfig.stepZoom,
                  initZoom: widget.pickerConfig.initZoom,
                  minZoomLevel: widget.pickerConfig.minZoomLevel,
                  maxZoomLevel: widget.pickerConfig.maxZoomLevel,
                  onMapIsReady: widget.onMapReady,
                  onLocationChanged: (point){
                    print(point);
                  },
                  onGeoPointClicked: (point){
                    print(point);
                  },
                ),
liodali commented 2 years ago

if you create your own picker with custom behaviour remove isPicker:true

xyzbilal commented 2 years ago

I tried but it didnt work.

liodali commented 2 years ago

can provide me more detail about what you tring to do

chaiyonga commented 2 years ago

I had the same problem. onGeoPointClicked listener triggered when marker is clicked on Android but don't triggered on iOS.

liodali commented 2 years ago

ok i will check that

liodali commented 2 years ago

i check the problem i want to ask is that related to CustomPickerLocation or in generale cases ?

xyzbilal commented 2 years ago

I tried to debugprint onSinglePressMapClickListener, onGeoPointClickListener,onRegionIsChangingListener events. onSinglePressMapClickListeneris called when I clicked to map but others never called in osm_controller. I guess it is not related to CustomPickerLocation. As much as I see you are using methodchannel calls from native to flutter instead off Event channels but method calls doesnt called, I could not debug native side because I could not understand to concept exactly. Maybe native side debugging is needed. Also I wonder why isPicker should be false for these callback function runs.

liodali commented 2 years ago

because isPicker attribute made to lightweight access to osm_flutter widget if you want to make picker you just will get location but if you want to make picker with custom behaviour no need to make isPicker true