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';
import '../data_classes.dart';
class OSM extends StatelessWidget {
class OSM extends StatefulWidget {
final List<Measurement> markerList;
const OSM({
......@@ -13,10 +13,17 @@ class OSM extends StatelessWidget {
}) : super(key: key);
@override
Widget build(BuildContext context) {
// Init list of polygons
List<Polygon> polygons = [];
OSMState createState() => OSMState();
}
class OSMState extends State<OSM> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return FlutterMap(
options: MapOptions(
bounds: LatLngBounds(
......@@ -26,12 +33,9 @@ class OSM extends StatelessWidget {
),
children: [
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'],
),
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