TileLayerOptions constructor

TileLayerOptions({
  1. Key? key,
  2. String? urlTemplate,
  3. double tileSize = 256.0,
  4. double minZoom = 0.0,
  5. double maxZoom = 18.0,
  6. double? minNativeZoom,
  7. double? maxNativeZoom,
  8. bool zoomReverse = false,
  9. double zoomOffset = 0.0,
  10. Map<String, String>? additionalOptions,
  11. List<String> subdomains = const <String>[],
  12. int keepBuffer = 2,
  13. Color backgroundColor = const Color(0xFFE0E0E0),
  14. ImageProvider<Object>? errorImage,
  15. TileProvider? tileProvider,
  16. bool tms = false,
  17. WMSTileLayerOptions? wmsOptions,
  18. double opacity = 1.0,
  19. Duration updateInterval = const Duration(milliseconds: 200),
  20. Duration tileFadeInDuration = const Duration(milliseconds: 100),
  21. double tileFadeInStart = 0.0,
  22. double tileFadeInStartWhenOverride = 0.0,
  23. bool overrideTilesWhenUrlChanges = false,
  24. bool retinaMode = false,
  25. ErrorTileCallBack? errorTileCallback,
  26. Stream<void>? rebuild,
  27. TemplateFunction templateFunction = util.template,
  28. TileBuilder? tileBuilder,
  29. TilesContainerBuilder? tilesContainerBuilder,
  30. EvictErrorTileStrategy evictErrorTileStrategy = EvictErrorTileStrategy.none,
  31. bool fastReplace = false,
  32. Stream<void>? reset,
  33. LatLngBounds? tileBounds,
  34. String userAgentPackageName = 'unknown',
})

Implementation

TileLayerOptions({
  Key? key,
  this.urlTemplate,
  double tileSize = 256.0,
  double minZoom = 0.0,
  double maxZoom = 18.0,
  this.minNativeZoom,
  this.maxNativeZoom,
  this.zoomReverse = false,
  double zoomOffset = 0.0,
  Map<String, String>? additionalOptions,
  this.subdomains = const <String>[],
  this.keepBuffer = 2,
  this.backgroundColor = const Color(0xFFE0E0E0),
  this.errorImage,
  TileProvider? tileProvider,
  this.tms = false,
  this.wmsOptions,
  this.opacity = 1.0,

  /// Tiles will not update more than once every `updateInterval` milliseconds
  /// (default 200) when panning. It can be 0 (but it will calculating for
  /// loading tiles every frame when panning / zooming, flutter is fast) This
  /// can save some fps and even bandwidth (ie. when fast panning / animating
  /// between long distances in short time)
  Duration updateInterval = const Duration(milliseconds: 200),
  Duration tileFadeInDuration = const Duration(milliseconds: 100),
  this.tileFadeInStart = 0.0,
  this.tileFadeInStartWhenOverride = 0.0,
  this.overrideTilesWhenUrlChanges = false,
  this.retinaMode = false,
  this.errorTileCallback,
  Stream<void>? rebuild,
  this.templateFunction = util.template,
  this.tileBuilder,
  this.tilesContainerBuilder,
  this.evictErrorTileStrategy = EvictErrorTileStrategy.none,
  this.fastReplace = false,
  this.reset,
  this.tileBounds,
  String userAgentPackageName = 'unknown',
})  : updateInterval =
          updateInterval <= Duration.zero ? null : updateInterval,
      tileFadeInDuration =
          tileFadeInDuration <= Duration.zero ? null : tileFadeInDuration,
      assert(tileFadeInStart >= 0.0 && tileFadeInStart <= 1.0),
      assert(tileFadeInStartWhenOverride >= 0.0 &&
          tileFadeInStartWhenOverride <= 1.0),
      maxZoom =
          wmsOptions == null && retinaMode && maxZoom > 0.0 && !zoomReverse
              ? maxZoom - 1.0
              : maxZoom,
      minZoom =
          wmsOptions == null && retinaMode && maxZoom > 0.0 && zoomReverse
              ? math.max(minZoom + 1.0, 0)
              : minZoom,
      zoomOffset = wmsOptions == null && retinaMode && maxZoom > 0.0
          ? (zoomReverse ? zoomOffset - 1.0 : zoomOffset + 1.0)
          : zoomOffset,
      tileSize = wmsOptions == null && retinaMode && maxZoom > 0.0
          ? (tileSize / 2.0).floorToDouble()
          : tileSize,
      additionalOptions = additionalOptions == null
          ? const <String, String>{}
          : Map.from(additionalOptions),
      tileProvider = tileProvider == null
          ? NetworkNoRetryTileProvider(
              headers: {'User-Agent': 'flutter_map ($userAgentPackageName)'},
            )
          : (tileProvider
            ..headers = <String, String>{
              ...tileProvider.headers,
              if (!tileProvider.headers.containsKey('User-Agent'))
                'User-Agent': 'flutter_map ($userAgentPackageName)',
            }),
      super(key: key, rebuild: rebuild);