show correct landmark types when fetching from api
All checks were successful
Build and push docker image / Build (pull_request) Successful in 1m42s
Build and release APK / Build APK (pull_request) Successful in 5m22s

This commit is contained in:
2024-08-06 14:34:12 +02:00
parent 89511f39cb
commit f71b9b19a6
5 changed files with 161 additions and 139 deletions

View File

@@ -3,12 +3,13 @@ import 'dart:convert';
import 'package:shared_preferences/shared_preferences.dart';
const LandmarkType museum = LandmarkType(name: 'Museum');
const LandmarkType monument = LandmarkType(name: 'Monument');
const LandmarkType park = LandmarkType(name: 'Park');
const LandmarkType restaurant = LandmarkType(name: 'Restaurant');
const LandmarkType shop = LandmarkType(name: 'Shop');
const LandmarkType sightseeing = LandmarkType(name: 'sightseeing');
const LandmarkType nature = LandmarkType(name: 'nature');
const LandmarkType shopping = LandmarkType(name: 'shopping');
// const LandmarkType museum = LandmarkType(name: 'Museum');
// const LandmarkType restaurant = LandmarkType(name: 'Restaurant');
const LandmarkType start = LandmarkType(name: 'start');
const LandmarkType finish = LandmarkType(name: 'finish');
final class Landmark extends LinkedListEntry<Landmark>{
@@ -55,7 +56,7 @@ final class Landmark extends LinkedListEntry<Landmark>{
'location': List<dynamic> location,
'type': String type,
}) {
// refine the parsing on a few
// refine the parsing on a few fields
List<double> locationFixed = List<double>.from(location);
// parse the rest separately, they could be missing
LandmarkType typeFixed = LandmarkType(name: type);
@@ -106,6 +107,14 @@ class LandmarkType {
// required this.description,
// required this.icon,
});
@override
bool operator ==(Object other) {
if (other is LandmarkType) {
return name == other.name;
} else {
return false;
}
}
}