mapbox-maps-flutter icon indicating copy to clipboard operation
mapbox-maps-flutter copied to clipboard

Can we have a nicer way to add click listener for annotations?

Open bakaemon opened this issue 1 year ago • 3 comments

  1. Instead of straight up doing the java way, implementing abstract classes for listener for annotations, why don't just use lambda since dart already supported much shorter syntax? Why would it have to be extra mile?
  2. It should be able to setup click listener on the annotation class itself. For example: It can be like this
final annotation = await circleAnnotationManager?.create(
              CircleAnnotationOptions(
                geometry: coordinate.toPoint().toJson(),
                circleRadius: 10,
                circleColor: Colors.orange.value,
              ),
);
annotation.setClickListener(() {
  //...
})

or like this:

final annotation = await circleAnnotationManager?.create(
              CircleAnnotationOptions(
                geometry: coordinate.toPoint().toJson(),
                circleRadius: 10,
                circleColor: Colors.orange.value,
                onClick: () {}
               ),
);
annotation.setClickListener(() {
  //...
})

This way it would be much nicer.

bakaemon avatar Dec 01 '23 10:12 bakaemon

Same point! Looking forward to smth like this!!!!

fufylev avatar Jan 08 '24 07:01 fufylev

@fufylev and @bakaemon , is there a way you properly render widgets on screen on annotation clicks?

maxiggle avatar Mar 01 '24 03:03 maxiggle

If possible it would also be amazing to be able to store some basic information either in the annotations or in an object attached to the annotations

Mikecelium avatar Mar 01 '24 18:03 Mikecelium