BASE: Update Icons & Name Of The App.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import 'package:customer/widget/place_picker/selected_location_model.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get.dart' hide Trans;
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:geocoding/geocoding.dart';
|
||||
@@ -34,11 +34,15 @@ class LocationController extends GetxController {
|
||||
|
||||
Future<void> getCurrentLocation() async {
|
||||
try {
|
||||
Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
|
||||
Position position = await Geolocator.getCurrentPosition(
|
||||
desiredAccuracy: LocationAccuracy.high,
|
||||
);
|
||||
selectedLocation.value = LatLng(position.latitude, position.longitude);
|
||||
|
||||
if (mapController != null) {
|
||||
mapController!.animateCamera(CameraUpdate.newLatLngZoom(selectedLocation.value!, 15));
|
||||
mapController!.animateCamera(
|
||||
CameraUpdate.newLatLngZoom(selectedLocation.value!, 15),
|
||||
);
|
||||
}
|
||||
|
||||
await getAddressFromLatLng(selectedLocation.value!);
|
||||
@@ -49,11 +53,15 @@ class LocationController extends GetxController {
|
||||
|
||||
Future<void> getAddressFromLatLng(LatLng latLng) async {
|
||||
try {
|
||||
List<Placemark> placemarks = await placemarkFromCoordinates(latLng.latitude, latLng.longitude);
|
||||
List<Placemark> placemarks = await placemarkFromCoordinates(
|
||||
latLng.latitude,
|
||||
latLng.longitude,
|
||||
);
|
||||
if (placemarks.isNotEmpty) {
|
||||
Placemark place = placemarks.first;
|
||||
selectedPlaceAddress.value = place;
|
||||
address.value = "${place.street}, ${place.locality}, ${place.administrativeArea}, ${place.country}";
|
||||
address.value =
|
||||
"${place.street}, ${place.locality}, ${place.administrativeArea}, ${place.country}";
|
||||
} else {
|
||||
address.value = "Address not found";
|
||||
}
|
||||
@@ -71,7 +79,10 @@ class LocationController extends GetxController {
|
||||
try {
|
||||
List<Location> locations = await locationFromAddress(zipCode);
|
||||
if (locations.isNotEmpty) {
|
||||
selectedLocation.value = LatLng(locations.first.latitude, locations.first.longitude);
|
||||
selectedLocation.value = LatLng(
|
||||
locations.first.latitude,
|
||||
locations.first.longitude,
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
print("Error getting coordinates for ZIP code: $e");
|
||||
@@ -80,7 +91,10 @@ class LocationController extends GetxController {
|
||||
|
||||
void confirmLocation() {
|
||||
if (selectedLocation.value != null) {
|
||||
SelectedLocationModel selectedLocationModel = SelectedLocationModel(address: selectedPlaceAddress.value, latLng: selectedLocation.value);
|
||||
SelectedLocationModel selectedLocationModel = SelectedLocationModel(
|
||||
address: selectedPlaceAddress.value,
|
||||
latLng: selectedLocation.value,
|
||||
);
|
||||
Get.back(result: selectedLocationModel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_google_places_hoc081098/flutter_google_places_hoc081098.dart';
|
||||
import 'package:flutter_google_places_hoc081098/google_maps_webservice_places.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get.dart' hide Trans;
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
|
||||
final GoogleMapsPlaces _places = GoogleMapsPlaces(apiKey: Constant.mapAPIKey);
|
||||
|
||||
Reference in New Issue
Block a user