flutter-mapbox-gl / maps

A Mapbox GL flutter package for creating custom maps
Other
1.04k stars 503 forks source link

How to draw a dotted line #1283

Closed MrLongg71 closed 1 year ago

MrLongg71 commented 1 year ago

How to draw a dotted line like this image: image

thanks!!!

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Diielle commented 1 year ago

Hi, try something like this:

final fills = {
      "type": "FeatureCollection",
      "features": [
        {
          "type": "Feature",
          "id": 15,
          "properties": <String, dynamic>{},
          "geometry": geometry,
        },
      ],
    };
// Add new source and lineLayer
await mapController.addSource(
    "fills", GeojsonSourceProperties(data: fills));
await mapController.addLineLayer(
  "fills",
  "lines",
  LineLayerProperties(
    lineDasharray: [
      Expressions.literal,
      [1, 2, 1]
    ],
    lineColor: Colors.blue.toHexStringRGB(),
    lineCap: "round",
    lineJoin: "round",
    lineWidth: 2,
  ),
);
stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.