This commit is contained in:
Felipe
2023-11-17 17:53:54 -05:00
parent ef58892c13
commit a760c3c863
4 changed files with 245 additions and 130 deletions
+99 -10
View File
@@ -147,15 +147,29 @@ class _ServiceScreenState extends State<ServiceScreen> {
_saveToken();
BitmapDescriptor.fromAssetImage(
const ImageConfiguration(size: Size(1, 1)), 'images/pro_marke.png')
.then((icon) {
if (mounted) {
setState(() {
_markerIcon = icon;
});
}
});
if (Platform.isAndroid) {
BitmapDescriptor.fromAssetImage(
const ImageConfiguration(size: Size(2, 2)),
'images/pro_marke_android.png',
).then((icon) {
if (mounted) {
setState(() {
_markerIcon = icon;
});
}
});
} else {
BitmapDescriptor.fromAssetImage(
const ImageConfiguration(size: Size(1, 1)),
'images/pro_marke.png',
).then((icon) {
if (mounted) {
setState(() {
_markerIcon = icon;
});
}
});
}
updateMarkersForServiceType(_serviceType);
}
@@ -177,6 +191,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context);
UserModel? user = userProvider.user;
dynamic datos;
return SafeArea(
child: Scaffold(
@@ -328,6 +343,80 @@ class _ServiceScreenState extends State<ServiceScreen> {
updateMarkersForServiceType(_serviceType);
});
datos = await Navigator.push(
context,
CupertinoPageRoute(
builder: (BuildContext context) {
return ProfessionalScreen(
profession: _serviceTypeController.text,
);
},
),
);
if (datos != null) {
Professional? profesional = datos[0];
ubicacion = datos[1];
if (profesional != null) {
if (mounted) {
setState(() {
_profesionalController.text =
profesional.name.toString();
professionalId = profesional.id;
if (profesional.token != '') {
professionalToken = profesional.token!;
}
professionalTarifa =
profesional.tarifa ?? 0;
professionalUbicacion =
profesional.ubicacion;
professionalLatitude = profesional.latitude;
professionalLongitude =
profesional.longitude;
if (ubicacion == 'sitio') {
professionalAddress =
profesional.realAddress;
_locacionController.text =
profesional.realAddress;
LatLng professionalCoordinates = LatLng(
professionalLatitude!,
professionalLongitude!);
if (professionalLatitude != null &&
professionalLatitude != 0 &&
professionalLongitude != null &&
professionalLongitude != 0) {
_animateCameraToPosition(
LatLng(professionalLatitude!,
professionalLongitude!),
);
getPolylinePoints(_currentP!,
professionalCoordinates)
.then(
(coordinates) => {
generatePolyLineFromPoints(
coordinates),
},
);
}
} else {
polylines.clear();
}
});
}
}
}
}
}
},
@@ -367,7 +456,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
return;
}
final dynamic datos = await Navigator.push(
datos = await Navigator.push(
context,
CupertinoPageRoute(
builder: (BuildContext context) {