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

update: map appearance

parent cece41dd
No related branches found
No related tags found
2 merge requests!9Clhp map,!8Clhp map
...@@ -3,6 +3,8 @@ import 'dart:typed_data'; ...@@ -3,6 +3,8 @@ import 'dart:typed_data';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_maps/maps.dart'; import 'package:syncfusion_flutter_maps/maps.dart';
import 'package:latlong2/latlong.dart';
import '../data_classes.dart'; import '../data_classes.dart';
/// A class containing thickness data for each subdivision of the map. /// A class containing thickness data for each subdivision of the map.
...@@ -38,6 +40,7 @@ class _ChoroplethMapState extends State<ChoroplethMap> { ...@@ -38,6 +40,7 @@ class _ChoroplethMapState extends State<ChoroplethMap> {
late MapShapeSource mapShapeSource; late MapShapeSource mapShapeSource;
late final MapZoomPanBehavior _zoomPanBehavior = MapZoomPanBehavior(); late final MapZoomPanBehavior _zoomPanBehavior = MapZoomPanBehavior();
List<SubDiv> subdivisions = <SubDiv>[]; List<SubDiv> subdivisions = <SubDiv>[];
int count = 0;
@override @override
...@@ -47,8 +50,25 @@ class _ChoroplethMapState extends State<ChoroplethMap> { ...@@ -47,8 +50,25 @@ class _ChoroplethMapState extends State<ChoroplethMap> {
for (Measurement measurement in widget.measurements) { for (Measurement measurement in widget.measurements) {
for (SubDiv subdivision in measurement.subDivs) { for (SubDiv subdivision in measurement.subDivs) {
subdivisions.add(subdivision); subdivisions.add(subdivision);
print("SubDivID: ${subdivision.sub_div_id}");
count++;
} }
}; };
// NB temporary filler
for (var i = count; i < 250; i++) {
SubDiv subdivision = SubDiv(
sub_div_id: i.toString(),
groupID: 0,
minThickness: 0.0,
avgThickness: 0.0,
center: LatLng(0.0, 0.0),
accuracy: 0.0,
color: Colors.grey,
savedColor: Colors.grey,
);
subdivisions.add(subdivision);
}
} }
@override @override
...@@ -61,13 +81,12 @@ class _ChoroplethMapState extends State<ChoroplethMap> { ...@@ -61,13 +81,12 @@ class _ChoroplethMapState extends State<ChoroplethMap> {
source: MapShapeSource.memory( // Map polygon source: MapShapeSource.memory( // Map polygon
widget.relation, // JSON coordinates from server widget.relation, // JSON coordinates from server
shapeDataField: 'sub_div_id', shapeDataField: 'sub_div_id',
dataCount: widget.measurements.length, dataCount: 250,
primaryValueMapper: (int index) => subdivisions[index].sub_div_id, primaryValueMapper: (int index) => subdivisions[index].sub_div_id,
shapeColorValueMapper: (int index) => subdivisions[index].color, shapeColorValueMapper: (int index) => subdivisions[index].color,
), ),
//color: Colors.blue.shade400, // Map color
zoomPanBehavior: _zoomPanBehavior, zoomPanBehavior: _zoomPanBehavior,
strokeColor: Colors.black, strokeColor: Colors.blue.shade50,
// Shape selection // Shape selection
selectedIndex: selectedIndex, selectedIndex: selectedIndex,
onSelectionChanged: (int index) { onSelectionChanged: (int index) {
...@@ -79,11 +98,6 @@ class _ChoroplethMapState extends State<ChoroplethMap> { ...@@ -79,11 +98,6 @@ class _ChoroplethMapState extends State<ChoroplethMap> {
}); });
widget.onSelectionChanged(selectedIndex); widget.onSelectionChanged(selectedIndex);
}, },
selectionSettings: MapSelectionSettings(
color: Colors.orange,
strokeColor: Colors.red[900],
strokeWidth: 3,
),
), ),
], ],
), ),
......
...@@ -152,7 +152,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { ...@@ -152,7 +152,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
'${lastUpdate?.hour}:${lastUpdate?.minute}' : '${lastUpdate?.hour}:${lastUpdate?.minute}' :
'${lastUpdate?.day}-${lastUpdate?.month}-${lastUpdate?.year}') : ''}', '${lastUpdate?.day}-${lastUpdate?.month}-${lastUpdate?.year}') : ''}',
style: GoogleFonts.dmSans( style: GoogleFonts.dmSans(
fontSize: 13, fontSize: 14,
color: Colors.black, color: Colors.black,
), ),
), ),
......
No preview for this file type
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