mapbox / mapbox-maps-flutter

Interactive, thoroughly customizable maps for Flutter powered by Mapbox Maps SDK
https://www.mapbox.com/mobile-maps-sdk
Other
285 stars 117 forks source link

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

Open bakaemon opened 11 months ago

bakaemon commented 11 months ago
  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.

fufylev commented 10 months ago

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

maxiggle commented 8 months ago

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

Mikecelium commented 8 months ago

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