diff --git a/app/lib/pages/widgets/map_widget.dart b/app/lib/pages/widgets/map_widget.dart index b8708dc6836b53cd02838f4197cb6bce54eef85b..4379bbd6d9fb9679ed2c7dffc75a2698ff489730 100644 --- a/app/lib/pages/widgets/map_widget.dart +++ b/app/lib/pages/widgets/map_widget.dart @@ -3,7 +3,6 @@ import '../marker_handler/marker_data.dart'; import '../consts.dart'; import 'package:flutter_map/flutter_map.dart'; import 'package:latlong2/latlong.dart'; -import 'package:fl_chart/fl_chart.dart'; import 'quick_view_chart.dart'; import 'stat_charts.dart'; @@ -18,7 +17,7 @@ class MapContainerWidget extends StatefulWidget { class _MapContainerWidgetState extends State<MapContainerWidget> { - Measurement? selectedMarker; + Measurement? selectedMarker; // Containing data for selected marker bool isMinimized = true; // Quick view box state tacker bool satLayer = false; // Satellite layer visibility tracker @@ -138,7 +137,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { const SizedBox(height: contPadding), // Padding between containers ClipRRect( borderRadius: BorderRadius.circular(20), - child: Container( + child: SizedBox( width: screenWidth * boxWidth, height: screenWidth * boxHeight * 1.5, // NB: make dynamic child: Align( diff --git a/app/lib/pages/widgets/osm_map.dart b/app/lib/pages/widgets/osm_map.dart new file mode 100644 index 0000000000000000000000000000000000000000..ff89b3717c01baf154867e552ec2a85825ca28c0 --- /dev/null +++ b/app/lib/pages/widgets/osm_map.dart @@ -0,0 +1,42 @@ +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(), + ) + ], + ); + } +} diff --git a/app/lib/pages/widgets/sat_layer.dart b/app/lib/pages/widgets/sat_layer.dart new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391