account for changed itineraries once landmarks are marked as done or deleted

This commit is contained in:
2025-02-16 12:41:06 +01:00
parent 56c55883ea
commit 6f2f86f936
6 changed files with 135 additions and 110 deletions

View File

@@ -75,8 +75,16 @@ class Trip with ChangeNotifier {
notifyListeners();
}
void removeLandmark(Landmark landmark) {
void removeLandmark (Landmark landmark) async {
Landmark? previous = landmark.previous;
Landmark? next = landmark.next;
landmarks.remove(landmark);
// removing the landmark means we need to recompute the time between the two adjoined landmarks
if (previous != null && next != null) {
// previous.next = next happens automatically since we are using a LinkedList
previous.tripTime = null;
// TODO
}
notifyListeners();
}