WebOsmController constructor
WebOsmController()
Implementation
WebOsmController() {
//createHtml(id: );
mapId++;
// ui.platformViewRegistry.registerViewFactory(
// FlutterOsmPluginWeb.getViewType(), (int viewId) => _div);
mapIdMixin = mapId;
_div = web.document.createElement('div')
as web.HTMLDivElement; //web.HTMLDivElement(); //html.DivElement()
_div.style.width = '100%';
_div.style.height = '100%';
ui.platformViewRegistry.registerViewFactory(
FlutterOsmPluginWeb.getViewType(mapId), (int viewId) {
debugPrint("viewId : $viewId");
_div.id = 'osm_map_$mapIdMixin';
final idFrame = "frame_map_$mapIdMixin";
debugPrint(idFrame);
_frame = web.document.createElement("iframe") as web.HTMLIFrameElement
..id = idFrame
..src =
"${kReleaseMode ? "assets/" : ''}packages/flutter_osm_web/src/asset/map.html"
..allow = "cross-origin-anonymous"
//..crossOrigin = "anonymous"
..style.width = '100%'
..style.height = '100%';
_div.appendChild(_frame!);
return _div;
});
}