From 8d3c18a892cba53703125a44035857b78add2075 Mon Sep 17 00:00:00 2001 From: Felipe Date: Fri, 1 Sep 2023 09:11:25 -0500 Subject: [PATCH] update --- lib/src/screens/service.dart | 104 +++++++++++++---------------------- lib/src/screens/support.dart | 12 +--- 2 files changed, 42 insertions(+), 74 deletions(-) diff --git a/lib/src/screens/service.dart b/lib/src/screens/service.dart index eb31e6e..8b77bbe 100644 --- a/lib/src/screens/service.dart +++ b/lib/src/screens/service.dart @@ -33,9 +33,7 @@ class ServiceScreen extends StatefulWidget { State createState() => _ServiceScreenState(); } - class _ServiceScreenState extends State { - void _saveToken() async { FirebaseMessaging messaging = FirebaseMessaging.instance; @@ -51,8 +49,6 @@ class _ServiceScreenState extends State { } } - - Future sendPushNotification(String pro) async { try { http.Response response = await http.post( @@ -73,7 +69,7 @@ class _ServiceScreenState extends State { 'click_action': 'FLUTTER_NOTIFICATION_CLICK', 'id': '1', 'status': 'done', - 'screen':'solicitud' + 'screen': 'solicitud' }, 'to': pro }, @@ -206,7 +202,6 @@ class _ServiceScreenState extends State { @override void initState() { super.initState(); - if (_ciudad == '...') { AuthenticationRepository.instance @@ -716,61 +711,6 @@ class _ServiceScreenState extends State { }, ), ), - Padding( - padding: - const EdgeInsets.only(top: 22, left: 100, right: 25), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(50), - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.4), - spreadRadius: 1, - blurRadius: 2, - offset: const Offset(1, 2), - ), - ], - ), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: TextFormField( - onTap: () async { - final String? serviceType = await Navigator.push( - context, - CupertinoPageRoute( - builder: (BuildContext context) { - return const ServiceTypeScreen(); - }, - ), - ) as String?; - - if (serviceType != null) { - setState(() { - _serviceType = serviceType; - _serviceTypeController.text = _serviceType; - }); - } - }, - controller: _serviceTypeController, - style: const TextStyle( - color: Colors.black87, - fontWeight: FontWeight.w600, - ), - readOnly: true, - decoration: InputDecoration( - hintText: - _serviceType == '' ? 'Servicio' : _serviceType, - hintStyle: const TextStyle( - color: Colors.black87, - fontWeight: FontWeight.w600), - border: InputBorder.none, - enabledBorder: InputBorder.none, - ), - ), - ), - ), - ), ], ), Container( @@ -784,6 +724,41 @@ class _ServiceScreenState extends State { child: Form( child: Column( children: [ + TextFormField( + onTap: () async { + final String? serviceType = + await Navigator.push( + context, + CupertinoPageRoute( + builder: (BuildContext context) { + return const ServiceTypeScreen(); + }, + ), + ) as String?; + + if (serviceType != null) { + setState(() { + _serviceType = serviceType; + _serviceTypeController.text = _serviceType; + }); + } + }, + controller: _serviceTypeController, + style: const TextStyle( + color: Colors.black87, + fontWeight: FontWeight.w600, + ), + readOnly: true, + decoration: InputDecoration( + hintText: _serviceType == '' + ? 'Servicio' + : _serviceType, + border: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + + const SizedBox(height: 15), Column( children: [ TextFormField( @@ -811,11 +786,10 @@ class _ServiceScreenState extends State { profesional.name.toString(); professionalId = profesional.id; - print(profesional); + if (profesional.token != '') { professionalToken = profesional.token!; - print(professionalToken); } professionalTarifa = @@ -877,7 +851,7 @@ class _ServiceScreenState extends State { placeAutoComplete(modifiedValue); }, ), - Container( + SizedBox( height: _placesList.isNotEmpty ? 200 : 0, // Ajusta la altura según tus necesidades @@ -900,7 +874,7 @@ class _ServiceScreenState extends State { final newCoordinates = LatLng( selectedLatitude, selectedLongitude); - googleMapController?.animateCamera( + googleMapController.animateCamera( CameraUpdate.newLatLng(newCoordinates), ); diff --git a/lib/src/screens/support.dart b/lib/src/screens/support.dart index cadd749..a2a8572 100644 --- a/lib/src/screens/support.dart +++ b/lib/src/screens/support.dart @@ -19,9 +19,7 @@ class SsupportStateScreen extends State { final String body = ''; Future _sendWhatsapp(String? number) async { - final _whatsappUrl = - 'https://wa.me/$number?text=${Uri.parse('Hola! soy usuario de Prosapp y quisiera conocer mas sobre esta app')}'; - + final _whatsappUrl = 'https://api.whatsapp.com/send?phone=$number&text=Hola%21+soy+usuario+de+Prosapp+y+quisiera+conocer+mas+sobre+esta+app+%F0%9F%98%81'; if (!await launch(_whatsappUrl)) { throw Exception('Could not launch $_whatsappUrl'); } @@ -39,14 +37,10 @@ class SsupportStateScreen extends State { } void _sendEmailWeb(String recipients) async { - final email = - 'mailto:$recipients?subject=${Uri.encodeComponent(recipients)}&body=${Uri.encodeComponent(body)}'; + final email = 'mailto:$recipients?subject=${Uri.encodeComponent(recipients)}&body=${Uri.encodeComponent(body)}'; if (await canLaunch(email)) { await launch(email); - } else { - // No se pudo abrir el cliente de correo electrónico - // Puedes mostrar un diálogo o realizar otra acción en este caso - } + } else {} } @override