Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion flutter_map/lib/src/layer/tile_layer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class TileLayerOptions extends LayerOptions {
final double zoomOffset;
final List<String> subdomains;
final Color backgroundColor;
final bool offlineMode;

/// When panning the map, keep this many rows and columns of tiles before
/// unloading them.
Expand All @@ -38,6 +39,7 @@ class TileLayerOptions extends LayerOptions {
this.keepBuffer = 2,
this.backgroundColor = const Color(0xFFE0E0E0), // grey[300]
this.placeholderImage,
this.offlineMode = false,
});
}

Expand Down Expand Up @@ -374,7 +376,9 @@ class _TileLayerState extends State<TileLayer> {
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,
),
),
Expand Down