ui improvements for trips and landmarks
This commit is contained in:
@@ -16,11 +16,15 @@ class Trip with ChangeNotifier {
|
||||
// could be empty as well
|
||||
|
||||
Future<String> get cityName async {
|
||||
List<double>? location = landmarks.firstOrNull?.location;
|
||||
if (GeocodingPlatform.instance == null) {
|
||||
return '${landmarks.first.location[0]}, ${landmarks.first.location[1]}';
|
||||
return '$location';
|
||||
} else if (location == null) {
|
||||
return 'Unknown';
|
||||
} else{
|
||||
List<Placemark> placemarks = await placemarkFromCoordinates(location[0], location[1]);
|
||||
return placemarks.first.locality ?? 'Unknown';
|
||||
}
|
||||
List<Placemark> placemarks = await placemarkFromCoordinates(landmarks.first.location[0], landmarks.first.location[1]);
|
||||
return placemarks.first.locality ?? 'Unknown';
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +60,11 @@ class Trip with ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void removeLandmark(Landmark landmark) {
|
||||
landmarks.remove(landmark);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
factory Trip.fromPrefs(SharedPreferences prefs, String uuid) {
|
||||
String? content = prefs.getString('trip_$uuid');
|
||||
Map<String, dynamic> json = jsonDecode(content!);
|
||||
|
Reference in New Issue
Block a user