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

update: selectedMarker initialisation

parent e8840ed5
No related branches found
No related tags found
1 merge request!2App2
......@@ -7,6 +7,9 @@ import 'sat_layer.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';
/// MapContainerWidget is the main widget that contains the map with all
/// its layers, polygons and markers.
class MapContainerWidget extends StatefulWidget {
final List<Measurement> markerList;
......@@ -24,6 +27,8 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
@override
Widget build(BuildContext context) {
// Initialise selectedMarker to first element in markerList
selectedMarker ??= widget.markerList[0];
const double contPadding = 30; // Container padding space
......@@ -95,7 +100,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
return Marker(
width: 50,
height: 50, // NB: temporary point value
height: 50,
point: point(corners),
builder: (ctx) => GestureDetector(
onTap: () {
......@@ -178,7 +183,6 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
setState(() {
satLayer = !satLayer; // Toggle satellite layer state on press
});
print("satLayer? : $satLayer");
},
child: Container(
padding: const EdgeInsets.all(8),
......@@ -211,9 +215,18 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
style: titleStyle,
),
Text(
'Time of measurement: ${selectedMarker?.timeMeasured}',
'Time of measurement',
style: regTextStyle,
),
Text(
'Date ${(selectedMarker?.timeMeasured.day ?? '-')}/${(selectedMarker?.timeMeasured.month ?? '-')}/${(selectedMarker?.timeMeasured.year ?? '-')}',
style: regTextStyle,
),
Text(
'Time: ${selectedMarker?.timeMeasured.hour}:00',
style: regTextStyle,
),
const SizedBox(height: contPadding),
Text(
'Location: (placeholder, placeholder)',
style: regTextStyle,
......
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