Closed dinonovak closed 2 years ago
Hi,
I am trying to add popups to already functioning map that is showing track. This is how markers are added to page. If I try to move to children: [] as widget markers are not shown on map
this is how page is rendered at the end. @override Widget build(BuildContext context) { return SafeArea( child: Scaffold( body: Column( children: <Widget>[ ElevatedButton( onPressed: getCurrentLocation, child: Text('current location'), ), Container( height: 700, child: FlutterMap( options: MapOptions( center: _center, zoom: 10.0, //onTap: (_, __) => _popupLayerController // .hideAllPopups(), // Hide popup when the map is tapped. plugins: [ ZoomButtonsPlugin(), ], ), mapController: _mapController, layers: [ TileLayerOptions( urlTemplate: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", subdomains: ['a', 'b', 'c'], ), PolylineLayerOptions( polylines: _polylines, ), PopupMarkerLayerOptions( popupController: _popupLayerController, markers: _markers, markerRotateAlignment: PopupMarkerLayerOptions.rotationAlignmentFor( AnchorAlign.top), popupBuilder: (BuildContext context, Marker marker) => ExamplePopup(marker), ), ], nonRotatedLayers: [ ZoomButtonsPluginOption( minZoom: 4, maxZoom: 19, mini: true, padding: 10, alignment: Alignment.bottomRight, ), ], ), ), ], ), ), ); }
@override Widget build(BuildContext context) { return SafeArea( child: Scaffold( body: Column( children: <Widget>[ ElevatedButton( onPressed: getCurrentLocation, child: Text('current location'), ), Container( height: 700, child: FlutterMap( options: MapOptions( center: _center, zoom: 10.0, //onTap: (_, __) => _popupLayerController // .hideAllPopups(), // Hide popup when the map is tapped. plugins: [ ZoomButtonsPlugin(), ], ), mapController: _mapController, layers: [ TileLayerOptions( urlTemplate: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", subdomains: ['a', 'b', 'c'], ), PolylineLayerOptions( polylines: _polylines, ), PopupMarkerLayerOptions( popupController: _popupLayerController, markers: _markers, markerRotateAlignment: PopupMarkerLayerOptions.rotationAlignmentFor( AnchorAlign.top), popupBuilder: (BuildContext context, Marker marker) => ExamplePopup(marker), ), ], nonRotatedLayers: [ ZoomButtonsPluginOption( minZoom: 4, maxZoom: 19, mini: true, padding: 10, alignment: Alignment.bottomRight, ), ], ), ), ], ), ), ); }
Sorry, issue with flutter_map version, all fixed
Hi,
I am trying to add popups to already functioning map that is showing track. This is how markers are added to page. If I try to move to children: [] as widget markers are not shown on map
this is how page is rendered at the end.
@override Widget build(BuildContext context) { return SafeArea( child: Scaffold( body: Column( children: <Widget>[ ElevatedButton( onPressed: getCurrentLocation, child: Text('current location'), ), Container( height: 700, child: FlutterMap( options: MapOptions( center: _center, zoom: 10.0, //onTap: (_, __) => _popupLayerController // .hideAllPopups(), // Hide popup when the map is tapped. plugins: [ ZoomButtonsPlugin(), ], ), mapController: _mapController, layers: [ TileLayerOptions( urlTemplate: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", subdomains: ['a', 'b', 'c'], ), PolylineLayerOptions( polylines: _polylines, ), PopupMarkerLayerOptions( popupController: _popupLayerController, markers: _markers, markerRotateAlignment: PopupMarkerLayerOptions.rotationAlignmentFor( AnchorAlign.top), popupBuilder: (BuildContext context, Marker marker) => ExamplePopup(marker), ), ], nonRotatedLayers: [ ZoomButtonsPluginOption( minZoom: 4, maxZoom: 19, mini: true, padding: 10, alignment: Alignment.bottomRight, ), ], ), ), ], ), ), ); }