diff --git a/flutter_map/lib/src/layer/tile_layer.dart b/flutter_map/lib/src/layer/tile_layer.dart index ed5487e9b..b7a6d542a 100644 --- a/flutter_map/lib/src/layer/tile_layer.dart +++ b/flutter_map/lib/src/layer/tile_layer.dart @@ -20,6 +20,7 @@ class TileLayerOptions extends LayerOptions { final double zoomOffset; final List subdomains; final Color backgroundColor; + final bool offlineMode; /// When panning the map, keep this many rows and columns of tiles before /// unloading them. @@ -38,6 +39,7 @@ class TileLayerOptions extends LayerOptions { this.keepBuffer = 2, this.backgroundColor = const Color(0xFFE0E0E0), // grey[300] this.placeholderImage, + this.offlineMode = false, }); } @@ -374,7 +376,9 @@ class _TileLayerState extends State { placeholder: options.placeholderImage != null ? options.placeholderImage : new MemoryImage(kTransparentImage), - image: new NetworkImage(getTileUrl(coords)), + image: options.offlineMode == true + ? new AssetImage(getTileUrl(coords)) + : new NetworkImage(getTileUrl(coords)), fit: BoxFit.fill, ), ),