From 8c813b403e9c56dd7d5a0d6cdd3171d677d1b686 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Salazar?= <73718835+joshrs23@users.noreply.github.com> Date: Thu, 29 Jan 2026 23:45:52 -0500 Subject: [PATCH] calling number --- .../presentation/widgets/view_order_card.dart | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/apps/mobile/packages/features/client/view_orders/lib/src/presentation/widgets/view_order_card.dart b/apps/mobile/packages/features/client/view_orders/lib/src/presentation/widgets/view_order_card.dart index 0d26c93e..09ff4349 100644 --- a/apps/mobile/packages/features/client/view_orders/lib/src/presentation/widgets/view_order_card.dart +++ b/apps/mobile/packages/features/client/view_orders/lib/src/presentation/widgets/view_order_card.dart @@ -7,6 +7,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:intl/intl.dart'; import 'package:krow_data_connect/krow_data_connect.dart' as dc; import 'package:krow_domain/krow_domain.dart'; +import 'package:url_launcher/url_launcher.dart'; import '../blocs/view_orders_cubit.dart'; /// A rich card displaying details of a client order/shift. @@ -484,6 +485,7 @@ class _ViewOrderCardState extends State { /// Builds a detailed row for a worker. Widget _buildWorkerRow(Map app) { + final String? phone = app['phone'] as String?; return Container( margin: const EdgeInsets.only(bottom: 12), padding: const EdgeInsets.all(12), @@ -551,14 +553,46 @@ class _ViewOrderCardState extends State { ], ), ), - if ((app['phone'] as String?)?.isNotEmpty ?? false) ...[ - _buildActionIconButton(icon: UiIcons.phone, onTap: () {}), + if (phone != null && phone.isNotEmpty) ...[ + _buildActionIconButton( + icon: UiIcons.phone, + onTap: () => _confirmAndCall(phone), + ), ], ], ), ); } + Future _confirmAndCall(String phone) async { + final bool? shouldCall = await showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Call'), + content: Text('Do you want to call $phone?'), + actions: [ + TextButton( + onPressed: () => Navigator.of(context).pop(false), + child: const Text('Cancel'), + ), + TextButton( + onPressed: () => Navigator.of(context).pop(true), + child: const Text('Call'), + ), + ], + ); + }, + ); + + if (shouldCall != true) { + return; + } + + final Uri uri = Uri(scheme: 'tel', path: phone); + await launchUrl(uri); + } + /// Specialized action button for worker rows. Widget _buildActionIconButton({ required IconData icon,