Fix map edit not correct
This commit is contained in:
parent
d3dc6fdac1
commit
c880d43a35
@ -473,11 +473,15 @@ class _MapConfigState extends State<MapConfig> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
showNewOrUpdateGeoPoint(
|
showNewOrUpdateGeoPoint(
|
||||||
mapDTO,
|
mapDTO,
|
||||||
mapDTO.points![index],
|
pointsToShow[index],
|
||||||
(GeoPointDTO geoPoint) {
|
(GeoPointDTO geoPoint) {
|
||||||
setState(() {
|
setState(() {
|
||||||
mapDTO.points![index] = geoPoint;
|
var pointToUpdate = pointsToShow[index];
|
||||||
|
var pointToUpdateMapDTOPoints = mapDTO.points!.firstWhere((p) => p.longitude == pointToUpdate.longitude && p.latitude == pointToUpdate.latitude);
|
||||||
|
var mapDTOPointsIndex = mapDTO.points!.indexOf(pointToUpdateMapDTOPoints);
|
||||||
|
mapDTO.points![mapDTOPointsIndex] = pointToUpdate;
|
||||||
mapDTO.points!.sort((a, b) => a.title!.firstWhere((t) => t.language == 'FR').value!.toLowerCase().compareTo(b.title!.firstWhere((t) => t.language == 'FR').value!.toLowerCase()));
|
mapDTO.points!.sort((a, b) => a.title!.firstWhere((t) => t.language == 'FR').value!.toLowerCase().compareTo(b.title!.firstWhere((t) => t.language == 'FR').value!.toLowerCase()));
|
||||||
|
|
||||||
widget.onChanged(jsonEncode(mapDTO).toString());
|
widget.onChanged(jsonEncode(mapDTO).toString());
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -498,8 +502,7 @@ class _MapConfigState extends State<MapConfig> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
var pointToRemove = pointsToShow[index];
|
var pointToRemove = pointsToShow[index];
|
||||||
mapDTO.points = mapDTO.points!.where((p) => p.longitude != pointToRemove.longitude || p.latitude != p.latitude).toList();
|
mapDTO.points = mapDTO.points!.where((p) => p.longitude != pointToRemove.longitude && p.latitude != pointToRemove.latitude).toList();
|
||||||
|
|
||||||
pointsToShow.removeAt(index);
|
pointsToShow.removeAt(index);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user