UI-09: switch to CARTO dark map tiles with attribution and cache versioning

Replaces OSM's tan/cream default raster style with CARTO's "Dark Matter"
basemap (both RideMap and the route planner's independent TileLayer), so
the map itself looks like the dark mockups rather than a light basemap
under a dark overlay. Shares one urlTemplate/subdomains/maxNativeZoom
across both call sites instead of two independently-drifting copies.

Re-points the V3-11 tile cache at a versioned directory (tiles/carto_dark_v1)
since TileKey(z, x, y) carries no provider identity and would otherwise
silently serve stale tan tiles cached under the old scheme. Added a test
proving cache isolation holds across provider directories.

Adds a shared TileAttribution widget crediting both OpenStreetMap (CARTO's
style is still built from OSM data) and CARTO, composed into every map
rather than duplicated per screen -- OSM-only credit stopped being
sufficient once a second tile host entered the mix.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012Xki7YAcc2TiN2PRZJ2tXr
This commit is contained in:
2026-08-23 19:50:16 -05:00
parent 13017b8ee8
commit d3974eb4e1
6 changed files with 153 additions and 17 deletions

View File

@@ -203,7 +203,13 @@ const int defaultTileCacheMaxBytes = 200 * 1024 * 1024;
final tileCacheProvider = FutureProvider<TileCache>((ref) async {
final support = await getApplicationSupportDirectory();
final cache = FileTileCache(
directory: Directory('${support.path}/tiles'),
// UI-09: the subdirectory name doubles as the cache version. `TileKey(z, x, y)`
// carries no provider-specific data, so a cache built against OSM's tan tiles and
// one built against CARTO's dark tiles are indistinguishable to `FileTileCache`
// despite being visually incompatible -- switching tile URLs without also changing
// this path would silently serve stale, wrong-looking cached tiles under the new
// dark UI. Bump this suffix again if the tile source ever changes again.
directory: Directory('${support.path}/tiles/carto_dark_v1'),
maxBytes: defaultTileCacheMaxBytes,
);
ref.onDispose(cache.dispose);