Flutter_map: Dark / Night Mode support

Created on 22 Aug 2020  路  4Comments  路  Source: fleaflet/flutter_map

Add option for dark/night colors for the map.

Most helpful comment

I think you can apply styles on Vector tiles which isn't supported for this project: follow #716
If you are using Raster tiles then check your geoserver docs maybe it supports dark version of tiles or use #582 which can apply colorFIlter to tiles.

All 4 comments

I think you can apply styles on Vector tiles which isn't supported for this project: follow #716
If you are using Raster tiles then check your geoserver docs maybe it supports dark version of tiles or use #582 which can apply colorFIlter to tiles.

@palicka @maRci002 Yes, could be merged back. It is still open because of another suggestion.

Most map libraries offer the simple color inverse:

const ColorFilter invert = ColorFilter.matrix(<double>[
  -1,  0,  0, 0, 255,
   0, -1,  0, 0, 255,
   0,  0, -1, 0, 255,
   0,  0,  0, 1,   0,
]);

@mat8854 thanks for your response and for provided information 馃憤 . I'm using standard OSM tiles

TileLayerOptions(
            urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
            subdomains: ['a', 'b', 'c'])

which don't support different styles(at least I didn't find anything in docs) and unfortunately I can't use your commit as dependency, because I have other dependencies (map plugins) and it results in errors during build. The only solution, I guess, is to wait until it's merged to master. Thank you anyway.

If you are using MapBox as tile source you can create a second style with dark coloured map and then in your flutter app you can easilly switch between the two styles using the urlTemplate property of TileLayerOptions(). I implemented mine using Provider.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rktvsiim picture rktvsiim  路  5Comments

SamuelRioTz picture SamuelRioTz  路  4Comments

JonasVautherin picture JonasVautherin  路  4Comments

johnpryan picture johnpryan  路  4Comments

jacksos101 picture jacksos101  路  3Comments