Skip to content
Snippets Groups Projects
Commit 645f1211 authored by Sara Savanovic Djordjevic's avatar Sara Savanovic Djordjevic
Browse files

update: make OSM widget stateftul

parent 66a8293d
No related branches found
No related tags found
1 merge request!16Clhp map into main
...@@ -4,7 +4,7 @@ import 'package:flutter_map/flutter_map.dart'; ...@@ -4,7 +4,7 @@ import 'package:flutter_map/flutter_map.dart';
import '../data_classes.dart'; import '../data_classes.dart';
class OSM extends StatelessWidget { class OSM extends StatefulWidget {
final List<Measurement> markerList; final List<Measurement> markerList;
const OSM({ const OSM({
...@@ -13,10 +13,17 @@ class OSM extends StatelessWidget { ...@@ -13,10 +13,17 @@ class OSM extends StatelessWidget {
}) : super(key: key); }) : super(key: key);
@override @override
Widget build(BuildContext context) { OSMState createState() => OSMState();
// Init list of polygons }
List<Polygon> polygons = [];
class OSMState extends State<OSM> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return FlutterMap( return FlutterMap(
options: MapOptions( options: MapOptions(
bounds: LatLngBounds( bounds: LatLngBounds(
...@@ -26,12 +33,9 @@ class OSM extends StatelessWidget { ...@@ -26,12 +33,9 @@ class OSM extends StatelessWidget {
), ),
children: [ children: [
TileLayer( TileLayer(
urlTemplate: "https://{s}.tile.openstreetmap.org/{z/{x}/{y}.png", urlTemplate: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
subdomains: const ['a', 'b', 'c'], subdomains: const ['a', 'b', 'c'],
), ),
PolygonLayer(
polygons: polygons, // Return map with list of polygons included
),
], ],
); );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment