UI elements using the new structs #8
							
								
								
									
										28
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
{
 | 
			
		||||
    // Use IntelliSense to learn about possible attributes.
 | 
			
		||||
    // Hover to view descriptions of existing attributes.
 | 
			
		||||
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
 | 
			
		||||
    "version": "0.2.0",
 | 
			
		||||
    "configurations": [
 | 
			
		||||
        {
 | 
			
		||||
            "name": "frontend",
 | 
			
		||||
            "cwd": "frontend",
 | 
			
		||||
            "request": "launch",
 | 
			
		||||
            "type": "dart"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "frontend (profile mode)",
 | 
			
		||||
            "cwd": "frontend",
 | 
			
		||||
            "request": "launch",
 | 
			
		||||
            "type": "dart",
 | 
			
		||||
            "flutterMode": "profile"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "frontend (release mode)",
 | 
			
		||||
            "cwd": "frontend",
 | 
			
		||||
            "request": "launch",
 | 
			
		||||
            "type": "dart",
 | 
			
		||||
            "flutterMode": "release"
 | 
			
		||||
        },
 | 
			
		||||
    ]
 | 
			
		||||
}
 | 
			
		||||
@@ -46,7 +46,8 @@ class _BasePageState extends State<BasePage> {
 | 
			
		||||
              child: const Text('The fanciest navigation!'),
 | 
			
		||||
            ),
 | 
			
		||||
            ListTile(
 | 
			
		||||
              title: const Text('Home'),
 | 
			
		||||
              title: const Text('Start'),
 | 
			
		||||
              leading: const Icon(Icons.map),
 | 
			
		||||
              selected: _selectedIndex == 0,
 | 
			
		||||
              onTap: () {
 | 
			
		||||
                // Update the state of the app
 | 
			
		||||
@@ -57,7 +58,8 @@ class _BasePageState extends State<BasePage> {
 | 
			
		||||
              },
 | 
			
		||||
            ),
 | 
			
		||||
            ListTile(
 | 
			
		||||
              title: const Text('Business'),
 | 
			
		||||
              title: const Text('How to use'),
 | 
			
		||||
              leading: Icon(Icons.help),
 | 
			
		||||
              selected: _selectedIndex == 1,
 | 
			
		||||
              onTap: () {
 | 
			
		||||
                // Update the state of the app
 | 
			
		||||
@@ -68,8 +70,6 @@ class _BasePageState extends State<BasePage> {
 | 
			
		||||
                Navigator.pop(context);
 | 
			
		||||
              },
 | 
			
		||||
            ),
 | 
			
		||||
            // add a whitespace so that the settings are at the bottom
 | 
			
		||||
            
 | 
			
		||||
            const Divider(),
 | 
			
		||||
            ListTile(
 | 
			
		||||
              title: const Text('Settings'),
 | 
			
		||||
 
 | 
			
		||||
@@ -66,7 +66,7 @@ class _LandmarkCardState extends State<LandmarkCard> {
 | 
			
		||||
          //   alignment: Alignment.topRight,
 | 
			
		||||
          //   child: Icon(Icons.push_pin, color: theme.primaryColor),
 | 
			
		||||
          // ),
 | 
			
		||||
          ],
 | 
			
		||||
        ],
 | 
			
		||||
      ),
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
import 'package:fast_network_navigation/structs/landmark.dart';
 | 
			
		||||
import 'package:fast_network_navigation/utils/get_landmarks.dart';
 | 
			
		||||
import 'package:flutter/material.dart';
 | 
			
		||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
 | 
			
		||||
 | 
			
		||||
@@ -10,33 +11,36 @@ class MapWidget extends StatefulWidget {
 | 
			
		||||
class _MapWidgetState extends State<MapWidget> {
 | 
			
		||||
  late GoogleMapController mapController;
 | 
			
		||||
  // coordinates of Paris
 | 
			
		||||
  final LatLng _center = const LatLng(48.8566, 2.3522);
 | 
			
		||||
  CameraPosition _cameraPosition = CameraPosition(
 | 
			
		||||
    target: LatLng(48.8566, 2.3522),
 | 
			
		||||
    zoom: 11.0,
 | 
			
		||||
  );
 | 
			
		||||
  Set<Marker> markers = <Marker>{};
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  void _onMapCreated(GoogleMapController controller) {
 | 
			
		||||
    mapController = controller;
 | 
			
		||||
    addLandmarks();
 | 
			
		||||
    drawLandmarks();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  
 | 
			
		||||
  void _onCameraIdle() {
 | 
			
		||||
    // print(mapController.getLatLng());
 | 
			
		||||
    // print(mapController.getLatLng(ScreenCoordinate(x: 0, y: 0)));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void addLandmarks() {
 | 
			
		||||
    // // adds a marker for each landmark
 | 
			
		||||
    // List<Landmark> landmarks = [
 | 
			
		||||
    //   Landmark(name: "Eiffel Tower", location: [48.8584, 2.2945], type: LandmarkType(name: "Type 1")),
 | 
			
		||||
    //   Landmark(name: "Louvre Museum", location: [48.8606, 2.3376], type: LandmarkType(name: "Type 1")),
 | 
			
		||||
    //   Landmark(name: "Notre-Dame Cathedral", location: [48.8529, 2.3499], type: LandmarkType(name: "Type 1")),
 | 
			
		||||
    //   Landmark(name: "Arc de Triomphe", location: [48.8738, 2.2950], type: LandmarkType(name: "Type 1")),
 | 
			
		||||
    //   Landmark(name: "Palace of Versailles", location: [48.8014, 2.1301], type: LandmarkType(name: "Type 1")),
 | 
			
		||||
    // ];
 | 
			
		||||
 | 
			
		||||
    // for (Landmark landmark in landmarks) {
 | 
			
		||||
    //   mapController.
 | 
			
		||||
    //   mapController.addMarker(MarkerOptions(
 | 
			
		||||
    //     position: LatLng(landmark.location[0], landmark.location[1]),
 | 
			
		||||
    //     infoWindowText: InfoWindowText(landmark.name, landmark.type.name),
 | 
			
		||||
    //   ));
 | 
			
		||||
    // }
 | 
			
		||||
  void drawLandmarks() async {
 | 
			
		||||
    // (re)draws landmarks on the map
 | 
			
		||||
    List<Landmark> landmarks = await fetchLandmarks();
 | 
			
		||||
    setState(() {
 | 
			
		||||
      for (Landmark landmark in landmarks) {
 | 
			
		||||
        markers.add(Marker(
 | 
			
		||||
          markerId: MarkerId(landmark.name),
 | 
			
		||||
          position: LatLng(landmark.location[0], landmark.location[1]),
 | 
			
		||||
          infoWindow: InfoWindow(title: landmark.name, snippet: landmark.type.name),
 | 
			
		||||
        ));
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -44,61 +48,11 @@ class _MapWidgetState extends State<MapWidget> {
 | 
			
		||||
  Widget build(BuildContext context) {
 | 
			
		||||
    return GoogleMap(
 | 
			
		||||
      onMapCreated: _onMapCreated,
 | 
			
		||||
      initialCameraPosition: CameraPosition(
 | 
			
		||||
        target: _center,
 | 
			
		||||
        zoom: 11.0,
 | 
			
		||||
      ),
 | 
			
		||||
      initialCameraPosition: _cameraPosition,
 | 
			
		||||
      onCameraIdle: _onCameraIdle,
 | 
			
		||||
      // onLongPress: ,
 | 
			
		||||
      // markers: #,
 | 
			
		||||
      markers: markers,
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  // GeoCode geoCode = GeoCode();
 | 
			
		||||
  // String _currentCityName = "...";
 | 
			
		||||
  // final Debounce _debounce = Debounce(Duration(seconds: 3));
 | 
			
		||||
 | 
			
		||||
  // final LatLng _center = const LatLng(45.521563, -122.677433);
 | 
			
		||||
  // late GoogleMapController mapController;
 | 
			
		||||
 | 
			
		||||
  // void _onMapCreated(GoogleMapController controller) {
 | 
			
		||||
  //   mapController = controller;
 | 
			
		||||
  // }
 | 
			
		||||
 | 
			
		||||
  // // void _setCurrentCityName() async {
 | 
			
		||||
  //   if (mapController.camera.zoom < 9) {
 | 
			
		||||
  //     return; // Don't bother if the view is too wide
 | 
			
		||||
  //   }
 | 
			
		||||
  //   var currentCoordinates = mapController.camera.center;
 | 
			
		||||
  //   String? city;
 | 
			
		||||
    
 | 
			
		||||
  //   try{
 | 
			
		||||
  //     List<Placemark> placemarks = await placemarkFromCoordinates(currentCoordinates.latitude, currentCoordinates.longitude);
 | 
			
		||||
  //     city = placemarks[0].locality.toString();
 | 
			
		||||
  //   } catch (e) {
 | 
			
		||||
  //     debugPrint("Error: $e");
 | 
			
		||||
  //     try {
 | 
			
		||||
  //       Address address = await geoCode.reverseGeocoding(latitude: currentCoordinates.latitude, longitude: currentCoordinates.longitude);
 | 
			
		||||
        
 | 
			
		||||
  //       if (address.city == null || address.city.toString().contains("Throttled!")){
 | 
			
		||||
  //         throw Exception("Probably rate limited");
 | 
			
		||||
  //       }
 | 
			
		||||
  //       city = address.city.toString();
 | 
			
		||||
  //     } catch (e) {
 | 
			
		||||
  //       debugPrint("Error: $e");
 | 
			
		||||
 | 
			
		||||
  //     }
 | 
			
		||||
  //   }
 | 
			
		||||
  //   if (city != null) {
 | 
			
		||||
  //     setState(() {
 | 
			
		||||
  //       _currentCityName = city!;
 | 
			
		||||
  //     });
 | 
			
		||||
  //   } else {
 | 
			
		||||
  //     _debounce(() async {_setCurrentCityName();});
 | 
			
		||||
  //   }
 | 
			
		||||
  // }
 | 
			
		||||
 | 
			
		||||
  
 | 
			
		||||
@@ -24,11 +24,14 @@ class _ProfilePageState extends State<ProfilePage> {
 | 
			
		||||
          child: Text('Curious traveler', style: TextStyle(fontSize: 24))
 | 
			
		||||
        ),
 | 
			
		||||
 | 
			
		||||
        Padding(
 | 
			
		||||
          padding: EdgeInsets.all(10),
 | 
			
		||||
        ),
 | 
			
		||||
        Padding(padding: EdgeInsets.all(10)),
 | 
			
		||||
        Divider(indent: 25, endIndent: 25),
 | 
			
		||||
        Padding(padding: EdgeInsets.all(10)),
 | 
			
		||||
 | 
			
		||||
        Text('Please rate your preferences for the following activities:'),
 | 
			
		||||
        Padding(
 | 
			
		||||
          padding: EdgeInsets.only(left: 10, right: 10, top: 0, bottom: 10),
 | 
			
		||||
          child: Text('Please rate your personal preferences so that we can taylor your experience.', style: TextStyle(fontSize: 20), )
 | 
			
		||||
        ),
 | 
			
		||||
 | 
			
		||||
        // Now the sliders
 | 
			
		||||
        ImportanceSliders()
 | 
			
		||||
 
 | 
			
		||||
@@ -10,11 +10,11 @@ Future<List<Landmark>> fetchLandmarks() async {
 | 
			
		||||
    // If the server did return a 200 OK response,
 | 
			
		||||
    // then parse the JSON.
 | 
			
		||||
    List<Landmark> landmarks = [
 | 
			
		||||
      Landmark(name: "Landmark 1", location: [0, 0], type: LandmarkType(name: "Type 1")),
 | 
			
		||||
      Landmark(name: "Landmark 2", location: [0, 0], type: LandmarkType(name: "Type 2")),
 | 
			
		||||
      Landmark(name: "Landmark 3", location: [0, 0], type: LandmarkType(name: "Type 3")),
 | 
			
		||||
      Landmark(name: "Landmark 4", location: [0, 0], type: LandmarkType(name: "Type 4")),
 | 
			
		||||
      Landmark(name: "Landmark 5", location: [0, 0], type: LandmarkType(name: "Type 5")),
 | 
			
		||||
      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")),
 | 
			
		||||
    ];
 | 
			
		||||
    return landmarks;
 | 
			
		||||
  // } else {
 | 
			
		||||
 
 | 
			
		||||
@@ -112,46 +112,6 @@ packages:
 | 
			
		||||
    description: flutter
 | 
			
		||||
    source: sdk
 | 
			
		||||
    version: "0.0.0"
 | 
			
		||||
  geocode:
 | 
			
		||||
    dependency: "direct main"
 | 
			
		||||
    description:
 | 
			
		||||
      name: geocode
 | 
			
		||||
      sha256: cf9727c369bb3703b97d6e440225962dc27b7f3c686662fe3cdcc91cbfb7074d
 | 
			
		||||
      url: "https://pub.dev"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "1.0.3"
 | 
			
		||||
  geocoding:
 | 
			
		||||
    dependency: "direct main"
 | 
			
		||||
    description:
 | 
			
		||||
      name: geocoding
 | 
			
		||||
      sha256: d580c801cba9386b4fac5047c4c785a4e19554f46be42f4f5e5b7deacd088a66
 | 
			
		||||
      url: "https://pub.dev"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "3.0.0"
 | 
			
		||||
  geocoding_android:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
      name: geocoding_android
 | 
			
		||||
      sha256: "1b13eca79b11c497c434678fed109c2be020b158cec7512c848c102bc7232603"
 | 
			
		||||
      url: "https://pub.dev"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "3.3.1"
 | 
			
		||||
  geocoding_ios:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
      name: geocoding_ios
 | 
			
		||||
      sha256: "94ddba60387501bd1c11e18dca7c5a9e8c645d6e3da9c38b9762434941870c24"
 | 
			
		||||
      url: "https://pub.dev"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "3.0.1"
 | 
			
		||||
  geocoding_platform_interface:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
      name: geocoding_platform_interface
 | 
			
		||||
      sha256: "8c2c8226e5c276594c2e18bfe88b19110ed770aeb7c1ab50ede570be8b92229b"
 | 
			
		||||
      url: "https://pub.dev"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "3.2.0"
 | 
			
		||||
  google_maps:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
 
 | 
			
		||||
@@ -36,8 +36,6 @@ dependencies:
 | 
			
		||||
  # Use with the CupertinoIcons class for iOS style icons.
 | 
			
		||||
  cupertino_icons: ^1.0.6
 | 
			
		||||
  sliding_up_panel: ^2.0.0+1
 | 
			
		||||
  geocoding: ^3.0.0
 | 
			
		||||
  geocode: ^1.0.3
 | 
			
		||||
  google_maps_flutter: ^2.6.1
 | 
			
		||||
  http: ^1.2.1
 | 
			
		||||
  shared_preferences: ^2.2.3
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
    This is a placeholder for base href that will be replaced by the value of
 | 
			
		||||
    the `--base-href` argument provided to `flutter build`.
 | 
			
		||||
  -->
 | 
			
		||||
  <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCeWk_D2xvfOHLidvV56EZeQCUybypEntw"></script>
 | 
			
		||||
  <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCeWk_D2xvfOHLidvV56EZeQCUybypEntw&libraries=drawing"></script>
 | 
			
		||||
  <base href="$FLUTTER_BASE_HREF">
 | 
			
		||||
 | 
			
		||||
  <meta charset="UTF-8">
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user