osm_flutter
osm_flutter copied to clipboard
Possible to implement drop pin feature ?
Currently, to pick a location I am using your showSimplePickerLocation
widget, However, is it possible to use it from the OSMflutter
widget itself as I have to open two different screens? sth like this? https://pub.dev/packages/map_pin_picker
yeah you can open two different screen and each screen contain its own OSMFlutter
I meant in one screen. In osmflutter only. I dont want to open two screen. I want to use the picker in osmflutter widget as it takes time to load the map everytime I use mappicker.. Is that possible or if u could tell how I could do it. I will try it out.
i think to implemented you need some other feature should be add it to plugin like getGeoPointCenter() direclty
i will make more reseach about what mappicker propose to see how i can help you to acheive that
i think you can use pickerMapController and change isPicker
OSMFlutter to true
and the icon make it invisible or empty widget like SizedBox.shrink()
and use method of pickerMapController to getCenterPosition
This, is what I want to achieve , Now in my
OSMFlutter
widget, I can get the MapPicker,
child: MapPicker(
iconWidget: Icon(
Icons.location_pin,
size: 30,
color: Colors.red,
),
//add map picker controller
mapPickerController: mapPickerController,
child: (OSMFlutter(
key: _mapKey,
controller: osmController,
staticPoints: [
StaticPositionGeoPoint(
driverKey,
MarkerIcon(
//icon: null,
icon: Icon(Icons.star),
),
[GeoPoint(latitude: driverLat, longitude: driverLon)],
),
],
//currentLocation: false,
road: Road(
startIcon: MarkerIcon(
icon: Icon(
Icons.pin_drop,
size: 64,
color: Colors.green,
),
),
roadColor: Colors.yellowAccent,
),
markerOption: MarkerOption(
defaultMarker: MarkerIcon(
icon: Icon(null
//Icons.star_half_rounded,
//color: Colors.blue,
//size: 56,
),
)),
)),
),
but to get the MapPicker
working I need these three functions
onCameraMoveStarted: () {
// notify map is moving
mapPickerController.mapMoving();
},
onCameraMove: (cameraPosition) {
this.cameraPosition = cameraPosition;
},
onCameraIdle: () async {
// notify map stopped moving
mapPickerController.mapFinishedMoving();
//get address name from camera position
List<Address> addresses = await Geocoder.local
.findAddressesFromCoordinates(Coordinates(
cameraPosition.target.latitude,
cameraPosition.target.longitude));
// update the ui with the address
textController.text='${addresses.first?.addressLine ?? ''}';
},
I know you are busy, if you can give me few suggestion then I will work on it.
yeah i should add onCameraMoveStarted,onCameraIdle but implementing onCameraIdle will be tricky on the android side
i can add getCenterPosition and you can compare between current value and previous to start or finishMoving
Okay! That would be great!
try to put isPicker in OSMFlutter to true and use PickerMapController as Controller
and use this method getCurrentPositionAdvancedPositionPicker
to get centerGeoPoint for comparaison between previous and current geoPoint
and for icon use any icon with transparent color or withOpacity(0) to make it invisible and size equal to 0
Oh! That should work I think. I will give it a try. Thank you.