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/primary_button.dart';
import 'package:prosappco/src/presentation/widgets/shared/warning_snackbar.dart'; import 'package:prosappco/src/presentation/widgets/shared/warning_snackbar.dart';
import 'package:prosappco/src/providers/user_provider.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:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
@@ -75,11 +74,9 @@ class _ServiceScreenState extends State<ServiceScreen> {
int? professionalTarifa; int? professionalTarifa;
double? professionalLatitude; double? professionalLatitude;
double? professionalLongitude; double? professionalLongitude;
DateTime? _selectedDate;
String _ciudad = '...'; String _ciudad = '...';
TimeOfDay? _selectedTime;
final DateFormat formatter = DateFormat('dd/MM/yyyy'); final DateFormat formatter = DateFormat('dd/MM/yyyy');
dynamic coordinates; dynamic coordinates;
Set<Marker> markers = {}; Set<Marker> markers = {};
@@ -387,10 +384,13 @@ class _ServiceScreenState extends State<ServiceScreen> {
); );
if (datos != null) { if (datos != null) {
Professional? profesional = datos[0]; fechaSeleccionada = datos[0];
ubicacion = datos[1]; horaSeleccionada = datos[1];
Professional? profesional = datos[2];
profesionalSeleccionado = profesional;
if (profesional != null) { if (profesional != null) {
ubicacion = datos[3];
if (mounted) { if (mounted) {
setState(() { setState(() {
_profesionalController.text = _profesionalController.text =
@@ -515,7 +515,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
profesionalSeleccionado = profesional; profesionalSeleccionado = profesional;
if (profesional != null) { if (profesional != null) {
ubicacion = profesional.ubicacion; ubicacion = datos[3];
if (mounted) { if (mounted) {
setState(() { setState(() {
_profesionalController.text = _profesionalController.text =
@@ -751,7 +751,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
WarningSnackbar.show( WarningSnackbar.show(
title: 'Llena todos los campos', title: 'Llena todos los campos',
message: 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) { if (mounted) {
setState(() { setState(() {});
_selectedDate = pickedDate;
_selectedTime = pickedTime;
});
} }
} }
} }
+34 -17
View File
@@ -358,39 +358,36 @@ class _ProfessionalScreenState extends State<ProfessionalScreen> {
), ),
) )
: const SizedBox(), : const SizedBox(),
professionals[index].ubicacion == 'ambos' professionals[index].ubicacion == 'ambos' &&
settings?.domicilios == true
? const Text( ? const Text(
'Disponibilidad a domicilio y en sitio', 'Disponibilidad a domicilio y en sitio',
style: TextStyle( style: TextStyle(
color: Colors.blue, color: Colors.blue,
), ),
) )
: professionals[index].ubicacion == 'sitio' : professionals[index].ubicacion == 'sitio' ||
? Text( settings?.domicilios == false
'Disponibilidad en ${professionals[index].ubicacion} ', ? const Text(
style: const TextStyle( 'Disponibilidad en sitio',
style: TextStyle(
color: Colors.blue, color: Colors.blue,
), ),
) )
: Text( : const Text(
'Disponibilidad a ${professionals[index].ubicacion}', 'Disponibilidad a domicilio',
style: const TextStyle( style: TextStyle(
color: Colors.blue, color: Colors.blue,
), ),
), ),
], ],
), ),
onTap: () async { onTap: () async {
if (professionals[index].ubicacion == 'ambos') { if (professionals[index].ubicacion == 'ambos' &&
_showChoiceDialog(context).then((String? value) { settings?.domicilios == true) {
_showChoiceDialog(context)
.then((String? value) async {
if (value != null) { if (value != null) {
Navigator.pop(
context, [professionals[index], value]);
}
});
} else if (professionals[index].ubicacion ==
'sitio') {
// Navigator.pop(context, [professionals[index], 'sitio']);
var datos = await Navigator.of(context).push( var datos = await Navigator.of(context).push(
CupertinoPageRoute( CupertinoPageRoute(
builder: (BuildContext context) { builder: (BuildContext context) {
@@ -402,6 +399,26 @@ class _ProfessionalScreenState extends State<ProfessionalScreen> {
); );
if (datos != null) { if (datos != null) {
datos.add(value);
Navigator.pop(context, datos);
}
}
});
} else if (professionals[index].ubicacion ==
'sitio' ||
settings?.domicilios == false) {
var datos = await Navigator.of(context).push(
CupertinoPageRoute(
builder: (BuildContext context) {
return CalendarProScreen(
professional: professionals[index],
);
},
),
);
if (datos != null) {
datos.add('sitio');
Navigator.pop(context, datos); Navigator.pop(context, datos);
} }
} else { } else {