我对使用dart的Google地图有一种奇怪的行为! here 如你所见,负责制作地图的链接出现是“Géolocalisation”,直到现在我没有问题!但是当我重新点击,或者当我访问另一个链接然后返回“Géo..”时它会给我this,我真的不知道该怎么办!这是我在GMap的第一次尝试,所以我需要一点点的帮助。 我必须提到,当我点击链接时页面不刷新它只删除容器div中的旧内容然后添加新元素我还必须提到我正在使用bootstrap3,这是页面géo的代码
import 'package:google_maps/google_maps.dart';
import '../view.dart';
import 'dart:html';
//view Map
class viewMap extends View{
panelCoreBuilder(){
//creating the container layout and it is a div row
DivElement layout = new DivElement()..className="row";
//adding a style element for the map element inside the container
layout.children.add(new StyleElement()..text="#mapblock{margin: 0;padding: 0; height: 500px; width: 100%;");
DivElement cellone = new DivElement()..className="col-md-3";
//naming the block that contains the map
DivElement celltow = new DivElement()..className="col-md-9"..id="mapblock";
//adding the cells to the layout
layout.children.addAll([cellone,celltow]);
//creating the map
visualRefresh = true;
final mapOptions = new MapOptions()
..zoom = 8
..center = new LatLng(34.034453, -5.885925)
..mapTypeId = MapTypeId.ROADMAP;
final map = new GMap(celltow, mapOptions);
//returning the layout to the MainContainer...
return layout;
}
}
所以我希望你能给我任何解决方案,假设,甚至是暗示 如果我喜欢解决方案,我会在这里发布!
答案 0 :(得分:2)
调用<div>
时,new GMap
可能会显示空白(或不显示)。默认情况下,地图不知道<div>
容器正在调整大小。当您在屏幕上显示resize
时,您必须手动触发event.trigger(map, 'resize', []);
事件:
{{1}}