This commit is contained in:
Felipe
2024-01-09 17:24:14 -05:00
parent ae932ca582
commit 240791fb93
2 changed files with 39 additions and 25 deletions
+8 -11
View File
@@ -29,7 +29,6 @@ import 'package:prosappco/src/presentation/widgets/shared/drawer_menu.dart';
import 'package:prosappco/src/presentation/widgets/shared/primary_button.dart';
import 'package:prosappco/src/presentation/widgets/shared/warning_snackbar.dart';
import 'package:prosappco/src/providers/user_provider.dart';
import 'package:prosappco/src/utils/time_of_day_extension.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
@@ -75,11 +74,9 @@ class _ServiceScreenState extends State<ServiceScreen> {
int? professionalTarifa;
double? professionalLatitude;
double? professionalLongitude;
DateTime? _selectedDate;
String _ciudad = '...';
TimeOfDay? _selectedTime;
final DateFormat formatter = DateFormat('dd/MM/yyyy');
dynamic coordinates;
Set<Marker> markers = {};
@@ -387,10 +384,13 @@ class _ServiceScreenState extends State<ServiceScreen> {
);
if (datos != null) {
Professional? profesional = datos[0];
ubicacion = datos[1];
fechaSeleccionada = datos[0];
horaSeleccionada = datos[1];
Professional? profesional = datos[2];
profesionalSeleccionado = profesional;
if (profesional != null) {
ubicacion = datos[3];
if (mounted) {
setState(() {
_profesionalController.text =
@@ -515,7 +515,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
profesionalSeleccionado = profesional;
if (profesional != null) {
ubicacion = profesional.ubicacion;
ubicacion = datos[3];
if (mounted) {
setState(() {
_profesionalController.text =
@@ -751,7 +751,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
WarningSnackbar.show(
title: 'Llena todos los campos',
message:
'Asegurate de llenar todos los campos antes de solicitar un servicio. $e',
'Asegurate de llenar todos los campos antes de solicitar un servicio.',
);
}
}
@@ -1101,10 +1101,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
}
if (mounted) {
setState(() {
_selectedDate = pickedDate;
_selectedTime = pickedTime;
});
setState(() {});
}
}
}
+31 -14
View File
@@ -358,39 +358,55 @@ class _ProfessionalScreenState extends State<ProfessionalScreen> {
),
)
: const SizedBox(),
professionals[index].ubicacion == 'ambos'
professionals[index].ubicacion == 'ambos' &&
settings?.domicilios == true
? const Text(
'Disponibilidad a domicilio y en sitio',
style: TextStyle(
color: Colors.blue,
),
)
: professionals[index].ubicacion == 'sitio'
? Text(
'Disponibilidad en ${professionals[index].ubicacion} ',
style: const TextStyle(
: professionals[index].ubicacion == 'sitio' ||
settings?.domicilios == false
? const Text(
'Disponibilidad en sitio',
style: TextStyle(
color: Colors.blue,
),
)
: Text(
'Disponibilidad a ${professionals[index].ubicacion}',
style: const TextStyle(
: const Text(
'Disponibilidad a domicilio',
style: TextStyle(
color: Colors.blue,
),
),
],
),
onTap: () async {
if (professionals[index].ubicacion == 'ambos') {
_showChoiceDialog(context).then((String? value) {
if (professionals[index].ubicacion == 'ambos' &&
settings?.domicilios == true) {
_showChoiceDialog(context)
.then((String? value) async {
if (value != null) {
Navigator.pop(
context, [professionals[index], value]);
var datos = await Navigator.of(context).push(
CupertinoPageRoute(
builder: (BuildContext context) {
return CalendarProScreen(
professional: professionals[index],
);
},
),
);
if (datos != null) {
datos.add(value);
Navigator.pop(context, datos);
}
}
});
} else if (professionals[index].ubicacion ==
'sitio') {
// Navigator.pop(context, [professionals[index], 'sitio']);
'sitio' ||
settings?.domicilios == false) {
var datos = await Navigator.of(context).push(
CupertinoPageRoute(
builder: (BuildContext context) {
@@ -402,6 +418,7 @@ class _ProfessionalScreenState extends State<ProfessionalScreen> {
);
if (datos != null) {
datos.add('sitio');
Navigator.pop(context, datos);
}
} else {