working save and load functionality with custom datastructures
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:fast_network_navigation/structs/linked_landmarks.dart';
|
||||
import 'package:fast_network_navigation/structs/trip.dart';
|
||||
import 'package:fast_network_navigation/structs/landmark.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
@@ -18,27 +17,103 @@ Future<List<Trip>> loadTrips() async {
|
||||
}
|
||||
|
||||
if (trips.isEmpty) {
|
||||
String now = DateTime.now().toString();
|
||||
trips.add(
|
||||
Trip(uuid: '1', cityName: 'Paris (generated $now)', landmarks: LinkedList<Landmark>())
|
||||
Trip t1 = Trip(uuid: '1', cityName: 'Paris', landmarks: LinkedList<Landmark>());
|
||||
t1.landmarks.add(
|
||||
Landmark(
|
||||
uuid: '1',
|
||||
name: "Eiffel Tower",
|
||||
location: [48.859, 2.295],
|
||||
type: LandmarkType(name: "Tower"),
|
||||
imageURL: "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a8/Tour_Eiffel_Wikimedia_Commons.jpg/1037px-Tour_Eiffel_Wikimedia_Commons.jpg"
|
||||
),
|
||||
);
|
||||
// Trip(uuid: "1", cityName: "Paris", landmarks: [
|
||||
// Landmark(name: "Landmark 1", location: [48.85, 2.35], type: LandmarkType(name: "Type 1")),
|
||||
// Landmark(name: "Landmark 2", location: [48.86, 2.36], type: LandmarkType(name: "Type 2")),
|
||||
// Landmark(name: "Landmark 3", location: [48.75, 2.3], type: LandmarkType(name: "Type 3")),
|
||||
// Landmark(name: "Landmark 4", location: [48.9, 2.4], type: LandmarkType(name: "Type 4")),
|
||||
// Landmark(name: "Landmark 5", location: [48.91, 2.45], type: LandmarkType(name: "Type 5")),
|
||||
// ]));
|
||||
// trips.add(Trip(uuid: "2", cityName: "Vienna", landmarks: []));
|
||||
// trips.add(Trip(uuid: "3", cityName: "London", landmarks: []));
|
||||
// trips.add(Trip(uuid: "4", cityName: "Madrid", landmarks: []));
|
||||
// trips.add(Trip(uuid: "5", cityName: "Tokyo", landmarks: []));
|
||||
// trips.add(Trip(uuid: "6", cityName: "New York", landmarks: []));
|
||||
// trips.add(Trip(uuid: "7", cityName: "Los Angeles", landmarks: []));
|
||||
// trips.add(Trip(uuid: "8", cityName: "Zurich", landmarks: []));
|
||||
// trips.add(Trip(uuid: "9", cityName: "Orschwiller", landmarks: []));
|
||||
t1.landmarks.add(
|
||||
Landmark(
|
||||
uuid: "2",
|
||||
name: "Notre Dame Cathedral",
|
||||
location: [48.8530, 2.3498],
|
||||
type: LandmarkType(name: "Monument"),
|
||||
imageURL: "https://upload.wikimedia.org/wikipedia/commons/thumb/f/f7/Notre-Dame_de_Paris%2C_4_October_2017.jpg/440px-Notre-Dame_de_Paris%2C_4_October_2017.jpg"
|
||||
),
|
||||
);
|
||||
t1.landmarks.add(
|
||||
Landmark(
|
||||
uuid: "3",
|
||||
name: "Louvre palace",
|
||||
location: [48.8606, 2.3376],
|
||||
type: LandmarkType(name: "Museum"),
|
||||
imageURL: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/66/Louvre_Museum_Wikimedia_Commons.jpg/540px-Louvre_Museum_Wikimedia_Commons.jpg"
|
||||
),
|
||||
);
|
||||
t1.landmarks.add(
|
||||
Landmark(
|
||||
uuid: "4",
|
||||
name: "Pont-des-arts",
|
||||
location: [48.8585, 2.3376],
|
||||
type: LandmarkType(name: "Bridge"),
|
||||
imageURL: "https://upload.wikimedia.org/wikipedia/commons/thumb/d/d1/Pont_des_Arts%2C_6e_Arrondissement%2C_Paris_%28HDR%29_20140320_1.jpg/560px-Pont_des_Arts%2C_6e_Arrondissement%2C_Paris_%28HDR%29_20140320_1.jpg"
|
||||
),
|
||||
);
|
||||
t1.landmarks.add(
|
||||
Landmark(
|
||||
uuid: "5",
|
||||
name: "Panthéon",
|
||||
location: [48.847, 2.347],
|
||||
type: LandmarkType(name: "Monument"),
|
||||
imageURL: "https://upload.wikimedia.org/wikipedia/commons/thumb/8/80/Pantheon_of_Paris_007.JPG/1280px-Pantheon_of_Paris_007.JPG"
|
||||
),
|
||||
);
|
||||
trips.add(t1);
|
||||
|
||||
|
||||
Trip t2 = Trip(uuid: '2', cityName: 'Vienna', landmarks: LinkedList<Landmark>());
|
||||
|
||||
t2.landmarks.add(
|
||||
Landmark(
|
||||
uuid: '21',
|
||||
name: "St. Charles's Church",
|
||||
location: [48.1924563,16.3334399],
|
||||
type: LandmarkType(name: "Monument"),
|
||||
imageURL: "https://lh5.googleusercontent.com/p/AF1QipNNmA76Ps71NCL9rOOFoyheCEOyXWdHcUgQx9jd=w408-h305-k-no"
|
||||
),
|
||||
);
|
||||
t2.landmarks.add(
|
||||
Landmark(
|
||||
uuid: "22",
|
||||
name: "Vienna State Opera",
|
||||
location: [48.1949124,16.3483292],
|
||||
type: LandmarkType(name: "Culture"),
|
||||
imageURL: "https://lh5.googleusercontent.com/p/AF1QipMOx398kcoeDXFruSHNsb4lmZtdT8vibtK0cLi-=w408-h306-k-no"
|
||||
),
|
||||
);
|
||||
t2.landmarks.add(
|
||||
Landmark(
|
||||
uuid: "23",
|
||||
name: "Belvedere-Schlossgarten",
|
||||
location: [48.1956427,16.3711521],
|
||||
type: LandmarkType(name: "Nature"),
|
||||
imageURL: "https://lh5.googleusercontent.com/p/AF1QipNcI5LImH2Qdzx0GmF-5CY1wRKINFZ7HkahPEy1=w408-h306-k-no"
|
||||
),
|
||||
);
|
||||
t2.landmarks.add(
|
||||
Landmark(
|
||||
uuid: "24",
|
||||
name: "Kunsthistorisches Museum Wien",
|
||||
location: [48.2047501,16.3581904],
|
||||
type: LandmarkType(name: "Museum"),
|
||||
imageURL: "https://lh5.googleusercontent.com/p/AF1QipPuDu-kCCowO4TcawjziE8AhDVAANagVtRYBjlv=w408-h450-k-no"
|
||||
),
|
||||
);
|
||||
t2.landmarks.add(
|
||||
Landmark(
|
||||
uuid: "25",
|
||||
name: "Salztorbrücke",
|
||||
location: [48.2132382,16.369051],
|
||||
type: LandmarkType(name: "Bridge"),
|
||||
),
|
||||
);
|
||||
trips.add(t2);
|
||||
|
||||
}
|
||||
|
||||
return trips;
|
||||
}
|
||||
|
Reference in New Issue
Block a user