location picker and ui fixes #17
| @@ -42,7 +42,25 @@ class _BasePageState extends State<BasePage> { | |||||||
|      |      | ||||||
|      |      | ||||||
|     if (widget.mainScreen == "map") { |     if (widget.mainScreen == "map") { | ||||||
|       currentView = TripPage(trip: widget.trip ?? getFirstTrip(trips)); |       if (widget.trip != null) { | ||||||
|  |         currentView = TripPage(trip: widget.trip!); | ||||||
|  |       } else { | ||||||
|  |         currentView = FutureBuilder( | ||||||
|  |           future: trips, | ||||||
|  |           builder: (context, snapshot) { | ||||||
|  |             if (snapshot.hasData) { | ||||||
|  |               List<Trip> availableTrips = snapshot.data!; | ||||||
|  |               if (availableTrips.isNotEmpty) { | ||||||
|  |                 return TripPage(trip: availableTrips[0]); | ||||||
|  |               } else { | ||||||
|  |                 return Text("Wow, so empty!"); | ||||||
|  |               } | ||||||
|  |             } else { | ||||||
|  |               return const Text("loading..."); | ||||||
|  |             } | ||||||
|  |           }, | ||||||
|  |         ); | ||||||
|  |       } | ||||||
|     } else if (widget.mainScreen == "tutorial") { |     } else if (widget.mainScreen == "tutorial") { | ||||||
|       currentView = TutorialPage(); |       currentView = TutorialPage(); | ||||||
|     } else if (widget.mainScreen == "profile") { |     } else if (widget.mainScreen == "profile") { | ||||||
| @@ -134,72 +152,3 @@ class _BasePageState extends State<BasePage> { | |||||||
|     ); |     ); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| // This function is used to get the first trip from a list of trips |  | ||||||
| // TODO: Implement this function |  | ||||||
| Trip getFirstTrip(Future<List<Trip>> trips) { |  | ||||||
|   Trip t1 = Trip(uuid: '1', landmarks: LinkedList<Landmark>()); |  | ||||||
|   t1.landmarks.add( |  | ||||||
|     Landmark( |  | ||||||
|       uuid: '0', |  | ||||||
|       name: "Start", |  | ||||||
|       location: [48.85, 2.32], |  | ||||||
|       type: start, |  | ||||||
|     ), |  | ||||||
|   ); |  | ||||||
|   t1.landmarks.add( |  | ||||||
|     Landmark( |  | ||||||
|       uuid: '1', |  | ||||||
|       name: "Eiffel Tower", |  | ||||||
|       location: [48.859, 2.295], |  | ||||||
|       type: sightseeing, |  | ||||||
|       imageURL: "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a8/Tour_Eiffel_Wikimedia_Commons.jpg/1037px-Tour_Eiffel_Wikimedia_Commons.jpg" |  | ||||||
|     ), |  | ||||||
|   ); |  | ||||||
|   t1.landmarks.add( |  | ||||||
|     Landmark( |  | ||||||
|       uuid: "2", |  | ||||||
|       name: "Notre Dame Cathedral", |  | ||||||
|       location: [48.8530, 2.3498], |  | ||||||
|       type: sightseeing, |  | ||||||
|       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: sightseeing, |  | ||||||
|       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: sightseeing, |  | ||||||
|       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: sightseeing, |  | ||||||
|       imageURL: "https://upload.wikimedia.org/wikipedia/commons/thumb/8/80/Pantheon_of_Paris_007.JPG/1280px-Pantheon_of_Paris_007.JPG" |  | ||||||
|     ), |  | ||||||
|   ); |  | ||||||
|   t1.landmarks.add( |  | ||||||
|     Landmark( |  | ||||||
|       uuid: "6", |  | ||||||
|       name: "Galeries Lafayette", |  | ||||||
|       location: [48.87, 2.32], |  | ||||||
|       type: shopping, |  | ||||||
|       imageURL: "https://upload.wikimedia.org/wikipedia/commons/thumb/d/de/GaleriesLafayetteNuit.jpg/220px-GaleriesLafayetteNuit.jpg" |  | ||||||
|     ), |  | ||||||
|   ); |  | ||||||
|   return t1; |  | ||||||
| } |  | ||||||
| @@ -16,8 +16,6 @@ class TripsOverview extends StatefulWidget { | |||||||
| } | } | ||||||
|  |  | ||||||
| class _TripsOverviewState extends State<TripsOverview> { | class _TripsOverviewState extends State<TripsOverview> { | ||||||
|   // final Future<List<Trip>> _trips = loadTrips(); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|   Widget listBuild (BuildContext context, AsyncSnapshot<List<Trip>> snapshot) { |   Widget listBuild (BuildContext context, AsyncSnapshot<List<Trip>> snapshot) { | ||||||
|     List<Widget> children; |     List<Widget> children; | ||||||
| @@ -65,6 +63,7 @@ class _TripsOverviewState extends State<TripsOverview> { | |||||||
|  |  | ||||||
|     return ListView( |     return ListView( | ||||||
|       children: children, |       children: children, | ||||||
|  |       padding: const EdgeInsets.only(top: 0), | ||||||
|     ); |     ); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -15,105 +15,5 @@ Future<List<Trip>> loadTrips() async { | |||||||
|       trips.add(Trip.fromPrefs(prefs, uuid)); |       trips.add(Trip.fromPrefs(prefs, uuid)); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   if (trips.isEmpty) { |  | ||||||
|     Trip t1 = Trip(uuid: '1', 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" |  | ||||||
|       ), |  | ||||||
|     ); |  | ||||||
|     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', 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; |   return trips; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -292,18 +292,18 @@ packages: | |||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: leak_tracker |       name: leak_tracker | ||||||
|       sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" |       sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" | ||||||
|       url: "https://pub.dev" |       url: "https://pub.dev" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "10.0.4" |     version: "10.0.5" | ||||||
|   leak_tracker_flutter_testing: |   leak_tracker_flutter_testing: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: leak_tracker_flutter_testing |       name: leak_tracker_flutter_testing | ||||||
|       sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" |       sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" | ||||||
|       url: "https://pub.dev" |       url: "https://pub.dev" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "3.0.3" |     version: "3.0.5" | ||||||
|   leak_tracker_testing: |   leak_tracker_testing: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
| @@ -332,18 +332,18 @@ packages: | |||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: material_color_utilities |       name: material_color_utilities | ||||||
|       sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" |       sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec | ||||||
|       url: "https://pub.dev" |       url: "https://pub.dev" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "0.8.0" |     version: "0.11.1" | ||||||
|   meta: |   meta: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: meta |       name: meta | ||||||
|       sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" |       sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 | ||||||
|       url: "https://pub.dev" |       url: "https://pub.dev" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "1.12.0" |     version: "1.15.0" | ||||||
|   nested: |   nested: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
| @@ -609,10 +609,10 @@ packages: | |||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: test_api |       name: test_api | ||||||
|       sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" |       sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" | ||||||
|       url: "https://pub.dev" |       url: "https://pub.dev" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "0.7.0" |     version: "0.7.2" | ||||||
|   typed_data: |   typed_data: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
| @@ -641,10 +641,10 @@ packages: | |||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: vm_service |       name: vm_service | ||||||
|       sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" |       sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc | ||||||
|       url: "https://pub.dev" |       url: "https://pub.dev" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "14.2.1" |     version: "14.2.4" | ||||||
|   web: |   web: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user