abrir calendario desde fecha y hora
This commit is contained in:
@@ -5,7 +5,6 @@ import 'package:prosappco/src/components/pop_appbar.dart';
|
||||
import 'package:prosappco/src/components/schedule_picker.dart';
|
||||
import 'package:prosappco/src/models/event_model.dart';
|
||||
import 'package:prosappco/src/models/professional_model.dart';
|
||||
import 'package:prosappco/src/presentation/screens/map/service.dart';
|
||||
import 'package:prosappco/src/presentation/widgets/shared/warning_snackbar.dart';
|
||||
import 'package:prosappco/src/utils/time_of_day_utils.dart';
|
||||
import 'package:table_calendar/table_calendar.dart';
|
||||
|
||||
@@ -21,6 +21,7 @@ import 'package:prosappco/src/models/event_model.dart';
|
||||
import 'package:prosappco/src/models/professional_model.dart';
|
||||
import 'package:prosappco/src/models/setting_model.dart';
|
||||
import 'package:prosappco/src/models/user_model.dart';
|
||||
import 'package:prosappco/src/presentation/screens/calendar_pro.dart';
|
||||
import 'package:prosappco/src/presentation/screens/professional.dart';
|
||||
import 'package:prosappco/src/presentation/screens/profile/profile.dart';
|
||||
import 'package:prosappco/src/presentation/screens/service_after.dart';
|
||||
@@ -633,6 +634,88 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
readOnly: true,
|
||||
onTap: () async {
|
||||
datos = await Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return CalendarProScreen(
|
||||
professional:
|
||||
profesionalSeleccionado!,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
if (datos != null) {
|
||||
fechaSeleccionada = datos[0];
|
||||
horaSeleccionada = datos[1];
|
||||
Professional? profesional = datos[2];
|
||||
profesionalSeleccionado = profesional;
|
||||
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(Icons.calendar_month),
|
||||
hintText: 'Fecha',
|
||||
@@ -647,6 +730,86 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
readOnly: true,
|
||||
onTap: () async {
|
||||
datos = await Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return CalendarProScreen(
|
||||
professional:
|
||||
profesionalSeleccionado!,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
if (datos != null) {
|
||||
fechaSeleccionada = datos[0];
|
||||
horaSeleccionada = datos[1];
|
||||
Professional? profesional = datos[2];
|
||||
profesionalSeleccionado = profesional;
|
||||
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(Icons.watch_later_outlined),
|
||||
hintText: 'Hora',
|
||||
|
||||
Reference in New Issue
Block a user