overhaul using a trip struct that notifies its ui dependencies
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:anyway/structs/landmark.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:anyway/constants.dart';
|
||||
@@ -15,12 +18,12 @@ import 'package:anyway/pages/profile.dart';
|
||||
// A side drawer is used to switch between pages
|
||||
class BasePage extends StatefulWidget {
|
||||
final String mainScreen;
|
||||
final Future<Trip>? trip;
|
||||
|
||||
final Trip? trip;
|
||||
|
||||
const BasePage({
|
||||
super.key,
|
||||
required this.mainScreen,
|
||||
this.trip
|
||||
this.trip,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -53,13 +56,13 @@ class _BasePageState extends State<BasePage> {
|
||||
children: [
|
||||
DrawerHeader(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(colors: [Colors.cyan, theme.primaryColor])
|
||||
gradient: LinearGradient(colors: [Colors.red, Colors.yellow])
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
APP_NAME,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
color: Colors.grey[800],
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -129,9 +132,54 @@ class _BasePageState extends State<BasePage> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Future<Trip> getFirstTrip (Future<List<Trip>> trips) async {
|
||||
List<Trip> tripsf = await trips;
|
||||
return tripsf[0];
|
||||
// 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: '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"
|
||||
),
|
||||
);
|
||||
return t1;
|
||||
}
|
Reference in New Issue
Block a user