WebOsmController constructor

WebOsmController()

Implementation

WebOsmController() {
  //createHtml(id: );
  mapId++;
  _div = html.DivElement()
    ..style.width = '100%'
    ..style.height = '100%';
  // ui.platformViewRegistry.registerViewFactory(
  //     FlutterOsmPluginWeb.getViewType(), (int viewId) => _div);
  mapIdMixin = mapId;
  ui.platformViewRegistry.registerViewFactory(
      FlutterOsmPluginWeb.getViewType(mapId), (int viewId) {
    debugPrint("viewId : $viewId");
    _div.id = 'osm_map_$mapIdMixin';
    final idFrame = "frame_map_$mapIdMixin";
    debugPrint(idFrame);
    _frame = html.IFrameElement()
      ..id = idFrame
      ..src =
          "${kReleaseMode ? "assets/" : ''}packages/flutter_osm_web/src/asset/map.html"
      ..style.width = '100%'
      ..style.height = '100%';
    _div.append(_frame!);
    return _div;
  });
}