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,
),
),
),