This commit is contained in:
Juan Felipe Duarte
2023-04-29 18:41:24 -05:00
parent 5baf019198
commit f1571e6374
8 changed files with 207 additions and 66 deletions
+121 -65
View File
@@ -8,6 +8,8 @@ import 'package:prosappco/src/components/pop_appbar.dart';
import 'package:prosappco/src/models/event_model.dart'; import 'package:prosappco/src/models/event_model.dart';
import 'package:prosappco/src/models/scores_model.dart'; import 'package:prosappco/src/models/scores_model.dart';
import 'package:prosappco/src/models/user_model.dart'; import 'package:prosappco/src/models/user_model.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:community_material_icon/community_material_icon.dart';
class CitaScreen extends StatefulWidget { class CitaScreen extends StatefulWidget {
final Event evento; final Event evento;
@@ -24,6 +26,26 @@ class _CitaScreenState extends State<CitaScreen> {
Reference? ref_photo; Reference? ref_photo;
ScoresModel? scoresModel; ScoresModel? scoresModel;
final phoneNumber = '+573022548060';
Future<void> _openMap(double lat, double lng) async {
final Uri _url =
Uri.parse('https://www.google.com/maps/search/?api=1&query=$lat,$lng');
if (!await launchUrl(_url)) {
print('hola');
throw Exception('Could not launch $_url');
}
}
Future<void> _sendWhatsapp() async {
final whatsappUrl =
'https://wa.me/$phoneNumber?text=${Uri.parse('Hola! me contactaste por Prossapp')}';
if (!await launch(whatsappUrl)) {
throw Exception('Could not launch $whatsappUrl');
}
}
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@@ -37,6 +59,7 @@ class _CitaScreenState extends State<CitaScreen> {
} }
} }
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (nombre == '') { if (nombre == '') {
UserModel.getUser(widget.evento.userId).then((value) { UserModel.getUser(widget.evento.userId).then((value) {
@@ -166,86 +189,119 @@ class _CitaScreenState extends State<CitaScreen> {
Row( Row(
children: [ children: [
const Expanded(child: SizedBox()), const Expanded(child: SizedBox()),
Container( ElevatedButton(
decoration: BoxDecoration( onPressed: () => launch("tel:+573163225944"),
color: Colors.white, style: ElevatedButton.styleFrom(
border: Border.all( foregroundColor: const Color(0xFF2BA4EC),
color: const Color(0xFF2BA4EC), width: 2),
borderRadius: BorderRadius.circular(50),
),
child: FloatingActionButton(
onPressed: () {},
backgroundColor: Colors.white, backgroundColor: Colors.white,
elevation: 0, shape: RoundedRectangleBorder(
child: const Icon(Icons.phone_android, borderRadius: BorderRadius.circular(50),
size: 30, color: Color(0xFF2BA4EC)), 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), const SizedBox(width: 20),
Container( ElevatedButton(
decoration: BoxDecoration( onPressed: () {
color: Colors.white, _sendWhatsapp();
border: Border.all( },
color: const Color(0xFF2BA4EC), width: 2), style: ElevatedButton.styleFrom(
borderRadius: BorderRadius.circular(50), foregroundColor: const Color(0xFF2BA4EC),
),
child: FloatingActionButton(
onPressed: () {},
backgroundColor: Colors.white, backgroundColor: Colors.white,
elevation: 0, shape: RoundedRectangleBorder(
child: const Icon(Icons.message, borderRadius: BorderRadius.circular(50),
size: 30, color: Color(0xFF2BA4EC)), 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()),
], ],
), ),
Padding( widget.evento.ubicacion == 'sitio'
padding: const EdgeInsets.symmetric(vertical: 20), ? const SizedBox()
child: Row( : Padding(
children: [ padding: const EdgeInsets.only(top: 40),
Container( child: Row(
decoration: BoxDecoration( mainAxisAlignment: MainAxisAlignment.center,
color: const Color(0xFF2BA4EC), children: [
border: Border.all( ElevatedButton(
color: const Color(0xFF2BA4EC), width: 2), onPressed: () {
borderRadius: BorderRadius.circular(50), _openMap(widget.evento.latitud!,
widget.evento.longitud!);
},
style: ElevatedButton.styleFrom(
foregroundColor: const Color(0xFF2BA4EC),
backgroundColor: const Color(0xFF2BA4EC),
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.near_me,
size: 30,
color: Color(0xFFFFFFFF),
),
),
),
const SizedBox(width: 20),
SizedBox(
width: 200,
child: Text('${widget.evento.address}'))
],
), ),
child: FloatingActionButton( )
onPressed: () {},
backgroundColor: const Color(0xFF2BA4EC),
elevation: 0,
child: const Icon(Icons.near_me,
size: 30, color: Colors.white),
),
),
Text('${widget.evento.address}')
],
),
)
], ],
), ),
), ),
Center( Padding(
child: Padding( padding: const EdgeInsets.only(bottom: 30),
padding: const EdgeInsets.only(bottom: 30), child: ElevatedButton(
child: ElevatedButton( onPressed: () {},
onPressed: () {}, style: ElevatedButton.styleFrom(
style: ElevatedButton.styleFrom( backgroundColor: const Color(0xFFEC2B2B),
backgroundColor: const Color(0xFFEC2B2B), shape: RoundedRectangleBorder(
shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(50),
borderRadius: BorderRadius.circular(50),
),
elevation: 0,
minimumSize: const Size(230, 60),
), ),
child: const Text( elevation: 0,
'Cancelar servicio', minimumSize: const Size(230, 60),
style: TextStyle( ),
color: Colors.white, child: const Text(
fontWeight: FontWeight.bold, 'Cancelar servicio',
fontSize: 18, style: TextStyle(
), color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 18,
), ),
), ),
), ),
@@ -6,6 +6,10 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <url_launcher_linux/url_launcher_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) { void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
} }
+1
View File
@@ -3,6 +3,7 @@
# #
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
url_launcher_linux
) )
list(APPEND FLUTTER_FFI_PLUGIN_LIST list(APPEND FLUTTER_FFI_PLUGIN_LIST
@@ -10,6 +10,7 @@ import firebase_auth
import firebase_core import firebase_core
import firebase_storage import firebase_storage
import geolocator_apple import geolocator_apple
import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin")) FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin"))
@@ -17,4 +18,5 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
FLTFirebaseStoragePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseStoragePlugin")) FLTFirebaseStoragePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseStoragePlugin"))
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin")) GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
} }
+72
View File
@@ -73,6 +73,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.17.0" version: "1.17.0"
community_material_icon:
dependency: "direct main"
description:
name: community_material_icon
sha256: bb389689f6278158d7b9d9b0c9433e603933283104fea226594590f61503fd08
url: "https://pub.dev"
source: hosted
version: "5.9.55"
cross_file: cross_file:
dependency: transitive dependency: transitive
description: description:
@@ -645,6 +653,70 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.1" version: "1.3.1"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
sha256: "75f2846facd11168d007529d6cd8fcb2b750186bea046af9711f10b907e1587e"
url: "https://pub.dev"
source: hosted
version: "6.1.10"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
sha256: "22f8db4a72be26e9e3a4aa3f194b1f7afbc76d20ec141f84be1d787db2155cbd"
url: "https://pub.dev"
source: hosted
version: "6.0.31"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
sha256: "9af7ea73259886b92199f9e42c116072f05ff9bea2dcb339ab935dfc957392c2"
url: "https://pub.dev"
source: hosted
version: "6.1.4"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
sha256: "207f4ddda99b95b4d4868320a352d374b0b7e05eefad95a4a26f57da413443f5"
url: "https://pub.dev"
source: hosted
version: "3.0.5"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
sha256: "91ee3e75ea9dadf38036200c5d3743518f4a5eb77a8d13fda1ee5764373f185e"
url: "https://pub.dev"
source: hosted
version: "3.0.5"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
sha256: "6c9ca697a5ae218ce56cece69d46128169a58aa8653c1b01d26fcd4aad8c4370"
url: "https://pub.dev"
source: hosted
version: "2.1.2"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
sha256: "81fe91b6c4f84f222d186a9d23c73157dc4c8e1c71489c4d08be1ad3b228f1aa"
url: "https://pub.dev"
source: hosted
version: "2.0.16"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
sha256: "254708f17f7c20a9c8c471f67d86d76d4a3f9c1591aad1e15292008aceb82771"
url: "https://pub.dev"
source: hosted
version: "3.0.6"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
+3 -1
View File
@@ -42,7 +42,7 @@ dependencies:
google_sign_in: google_sign_in:
provider: provider:
get: get:
font_awesome_flutter: font_awesome_flutter: ^10.4.0
flutter_otp_text_field: flutter_otp_text_field:
intl_phone_field: intl_phone_field:
cloud_firestore: cloud_firestore:
@@ -56,6 +56,8 @@ dependencies:
google_maps_flutter: ^2.2.5 google_maps_flutter: ^2.2.5
geolocator: ^9.0.2 geolocator: ^9.0.2
geocoding: ^2.1.0 geocoding: ^2.1.0
url_launcher: ^6.0.3
community_material_icon: ^5.9.55
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
@@ -7,8 +7,11 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <geolocator_windows/geolocator_windows.h> #include <geolocator_windows/geolocator_windows.h>
#include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) { void RegisterPlugins(flutter::PluginRegistry* registry) {
GeolocatorWindowsRegisterWithRegistrar( GeolocatorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("GeolocatorWindows")); registry->GetRegistrarForPlugin("GeolocatorWindows"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
} }
+1
View File
@@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
geolocator_windows geolocator_windows
url_launcher_windows
) )
list(APPEND FLUTTER_FFI_PLUGIN_LIST list(APPEND FLUTTER_FFI_PLUGIN_LIST