This commit is contained in:
Juan Felipe Duarte
2023-05-10 08:43:40 -05:00
parent eeced3ac66
commit 40ee4f2ab2
30 changed files with 1175 additions and 147 deletions
+31 -25
View File
@@ -1,5 +1,5 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:community_material_icon/community_material_icon.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
@@ -35,6 +35,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
final _serviceTypeController = TextEditingController();
final _observacionController = TextEditingController();
String professionalId = '';
int professionalTarifa = 0;
String professionalAddress = '';
String professionalUbicacion = '';
double? professionalLatitude;
@@ -130,6 +131,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
final FirebaseStorage storage = FirebaseStorage.instance;
final uid = AuthenticationRepository.instance.getCurrentUserUid();
final fcmToken = FirebaseMessaging.instance.getToken();
BitmapDescriptor? _markerIcon;
@@ -411,6 +413,9 @@ class _ServiceScreenState extends State<ServiceScreen> {
professionalId = profesional.id;
professionalTarifa =
profesional.tarifa ?? 0;
professionalUbicacion =
profesional.ubicacion;
@@ -549,35 +554,36 @@ class _ServiceScreenState extends State<ServiceScreen> {
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {
int tiempo2 = ((_selectedTime!.hour * 3600 +
_selectedTime!.minute * 60) +
7200) %
86400;
final DateTime combinedDate = DateTime(
_selectedDate!.year,
_selectedDate!.month,
_selectedDate!.day,
_selectedTime!.hour,
_selectedTime!.minute);
int hora2 = tiempo2 ~/ 3600;
int minutos2 = (tiempo2 % 3600) ~/ 60;
TimeOfDay time2 =
TimeOfDay(hour: hora2, minute: minutos2);
DateTime time2 =
combinedDate.add(const Duration(hours: 2));
UserModel.getUser(uid.toString()).then((value) {
eventoService
.createEvent(
value.name,
_observacionController.text,
'${_selectedDate}Z',
_selectedTime!.format(context),
time2.format(context),
professionalId,
ubicacion,
_locationController.text,
ubicacion != 'sitio'
? coordinates.latitude
: professionalLatitude,
ubicacion != 'sitio'
? coordinates.longitude
: professionalLongitude,
'pendiente')
value.name,
_observacionController.text,
'$_selectedDate',
'$combinedDate',
'$time2',
professionalId,
ubicacion,
_locationController.text,
ubicacion != 'sitio'
? coordinates.latitude
: professionalLatitude,
ubicacion != 'sitio'
? coordinates.longitude
: professionalLongitude,
'pendiente',
professionalTarifa,
)
.then((value) {
Navigator.pushReplacement(
context,