diff --git a/lib/service/map_service.dart b/lib/service/map_service.dart index 2b63ab5..b90f09c 100644 --- a/lib/service/map_service.dart +++ b/lib/service/map_service.dart @@ -4,9 +4,8 @@ import 'package:http/http.dart' as http; import 'package:leg_barkr_app/model/latitude_longitude.dart'; import 'package:leg_barkr_app/utils/endpoints.dart' as Endpoints; - class MapService{ - Future getLastLocation(deviceId) async { + Future getPetLastLocation(deviceId) async { final response = await http.get( Uri.parse(Endpoints.getLastLocation), headers: { @@ -14,7 +13,6 @@ class MapService{ 'deviceid': deviceId, }, ); - print(response.body); return LatitudeLongitude.fromJson(jsonDecode(response.body)); } diff --git a/lib/utils/resources.dart b/lib/utils/resources.dart deleted file mode 100644 index 4b038a8..0000000 --- a/lib/utils/resources.dart +++ /dev/null @@ -1,7 +0,0 @@ -import 'package:flutter/material.dart'; - -class Resources { - static final Color primaryColour = Colors.green; - static final Color primaryAccentColour = Colors.greenAccent; - -} \ No newline at end of file diff --git a/lib/view/map/map_page.dart b/lib/view/map/map_page.dart index e0d3b63..b305560 100644 --- a/lib/view/map/map_page.dart +++ b/lib/view/map/map_page.dart @@ -15,32 +15,22 @@ class _MapPageState extends State { Future _onMapCreated(GoogleMapController controller) async { _mapController = controller; - final lastLocation = await MapService().getLastLocation("132-567-001"); // change this. + final lastLocation = await MapService().getPetLastLocation("132-567-001"); // change this. final myLocation = await MapService().getMyLocation(); - print(myLocation.latitude); setState(() { _markers.clear(); - if (lastLocation.latitude!=-1.0 && lastLocation.latitude!=-1.0){ - final petMarker = Marker( - markerId: MarkerId("pet_location"), - position: LatLng(lastLocation.latitude, lastLocation.longitude), - infoWindow: InfoWindow( - title: "Pet location", - ), - ); - _markers["pet_location"] = petMarker; - } + final petMarker = Marker( + markerId: MarkerId("pet_location"), + position: LatLng(lastLocation.latitude, lastLocation.longitude), + infoWindow: InfoWindow(title: "Pet location")); - if (myLocation.latitude!=-1.0 && myLocation.longitude!=-1.0){ - final myMarker = Marker( - markerId: MarkerId("my_location"), - position: LatLng(myLocation.latitude, myLocation.longitude), - infoWindow: InfoWindow( - title: "My location", - ), - ); - _markers["my_location"] = myMarker; - } + final myMarker = Marker( + markerId: MarkerId("my_location"), + position: LatLng(myLocation.latitude, myLocation.longitude), + infoWindow: InfoWindow(title: "My location")); + + _markers["pet_location"] = petMarker; + _markers["my_location"] = myMarker; _mapController.animateCamera(CameraUpdate.newLatLng(LatLng(myLocation.latitude, myLocation.longitude))); }); }