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/scores_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 {
final Event evento;
@@ -24,6 +26,26 @@ class _CitaScreenState extends State<CitaScreen> {
Reference? ref_photo;
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
void initState() {
super.initState();
@@ -37,6 +59,7 @@ class _CitaScreenState extends State<CitaScreen> {
}
}
@override
Widget build(BuildContext context) {
if (nombre == '') {
UserModel.getUser(widget.evento.userId).then((value) {
@@ -166,86 +189,119 @@ class _CitaScreenState extends State<CitaScreen> {
Row(
children: [
const Expanded(child: SizedBox()),
Container(
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: const Color(0xFF2BA4EC), width: 2),
borderRadius: BorderRadius.circular(50),
),
child: FloatingActionButton(
onPressed: () {},
ElevatedButton(
onPressed: () => launch("tel:+573163225944"),
style: ElevatedButton.styleFrom(
foregroundColor: const Color(0xFF2BA4EC),
backgroundColor: Colors.white,
elevation: 0,
child: const Icon(Icons.phone_android,
size: 30, color: 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.phone_android,
size: 30,
color: Color(0xFF2BA4EC),
),
),
),
const SizedBox(width: 20),
Container(
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: const Color(0xFF2BA4EC), width: 2),
borderRadius: BorderRadius.circular(50),
),
child: FloatingActionButton(
onPressed: () {},
ElevatedButton(
onPressed: () {
_sendWhatsapp();
},
style: ElevatedButton.styleFrom(
foregroundColor: const Color(0xFF2BA4EC),
backgroundColor: Colors.white,
elevation: 0,
child: const Icon(Icons.message,
size: 30, color: 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(
CommunityMaterialIcons.whatsapp,
size: 30,
color: Color(0xFF2BA4EC),
),
),
),
const Expanded(child: SizedBox()),
],
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 20),
child: Row(
children: [
Container(
decoration: BoxDecoration(
color: const Color(0xFF2BA4EC),
border: Border.all(
color: const Color(0xFF2BA4EC), width: 2),
borderRadius: BorderRadius.circular(50),
widget.evento.ubicacion == 'sitio'
? const SizedBox()
: Padding(
padding: const EdgeInsets.only(top: 40),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () {
_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(
child: Padding(
padding: const EdgeInsets.only(bottom: 30),
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFFEC2B2B),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50),
),
elevation: 0,
minimumSize: const Size(230, 60),
Padding(
padding: const EdgeInsets.only(bottom: 30),
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFFEC2B2B),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50),
),
child: const Text(
'Cancelar servicio',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 18,
),
elevation: 0,
minimumSize: const Size(230, 60),
),
child: const Text(
'Cancelar servicio',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
),
@@ -6,6 +6,10 @@
#include "generated_plugin_registrant.h"
#include <url_launcher_linux/url_launcher_plugin.h>
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
url_launcher_linux
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST
@@ -10,6 +10,7 @@ import firebase_auth
import firebase_core
import firebase_storage
import geolocator_apple
import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin"))
@@ -17,4 +18,5 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
FLTFirebaseStoragePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseStoragePlugin"))
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"
source: hosted
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:
dependency: transitive
description:
@@ -645,6 +653,70 @@ packages:
url: "https://pub.dev"
source: hosted
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:
dependency: transitive
description:
+3 -1
View File
@@ -42,7 +42,7 @@ dependencies:
google_sign_in:
provider:
get:
font_awesome_flutter:
font_awesome_flutter: ^10.4.0
flutter_otp_text_field:
intl_phone_field:
cloud_firestore:
@@ -56,6 +56,8 @@ dependencies:
google_maps_flutter: ^2.2.5
geolocator: ^9.0.2
geocoding: ^2.1.0
url_launcher: ^6.0.3
community_material_icon: ^5.9.55
dev_dependencies:
flutter_test:
@@ -7,8 +7,11 @@
#include "generated_plugin_registrant.h"
#include <geolocator_windows/geolocator_windows.h>
#include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
GeolocatorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("GeolocatorWindows"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}
+1
View File
@@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
geolocator_windows
url_launcher_windows
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST