ui improvements for trips and landmarks
This commit is contained in:
@@ -3,6 +3,14 @@ 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');
|
||||
|
||||
|
||||
final class Landmark extends LinkedListEntry<Landmark>{
|
||||
// A linked node of a list of Landmarks
|
||||
final String uuid;
|
||||
@@ -55,11 +63,12 @@ final class Landmark extends LinkedListEntry<Landmark>{
|
||||
final imageURL = json['image_url'] as String?;
|
||||
final description = json['description'] as String?;
|
||||
var duration = Duration(minutes: json['duration'] ?? 0) as Duration?;
|
||||
if (duration == const Duration()) {duration = null;};
|
||||
// if (duration == const Duration()) {duration = null;};
|
||||
final visited = json['visited'] as bool?;
|
||||
var tripTime = Duration(minutes: json['time_to_reach_next'] ?? 0) as Duration?;
|
||||
|
||||
return Landmark(
|
||||
uuid: uuid, name: name, location: locationFixed, type: typeFixed, isSecondary: isSecondary, imageURL: imageURL, description: description, duration: duration, visited: visited);
|
||||
uuid: uuid, name: name, location: locationFixed, type: typeFixed, isSecondary: isSecondary, imageURL: imageURL, description: description, duration: duration, visited: visited, tripTime: tripTime);
|
||||
} else {
|
||||
throw FormatException('Invalid JSON: $json');
|
||||
}
|
||||
@@ -81,7 +90,8 @@ final class Landmark extends LinkedListEntry<Landmark>{
|
||||
'image_url': imageURL,
|
||||
'description': description,
|
||||
'duration': duration?.inMinutes,
|
||||
'visited': visited
|
||||
'visited': visited,
|
||||
'trip_time': tripTime?.inMinutes,
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user