Flutter 将 tile 层添加到当前层
Flutter adding tile layer to current layer
我正在开发一个显示滑雪道和缆车的应用程序。我可以单独获得这些地图:
底图(我的主图)
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong/latlong.dart';
class SkiMapSection extends StatelessWidget {
const SkiMapSection({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Expanded(
child: new FlutterMap(
options: new MapOptions(
center: LatLng(40.58, 31.78),
minZoom: 10.0,
),
layers: [
TileLayerOptions(
urlTemplate:
"https://snowmap.fast-sfc.com/base_snow_map/{z}/{x}/{y}.png",
subdomains: ['a', 'b', 'c'],
),
],
),
);
}
}
对于滑雪道和升降机,我需要将 url模板: 更改为 https://snowmap.fast-sfc.com/pistes/{z}/{x}/{y}.png
但是我的目标是将 lift url 打印到底图上。我怎样才能做到这一点? Flutter 能做到吗?
干杯
最后,通过将滑雪道层的背景颜色设置为透明,我可以同时显示它们。
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong/latlong.dart';
class SkiMapSection extends StatelessWidget {
const SkiMapSection({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Expanded(
child: new FlutterMap(
options: new MapOptions(
center: LatLng(40.58, 31.78),
minZoom: 10.0,
),
layers: [
TileLayerOptions(
urlTemplate:
"https://snowmap.fast-sfc.com/base_snow_map/{z}/{x}/{y}.png",
//change base_snow_map to pistes
subdomains: ['a', 'b', 'c'],
),
TileLayerOptions(
urlTemplate:
"https://snowmap.fast-sfc.com/pistes/{z}/{x}/{y}.png",
//change base_snow_map to pistes
subdomains: ['a', 'b', 'c'],
backgroundColor: Colors.transparent),
],
),
);
}
}
我正在开发一个显示滑雪道和缆车的应用程序。我可以单独获得这些地图:
底图(我的主图)
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong/latlong.dart';
class SkiMapSection extends StatelessWidget {
const SkiMapSection({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Expanded(
child: new FlutterMap(
options: new MapOptions(
center: LatLng(40.58, 31.78),
minZoom: 10.0,
),
layers: [
TileLayerOptions(
urlTemplate:
"https://snowmap.fast-sfc.com/base_snow_map/{z}/{x}/{y}.png",
subdomains: ['a', 'b', 'c'],
),
],
),
);
}
}
对于滑雪道和升降机,我需要将 url模板: 更改为 https://snowmap.fast-sfc.com/pistes/{z}/{x}/{y}.png
但是我的目标是将 lift url 打印到底图上。我怎样才能做到这一点? Flutter 能做到吗?
干杯
最后,通过将滑雪道层的背景颜色设置为透明,我可以同时显示它们。
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong/latlong.dart';
class SkiMapSection extends StatelessWidget {
const SkiMapSection({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Expanded(
child: new FlutterMap(
options: new MapOptions(
center: LatLng(40.58, 31.78),
minZoom: 10.0,
),
layers: [
TileLayerOptions(
urlTemplate:
"https://snowmap.fast-sfc.com/base_snow_map/{z}/{x}/{y}.png",
//change base_snow_map to pistes
subdomains: ['a', 'b', 'c'],
),
TileLayerOptions(
urlTemplate:
"https://snowmap.fast-sfc.com/pistes/{z}/{x}/{y}.png",
//change base_snow_map to pistes
subdomains: ['a', 'b', 'c'],
backgroundColor: Colors.transparent),
],
),
);
}
}