coordernadas

This commit is contained in:
Juan Felipe Duarte
2023-06-16 15:42:07 -05:00
parent b7b246b03a
commit f69201e0dd
4 changed files with 93 additions and 30 deletions
+19 -9
View File
@@ -13,7 +13,6 @@ import 'package:prosappco/src/authentication/authentication_repository.dart';
import 'package:prosappco/src/components/drawer_menu.dart';
import 'package:prosappco/src/models/event_model.dart';
import 'package:prosappco/src/models/user_model.dart';
import 'package:prosappco/src/screens/local_notification.dart';
import 'package:prosappco/src/screens/professional.dart';
import 'package:intl/intl.dart';
import 'package:prosappco/src/screens/profile.dart';
@@ -186,6 +185,10 @@ class _ServiceScreenState extends State<ServiceScreen> {
late String lat;
late String long;
double latUser = 0.0;
double lngUser = 0.0;
var coordinates;
Future<String> getLocationName(double latitude, double longitude) async {
@@ -239,19 +242,24 @@ class _ServiceScreenState extends State<ServiceScreen> {
controller: _ubicationController,
readOnly: true,
onTap: () async {
final dynamic datos = await Navigator.push(
final List<dynamic> datos = await Navigator.push(
context,
CupertinoPageRoute(
builder: (BuildContext context) {
return UbicacionScreen();
return const UbicacionScreen();
},
),
);
print(datos);
if (datos != null) {
if (datos.length == 3) {
final formattedAddress = datos[0];
final lat = datos[1];
final lng = datos[2];
setState(() {
_ubicationController.text = datos;
print(_ubicationController.text);
_ubicationController.text = formattedAddress;
latUser = lat;
lngUser = lng;
});
}
},
@@ -291,6 +299,8 @@ class _ServiceScreenState extends State<ServiceScreen> {
if (ubicacion == 'sitio') {
professionalAddress = profesional.realAddress;
_ubicationController.text = profesional.realAddress;
latUser = profesional.latitude;
lngUser = profesional.longitude;
}
});
}
@@ -419,8 +429,8 @@ class _ServiceScreenState extends State<ServiceScreen> {
professionalId,
ubicacion,
professionalAddress,
0.0,
0.0,
latUser,
lngUser,
'pendiente',
professionalTarifa == 0 ? 0 : professionalTarifa,
false,