Skip to content

[BUG] Vector Tiles without black background in FlutterMap() #124

Open

Description

@syzygyinteractivemedia

Package

flutter_map_maplibre

Bug Description

i'm having this styleMap:

{
      "version": 8,
      "glyphs": "https://maplibre.org/{fontstack}/{range}.pbf",
      "sources": {
        "openinframap-source": {
          "type": "vector",
          "tiles": ["https://openinframap.org/tiles/{z}/{x}/{y}.pbf"],
          "maxzoom": 14,
        },
      },
      "layers": [
        {
          "id": "background",
          "type": "background",
          "layout": {"visibility": "none"},
          "paint": {
              "background-color": "#000000", 
              "background-opacity": 0.0 
          },
        },
        {
          "id": "openinfra-power-lines",
          "type": "line",
          "source": "openinframap-source",
          "source-layer": "power_line",
          "paint": {"line-color": "#ff4500", "line-width": 2.0},
        },
        {
          "id": "openinfra-telecom",
          "type": "circle",
          "source": "openinframap-source",
          "source-layer": "telecoms_antenna",
          "paint": {"circle-color": "#5400ad", "circle-radius": 3, "circle-stroke-width": 0.5, "circle-stroke-color": "#ffffff"},
        },
      ],
    }

and i want to load it via :

final String rawJsonString = jsonEncode(styleMap);

 return FlutterMap(
    mapController: _mapController,
    options: const MapOptions(
      initialZoom: 4,
      initialCenter: LatLng(0, 0),
      maxZoom: 20,
      cameraConstraint: CameraConstraint.contain(
        bounds: LatLngBounds(
          const LatLng(-90, -180),
          const LatLng(90, 180),
        ),
      ),
    ),
    children: [
      MapLibreLayer(
        initStyle: rawJsonString,  // or via 'assets/maps/openinframap_style.json',
        children: [],
      ),
    ],
  );

i get a black background. so my other layers below are not visible anymore...

transparency is not working.. (Android)

Activity

  1. syzygyinteractivemedia commented on Oct 1, 2026

    @syzygyinteractivemedia
    Author

    the only way i could work around it for now is using a ColoredFiltered() widget around it...

    ColorFiltered(
            colorFilter: const ColorFilter.matrix(<double>[
              1.5, 0, 0, 0, -0.1,
              0, 1.5, 0, 0, -0.1,
              0, 0, 1.5, 0, -0.1,
              5.0, 5.0, 5.0, 0, -1.5,
            ]),
            child: MapLibreLayer(
              initStyle: rawJsonString, // 'assets/maps/openinframap_style.json',
              children: [],
            ),
          ),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions