2

我遇到了flutter_map的问题。我有自己的离线图块集(4 个缩放级别),我使用 Crs.Simple() 作为 crs。但是我遇到了在地图“结束”时点击和缩放时显示灰色区域的问题,如下所述:https ://github.com/fleaflet/flutter_map/issues/177 。

它与不随缩放级别而变化的 nePanBoundary 和 swPanBoundary 有关。

如果有人遇到同样的问题并成功解决,可以分享一下你的解决方案吗?谢谢!

```

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map/plugin_api.dart';
import 'package:latlong/latlong.dart';


class Map_Widget extends StatefulWidget {
  final String campus;
  final String building;
  final int floor;
  const Map_Widget ({ Key key, this.campus, this.building, this.floor }): super(key: key);
  @override
  _Map_WidgetState createState() => _Map_WidgetState();
}

class _Map_WidgetState extends State<Map_Widget> {

  
  @override
  Widget build(BuildContext context) {
    return FlutterMap(
        options: MapOptions(
          minZoom: 1,
          maxZoom: 4,
          zoom:1,
          crs: CrsSimple(),         
          swPanBoundary: LatLng(-1,0), //Here is the issue
          nePanBoundary: LatLng(0,1),  //Here is the issue
          center: LatLng(-0.5, 0.5),
        ),
        layers: [
          MarkerLayerOptions(
            markers: [
              Marker(
                width: 20.0,
                height: 20.0,
                point: new LatLng(-0.5, 0.5),
                builder: (context) =>
                    Container(
                      child: FlutterLogo(),
                    ),
              ),
            ],
          ),
        ],
        children: <Widget>[
          TileLayerWidget(options: TileLayerOptions (
                tileProvider: AssetTileProvider(),
                urlTemplate: 'assets/maps/${widget.campus}/${widget.building}/${widget.floor}/{z}/{x}/{y}.png',
          )),
          MarkerLayerWidget(options: MarkerLayerOptions(
            markers: [
              Marker(
              width: 20.0,
              height: 20.0,
              point: LatLng(0, 0),
              builder: (context) =>
              Container(
                child: FlutterLogo(),
                ),
              ),
              Marker(
                width: 20.0,
                height: 20.0,
                point: LatLng(-0.8, 0.75),
                builder: (context) =>
                    Container(
                      child: FlutterLogo(),
                    ),
              ),           

            ],
          )),
        ],
    );
  }
}


4

0 回答 0