Manage actions on a marker with flutter_map 6.1.0

35 Views Asked by At

I cannot perform actions on my markers. I would like to be able to open a popup when clicked. I cannot use version 3. I am unable to implement GestureDetector and I cannot find a compatible module with version 6. Here is my collection of markers:

allMarkers.add(
  Marker(
    point: LatLng(poi.lat, poi.longi),
    height: 12,
    width: 12,
    child: ColoredBox(color: Colors.blue[900]!),
  )
);

And here is my map:

FlutterMap(
  mapController: _mapController,
  options: const MapOptions(
    initialCenter: LatLng(46.322749002340636, -0.46578249554813433),
    initialZoom: 10,
  ),
  children: [
    TileLayer(
      urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
      userAgentPackageName: 'com.example.app',
    ),
    PolylineLayer(
      polylines: lstPolygone ,
    ),
    MarkerLayer(
      markers: allMarkers.take(allMarkers.length).toList()
    ),
  ],
);

And here are the versions of my libraries:

cupertino_icons: ^1.0.2
http: ^1.2.0
flutter_map: ^6.1.0
latlong2: ^0.9.0
geoxml: ^2.6.1
cached_network_image: ^3.3.1
provider: ^6.1.2
path: ^1.8.3
sqflite: ^2.3.2
connectivity_checker: ^1.1.0
flutter_html: ^3.0.0-beta.2

I tried to downgrade the version of flutter_map to access the builder in the marker, but it is incompatible. I tried to create widgets in the child to have a GestureDetector, I tried to add an onTap but nothing works

0

There are 0 best solutions below