TileLayerOptions constructor

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

Implementation

TileLayerOptions(
    {this.attributionAlignment = Alignment.bottomRight,
    this.attributionBuilder,
    Key? key,
    // TODO: make required
    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.placeholderImage,
    this.errorImage,
    this.tileProvider = const NonCachingNetworkTileProvider(),
    this.tms = false,
    // ignore: avoid_init_to_null
    this.wmsOptions = null,
    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)
    // TODO: change to Duration
    int updateInterval = 200,
    // Tiles fade in duration in milliseconds (default 100).  This can be set to
    // 0 to avoid fade in
    // TODO: change to Duration
    int tileFadeInDuration = 100,
    this.tileFadeInStart = 0.0,
    this.tileFadeInStartWhenOverride = 0.0,
    this.overrideTilesWhenUrlChanges = false,
    this.retinaMode = false,
    this.errorTileCallback,
    Stream<Null>? rebuild,
    this.templateFunction = util.template,
    this.tileBuilder,
    this.tilesContainerBuilder,
    this.evictErrorTileStrategy = EvictErrorTileStrategy.none,
    this.fastReplace = false,
    this.reset})
    : updateInterval =
          updateInterval <= 0 ? null : Duration(milliseconds: updateInterval),
      tileFadeInDuration = tileFadeInDuration <= 0
          ? null
          : Duration(milliseconds: 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.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,
      // copy additionalOptions Map if not null, so we can safely compare old
      // and new Map inside didUpdateWidget with MapEquality.
      additionalOptions = additionalOptions == null
          ? const <String, String>{}
          : Map.from(additionalOptions),
      super(key: key, rebuild: rebuild);