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

add: osm_map.dart and sat_layer.dart

parent e1e97656
No related branches found
No related tags found
1 merge request!2App2
...@@ -3,7 +3,6 @@ import '../marker_handler/marker_data.dart'; ...@@ -3,7 +3,6 @@ import '../marker_handler/marker_data.dart';
import '../consts.dart'; import '../consts.dart';
import 'package:flutter_map/flutter_map.dart'; import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart'; import 'package:latlong2/latlong.dart';
import 'package:fl_chart/fl_chart.dart';
import 'quick_view_chart.dart'; import 'quick_view_chart.dart';
import 'stat_charts.dart'; import 'stat_charts.dart';
...@@ -18,7 +17,7 @@ class MapContainerWidget extends StatefulWidget { ...@@ -18,7 +17,7 @@ class MapContainerWidget extends StatefulWidget {
class _MapContainerWidgetState extends State<MapContainerWidget> { class _MapContainerWidgetState extends State<MapContainerWidget> {
Measurement? selectedMarker; Measurement? selectedMarker; // Containing data for selected marker
bool isMinimized = true; // Quick view box state tacker bool isMinimized = true; // Quick view box state tacker
bool satLayer = false; // Satellite layer visibility tracker bool satLayer = false; // Satellite layer visibility tracker
...@@ -138,7 +137,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { ...@@ -138,7 +137,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
const SizedBox(height: contPadding), // Padding between containers const SizedBox(height: contPadding), // Padding between containers
ClipRRect( ClipRRect(
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
child: Container( child: SizedBox(
width: screenWidth * boxWidth, width: screenWidth * boxWidth,
height: screenWidth * boxHeight * 1.5, // NB: make dynamic height: screenWidth * boxHeight * 1.5, // NB: make dynamic
child: Align( child: Align(
......
import 'package:flutter/material.dart';
import '../marker_handler/marker_data.dart';
import '../consts.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';
class OSMmap extends StatelessWidget {
const OSMmap({super.key});
@override
Widget build(BuildContext context) {
return FlutterMap(
options: MapOptions(
center: mapCenter, // From consts
zoom: 9.0,
),
children: [
TileLayer( // Map from OpenStreetMap
urlTemplate: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
subdomains: const ['a', 'b', 'c'],
),
PolygonLayer( // Map each element in markerList to Measurement object
polygons: widget.markerList.map((Measurement measurement) {
return Polygon(
points: measurement.cornerList.map((Corner corner) {
// Map corner coordinates to LatLng objects
return LatLng(corner.latitude, corner.longitude);
}).toList(),
/*onTap: () {
setState(() {
selectedMarker = measurement;
});
},*/
color: Colors.blue,
isFilled: true,
);
}).toList(),
)
],
);
}
}
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