This commit is contained in:
lizandrogd
2023-11-08 17:28:11 -05:00
11 changed files with 226 additions and 288 deletions
+20 -20
View File
@@ -185,26 +185,26 @@ class DrawerMenu extends StatelessWidget {
style: TextStyle(fontSize: 15),
),
),
ListTile(
onTap: () {
Navigator.push(
context,
CupertinoPageRoute(
builder: (BuildContext context) {
return const MessagesUserScreen();
},
),
);
},
leading: const Icon(
Icons.messenger_outline,
color: Colors.black,
),
title: const Text(
'Mensajes',
style: TextStyle(fontSize: 15),
),
),
// ListTile(
// onTap: () {
// Navigator.push(
// context,
// CupertinoPageRoute(
// builder: (BuildContext context) {
// return const MessagesUserScreen();
// },
// ),
// );
// },
// leading: const Icon(
// Icons.messenger_outline,
// color: Colors.black,
// ),
// title: const Text(
// 'Mensajes',
// style: TextStyle(fontSize: 15),
// ),
// ),
Builder(builder: (BuildContext context) {
return ListTile(
onTap: () {
+19 -19
View File
@@ -237,25 +237,25 @@ class _DrawerProfessionalState extends State<DrawerProfessional> {
style: TextStyle(fontSize: 15),
),
),
ListTile(
onTap: () {
Navigator.of(context).push(
CupertinoPageRoute(
builder: (BuildContext context) {
return const MessagesScreen();
},
),
);
},
leading: const Icon(
Icons.messenger_outline,
color: Colors.black,
),
title: const Text(
'Mensajes',
style: TextStyle(fontSize: 15),
),
),
// ListTile(
// onTap: () {
// Navigator.of(context).push(
// CupertinoPageRoute(
// builder: (BuildContext context) {
// return const MessagesScreen();
// },
// ),
// );
// },
// leading: const Icon(
// Icons.messenger_outline,
// color: Colors.black,
// ),
// title: const Text(
// 'Mensajes',
// style: TextStyle(fontSize: 15),
// ),
// ),
ListTile(
onTap: () {
Navigator.push(
+148 -142
View File
@@ -296,15 +296,16 @@ class _CitaScreenState extends State<CitaScreen> {
),
widget.evento.userId == widget.evento.professionalId
? const SizedBox()
: widget.evento.status == 'terminado'
? const SizedBox(height: 10)
: const Padding(
: widget.evento.status == 'aprobado' ||
widget.evento.status == 'iniciado'
? const Padding(
padding: EdgeInsets.symmetric(vertical: 20),
child: Text(
'Medios de comunicación con el usuario.',
style: TextStyle(color: Color(0xFF2BA4EC)),
),
),
)
: const SizedBox(height: 10),
widget.evento.userId == widget.evento.professionalId
? const SizedBox()
: widget.evento.status == 'terminado'
@@ -389,151 +390,156 @@ class _CitaScreenState extends State<CitaScreen> {
),
],
)
: Row(
children: [
const Expanded(child: SizedBox()),
ElevatedButton(
onPressed: () => launch("tel:$numberPhone"),
style: ElevatedButton.styleFrom(
foregroundColor: const Color(0xFF2BA4EC),
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50),
side: const BorderSide(
color: Color(0xFF2BA4EC),
width: 2,
: widget.evento.status == 'aprobado' ||
widget.evento.status == 'iniciado'
? Row(
children: [
const Expanded(child: SizedBox()),
ElevatedButton(
onPressed: () => launch("tel:$numberPhone"),
style: ElevatedButton.styleFrom(
foregroundColor: const Color(0xFF2BA4EC),
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50),
side: const BorderSide(
color: Color(0xFF2BA4EC),
width: 2,
),
),
),
),
),
child: const Padding(
padding: EdgeInsets.symmetric(
vertical: 18, horizontal: 0),
child: Icon(
Icons.phone_android,
size: 30,
color: Color(0xFF2BA4EC),
),
),
),
const SizedBox(width: 20),
ElevatedButton(
onPressed: () async {
if (widget.evento.status != 'pendiente') {
final chatDoc = FirebaseFirestore.instance
.collection('chats')
.doc(widget.evento.id);
final chatSnapshot = await chatDoc.get();
if (!chatSnapshot.exists ||
chatSnapshot.data()!['message'] ==
null) {
await chatDoc.set(
{
'professional_id':
widget.evento.professionalId,
'user_id': widget.evento.userId,
'message': [],
},
SetOptions(merge: true),
).catchError((error) => print(
'Error al crear el documento: $error'));
}
Navigator.push(
context,
CupertinoPageRoute(
builder: (BuildContext context) {
return ChatScreen(
eventoId: widget.evento.id);
},
child: const Padding(
padding: EdgeInsets.symmetric(
vertical: 18, horizontal: 0),
child: Icon(
Icons.phone_android,
size: 30,
color: Color(0xFF2BA4EC),
),
);
}
// if (widget.evento.status != 'pendiente') {
// await FirebaseFirestore.instance
// .collection('chats')
// .doc(widget.evento.id)
// .set(
// {
// 'professional_id':
// widget.evento.professionalId,
// 'user_id': widget.evento.userId,
// 'message': [],
// },
// SetOptions(
// merge:
// true)).catchError((error) => print(
// 'Error al crear el documento: $error'));
// Navigator.push(
// context,
// CupertinoPageRoute(
// builder: (BuildContext context) {
// return ChatScreen(
// eventoId: widget.evento.id);
// },
// ),
// );
// }
else {
Get.snackbar(
'El profesional aun no ha aceptado tu solicitud',
'Debes esperar a que el profesional acepte tu solicitud para poder iniciar un chat.',
snackPosition: SnackPosition.BOTTOM,
);
}
},
style: ElevatedButton.styleFrom(
foregroundColor: const Color(0xFF2BA4EC),
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50),
side: const BorderSide(
color: Color(0xFF2BA4EC),
width: 2,
),
),
),
child: const Padding(
padding: EdgeInsets.symmetric(
vertical: 18, horizontal: 0),
child: Icon(
Icons.message,
size: 30,
color: Color(0xFF2BA4EC),
),
),
),
const SizedBox(width: 20),
ElevatedButton(
onPressed: () {
_sendWhatsapp(numberPhone);
},
style: ElevatedButton.styleFrom(
foregroundColor: const Color(0xFF2BA4EC),
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50),
side: const BorderSide(
color: Color(0xFF2BA4EC),
width: 2,
const SizedBox(width: 20),
ElevatedButton(
onPressed: () async {
if (widget.evento.status != 'pendiente') {
final chatDoc = FirebaseFirestore
.instance
.collection('chats')
.doc(widget.evento.id);
final chatSnapshot =
await chatDoc.get();
if (!chatSnapshot.exists ||
chatSnapshot.data()!['message'] ==
null) {
await chatDoc.set(
{
'professional_id':
widget.evento.professionalId,
'user_id': widget.evento.userId,
'message': [],
},
SetOptions(merge: true),
).catchError((error) => print(
'Error al crear el documento: $error'));
}
Navigator.push(
context,
CupertinoPageRoute(
builder: (BuildContext context) {
return ChatScreen(
eventoId: widget.evento.id);
},
),
);
}
// if (widget.evento.status != 'pendiente') {
// await FirebaseFirestore.instance
// .collection('chats')
// .doc(widget.evento.id)
// .set(
// {
// 'professional_id':
// widget.evento.professionalId,
// 'user_id': widget.evento.userId,
// 'message': [],
// },
// SetOptions(
// merge:
// true)).catchError((error) => print(
// 'Error al crear el documento: $error'));
// Navigator.push(
// context,
// CupertinoPageRoute(
// builder: (BuildContext context) {
// return ChatScreen(
// eventoId: widget.evento.id);
// },
// ),
// );
// }
else {
Get.snackbar(
'El profesional aun no ha aceptado tu solicitud',
'Debes esperar a que el profesional acepte tu solicitud para poder iniciar un chat.',
snackPosition: SnackPosition.BOTTOM,
);
}
},
style: ElevatedButton.styleFrom(
foregroundColor: const Color(0xFF2BA4EC),
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50),
side: const BorderSide(
color: Color(0xFF2BA4EC),
width: 2,
),
),
),
child: const Padding(
padding: EdgeInsets.symmetric(
vertical: 18, horizontal: 0),
child: Icon(
Icons.message,
size: 30,
color: Color(0xFF2BA4EC),
),
),
),
),
child: const Padding(
padding: EdgeInsets.symmetric(
vertical: 18, horizontal: 0),
child: Icon(
CommunityMaterialIcons.whatsapp,
size: 30,
color: Color(0xFF2BA4EC),
const SizedBox(width: 20),
ElevatedButton(
onPressed: () {
_sendWhatsapp(numberPhone);
},
style: ElevatedButton.styleFrom(
foregroundColor: const Color(0xFF2BA4EC),
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50),
side: const BorderSide(
color: Color(0xFF2BA4EC),
width: 2,
),
),
),
child: const Padding(
padding: EdgeInsets.symmetric(
vertical: 18, horizontal: 0),
child: Icon(
CommunityMaterialIcons.whatsapp,
size: 30,
color: Color(0xFF2BA4EC),
),
),
),
),
),
const Expanded(child: SizedBox()),
],
),
const Expanded(child: SizedBox()),
],
)
: SizedBox(),
widget.evento.ubicacion == 'sitio'
? const SizedBox()
: Padding(
+27 -2
View File
@@ -10,6 +10,7 @@ import 'package:geocoding/geocoding.dart';
import 'package:geolocator/geolocator.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
import 'package:prosappco/src/authentication/authentication_repository.dart';
import 'package:prosappco/src/components/drawer_menu.dart';
import 'package:prosappco/src/models/event_model.dart';
@@ -54,6 +55,27 @@ class _ServiceScreenState extends State<ServiceScreen> {
}
}
// Future<List<LatLng>> getRouteCoordinates(
// double startLat, double startLng, double endLat, double endLng) async {
// List<LatLng> polylineCoordinates = [];
// PolylinePoints polylinePoints = PolylinePoints();
// PolylineResult result = await polylinePoints.getRouteBetweenCoordinates(
// apiKey, // Debes reemplazar esto con tu API Key de Google Maps
// PointLatLng(startLat, startLng),
// PointLatLng(endLat, endLng),
// );
// if (result.points.isNotEmpty) {
// result.points.forEach((PointLatLng point) {
// polylineCoordinates.add(LatLng(point.latitude, point.longitude));
// });
// }
// return polylineCoordinates;
// }
Future<void> sendPushNotification(String pro) async {
try {
http.Response response = await http.post(
@@ -275,7 +297,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
}
void _checkForUpdate(String? settings) {
if (appVersion != settings) {
if (appVersion == settings) {
showDialog(
context: context,
builder: (context) {
@@ -321,7 +343,9 @@ class _ServiceScreenState extends State<ServiceScreen> {
void initState() {
super.initState();
_getAppVersion();
if (!kIsWeb) {
_getAppVersion();
}
if (settings == null) {
SettingModel.getSettings().then(
@@ -713,6 +737,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
SizedBox(
height: MediaQuery.of(context).size.height * 0.5,
child: GoogleMap(
myLocationEnabled: true,
mapType: MapType.normal,
initialCameraPosition: initialCameraPosition,
markers: markers,
@@ -6,14 +6,10 @@
#include "generated_plugin_registrant.h"
#include <audioplayers_linux/audioplayers_linux_plugin.h>
#include <file_selector_linux/file_selector_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) audioplayers_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "AudioplayersLinuxPlugin");
audioplayers_linux_plugin_register_with_registrar(audioplayers_linux_registrar);
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
-1
View File
@@ -3,7 +3,6 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
audioplayers_linux
file_selector_linux
url_launcher_linux
)
@@ -5,7 +5,6 @@
import FlutterMacOS
import Foundation
import audioplayers_darwin
import cloud_firestore
import file_selector_macos
import firebase_auth
@@ -15,12 +14,10 @@ import firebase_storage
import flutter_local_notifications
import geolocator_apple
import package_info_plus
import path_provider_foundation
import shared_preferences_foundation
import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin"))
FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
@@ -30,7 +27,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
}
+10 -90
View File
@@ -49,62 +49,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.11.0"
audioplayers:
dependency: "direct main"
description:
name: audioplayers
sha256: "61583554386721772f9309f509e17712865b38565a903c761f96b1115a979282"
url: "https://pub.dev"
source: hosted
version: "4.1.0"
audioplayers_android:
dependency: transitive
description:
name: audioplayers_android
sha256: dbdc9b7f2aa2440314c638aa55aadd45c7705e8340d5eddf2e3fb8da32d4ae2c
url: "https://pub.dev"
source: hosted
version: "3.0.2"
audioplayers_darwin:
dependency: transitive
description:
name: audioplayers_darwin
sha256: "6aea96df1d12f7ad5a71d88c6d1b22a216211a9564219920124c16768e456e9d"
url: "https://pub.dev"
source: hosted
version: "4.1.0"
audioplayers_linux:
dependency: transitive
description:
name: audioplayers_linux
sha256: "396b62ac62c92dd26c3bc5106583747f57a8b325ebd2b41e5576f840cfc61338"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
audioplayers_platform_interface:
dependency: transitive
description:
name: audioplayers_platform_interface
sha256: f7daaed4659143094151ecf6bacd927d29ab8acffba98c110c59f0b81ae51143
url: "https://pub.dev"
source: hosted
version: "5.0.1"
audioplayers_web:
dependency: transitive
description:
name: audioplayers_web
sha256: ec84fd46eed1577148ed4113f5998a36a18da4fce7170c37ce3e21b631393339
url: "https://pub.dev"
source: hosted
version: "3.1.0"
audioplayers_windows:
dependency: transitive
description:
name: audioplayers_windows
sha256: "1d3aaac98a192b8488167711ba1e67d8b96333e8d0572ede4e2912e5bbce69a3"
url: "https://pub.dev"
source: hosted
version: "2.0.2"
boolean_selector:
dependency: transitive
description:
@@ -475,6 +419,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.17"
flutter_polyline_points:
dependency: "direct main"
description:
name: flutter_polyline_points
sha256: "0e07862139cb65a88789cd6efbe284c0b6f1fcb5ed5ec87781759c48190d84b9"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
flutter_rating_bar:
dependency: "direct main"
description:
@@ -705,10 +657,10 @@ packages:
dependency: "direct main"
description:
name: http
sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2"
sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525"
url: "https://pub.dev"
source: hosted
version: "0.13.6"
version: "1.1.0"
http_parser:
dependency: transitive
description:
@@ -901,30 +853,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.8.3"
path_provider:
dependency: transitive
description:
name: path_provider
sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa
url: "https://pub.dev"
source: hosted
version: "2.1.1"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72
url: "https://pub.dev"
source: hosted
version: "2.2.1"
path_provider_foundation:
dependency: transitive
description:
name: path_provider_foundation
sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d"
url: "https://pub.dev"
source: hosted
version: "2.3.1"
path_provider_linux:
dependency: transitive
description:
@@ -1130,14 +1058,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.0"
synchronized:
dependency: transitive
description:
name: synchronized
sha256: "5fcbd27688af6082f5abd611af56ee575342c30e87541d0245f7ff99faa02c60"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
table_calendar:
dependency: "direct main"
description:
+2 -2
View File
@@ -52,7 +52,8 @@ dependencies:
flutter_rating_bar:
table_calendar:
google_maps_flutter: ^2.2.5
http: ^0.13.5
flutter_polyline_points: ^2.0.0
http: ^1.1.0
geolocator: ^9.0.2
geocoding: ^2.1.0
url_launcher: ^6.1.10
@@ -65,7 +66,6 @@ dependencies:
flutter_dialogs: ^3.0.0
universal_html: ^2.2.3
firebase_messaging: ^14.6.3
audioplayers: ^4.1.0
animated_splash_screen: ^1.3.0
dev_dependencies:
@@ -6,7 +6,6 @@
#include "generated_plugin_registrant.h"
#include <audioplayers_windows/audioplayers_windows_plugin.h>
#include <cloud_firestore/cloud_firestore_plugin_c_api.h>
#include <file_selector_windows/file_selector_windows.h>
#include <firebase_auth/firebase_auth_plugin_c_api.h>
@@ -16,8 +15,6 @@
#include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
AudioplayersWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("AudioplayersWindowsPlugin"));
CloudFirestorePluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("CloudFirestorePluginCApi"));
FileSelectorWindowsRegisterWithRegistrar(
-1
View File
@@ -3,7 +3,6 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
audioplayers_windows
cloud_firestore
file_selector_windows
firebase_auth