From c22aa7ba78f39f6b52a618b4d1ae0530fcb87847 Mon Sep 17 00:00:00 2001 From: Felipe Date: Wed, 8 Nov 2023 09:43:25 -0500 Subject: [PATCH 1/2] Que el mensaje de actualizacion de app no aplique para sitio web --- lib/src/screens/service.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/src/screens/service.dart b/lib/src/screens/service.dart index 44236f9..6b7b671 100644 --- a/lib/src/screens/service.dart +++ b/lib/src/screens/service.dart @@ -321,7 +321,9 @@ class _ServiceScreenState extends State { void initState() { super.initState(); - _getAppVersion(); + if (!kIsWeb) { + _getAppVersion(); + } if (settings == null) { SettingModel.getSettings().then( From 7cf5c5fbfb47016909e5b5224996d1e27916a530 Mon Sep 17 00:00:00 2001 From: Felipe Date: Wed, 8 Nov 2023 16:05:47 -0500 Subject: [PATCH 2/2] update --- lib/src/components/drawer_menu.dart | 40 +-- lib/src/components/drawer_professional.dart | 38 +-- lib/src/screens/cita.dart | 290 +++++++++--------- lib/src/screens/service.dart | 25 +- linux/flutter/generated_plugin_registrant.cc | 4 - linux/flutter/generated_plugins.cmake | 1 - macos/Flutter/GeneratedPluginRegistrant.swift | 4 - pubspec.lock | 100 +----- pubspec.yaml | 4 +- .../flutter/generated_plugin_registrant.cc | 3 - windows/flutter/generated_plugins.cmake | 1 - 11 files changed, 223 insertions(+), 287 deletions(-) diff --git a/lib/src/components/drawer_menu.dart b/lib/src/components/drawer_menu.dart index 789b1ae..3197395 100644 --- a/lib/src/components/drawer_menu.dart +++ b/lib/src/components/drawer_menu.dart @@ -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: () { diff --git a/lib/src/components/drawer_professional.dart b/lib/src/components/drawer_professional.dart index e8937a4..469b4ef 100644 --- a/lib/src/components/drawer_professional.dart +++ b/lib/src/components/drawer_professional.dart @@ -237,25 +237,25 @@ class _DrawerProfessionalState extends State { 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( diff --git a/lib/src/screens/cita.dart b/lib/src/screens/cita.dart index fb1b867..cd6a239 100644 --- a/lib/src/screens/cita.dart +++ b/lib/src/screens/cita.dart @@ -296,15 +296,16 @@ class _CitaScreenState extends State { ), 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 { ), ], ) - : 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( diff --git a/lib/src/screens/service.dart b/lib/src/screens/service.dart index 6b7b671..5eff70c 100644 --- a/lib/src/screens/service.dart +++ b/lib/src/screens/service.dart @@ -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 { } } + // Future> getRouteCoordinates( + // double startLat, double startLng, double endLat, double endLng) async { + // List 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 sendPushNotification(String pro) async { try { http.Response response = await http.post( @@ -275,7 +297,7 @@ class _ServiceScreenState extends State { } void _checkForUpdate(String? settings) { - if (appVersion != settings) { + if (appVersion == settings) { showDialog( context: context, builder: (context) { @@ -715,6 +737,7 @@ class _ServiceScreenState extends State { SizedBox( height: MediaQuery.of(context).size.height * 0.5, child: GoogleMap( + myLocationEnabled: true, mapType: MapType.normal, initialCameraPosition: initialCameraPosition, markers: markers, diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index d8a4062..7299b5c 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -6,14 +6,10 @@ #include "generated_plugin_registrant.h" -#include #include #include 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); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 04f81f4..786ff5c 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -3,7 +3,6 @@ # list(APPEND FLUTTER_PLUGIN_LIST - audioplayers_linux file_selector_linux url_launcher_linux ) diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index cb7913d..2758605 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -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")) } diff --git a/pubspec.lock b/pubspec.lock index 5d45359..49bed58 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -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: diff --git a/pubspec.yaml b/pubspec.yaml index 732839c..fa8016a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 92f5f6b..e6cabfc 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,7 +6,6 @@ #include "generated_plugin_registrant.h" -#include #include #include #include @@ -16,8 +15,6 @@ #include void RegisterPlugins(flutter::PluginRegistry* registry) { - AudioplayersWindowsPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("AudioplayersWindowsPlugin")); CloudFirestorePluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("CloudFirestorePluginCApi")); FileSelectorWindowsRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index aec5e54..994f57f 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,7 +3,6 @@ # list(APPEND FLUTTER_PLUGIN_LIST - audioplayers_windows cloud_firestore file_selector_windows firebase_auth