Update: 2026-06-28 23:14:46

This commit is contained in:
Hamza-Ayed
2026-06-28 23:14:46 +03:00
parent 0b36566343
commit 1b6e172a4a
10 changed files with 428 additions and 79 deletions

View File

@@ -119,18 +119,69 @@ class MainController extends GetxController {
// await getDriverData();
}
String _formatPhoneNumberForCommunication(String rawPhone, String country) {
String digits = rawPhone.replaceAll(RegExp(r'[^0-9]'), '');
if (digits.startsWith('00')) {
digits = digits.substring(2);
}
if (country == 'Jordan') {
if (digits.startsWith('962') && digits.length >= 12) {
return digits;
}
if (digits.startsWith('0')) {
digits = digits.substring(1);
}
if (!digits.startsWith('962')) {
digits = '962$digits';
}
} else if (country == 'Egypt') {
if (digits.startsWith('20') && digits.length >= 11) {
return digits;
}
if (digits.startsWith('0')) {
digits = digits.substring(1);
}
if (!digits.startsWith('20')) {
digits = '20$digits';
}
} else if (country == 'Syria') {
if (digits.startsWith('963') && digits.length >= 11) {
return digits;
}
if (digits.startsWith('0')) {
digits = digits.substring(1);
}
if (!digits.startsWith('963')) {
digits = '963$digits';
}
} else {
if (digits.startsWith('0') && digits.length > 5) {
digits = digits.substring(1);
}
}
return digits;
}
Future<void> makePhoneCall(String phoneNumber) async {
final cleanPhone = phoneNumber.replaceAll(RegExp(r'[^0-9+]'), '');
final Uri launchUri = Uri(
scheme: 'tel',
path: phoneNumber,
path: cleanPhone,
);
await launchUrl(launchUri);
if (await canLaunchUrl(launchUri)) {
await launchUrl(launchUri);
} else {
final String telUrl = 'tel:$cleanPhone';
if (await canLaunchUrl(Uri.parse(telUrl))) {
await launchUrl(Uri.parse(telUrl));
}
}
}
Future<void> launchCommunication(
String method, String contactInfo, String message) async {
// رقّم فقط (بدون + أو مسافات)
final phone = contactInfo.replaceAll(RegExp(r'[^0-9]'), '');
final country = box.read('countryCode')?.toString() ?? 'Jordan';
final phone = _formatPhoneNumberForCommunication(contactInfo, country);
final encodedMsg = Uri.encodeComponent(message);
Uri? uri;

View File

@@ -41,41 +41,43 @@ class ReviewDriverPage extends StatelessWidget {
itemCount: keys.length,
itemBuilder: (context, index) {
final key = keys[index];
final isSelected = c.currentTabIndex.value == index;
return GestureDetector(
onTap: () => c.currentTabIndex.value = index,
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 3),
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
decoration: BoxDecoration(
color: isSelected
? AppColor.primaryColor
: AppColor.primaryLight,
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
c.tabIcons[key] ?? Icons.image,
size: 16,
color: isSelected ? Colors.white : AppColor.primaryColor,
),
const SizedBox(width: 4),
Text(
c.tabLabels[key] ?? key,
style: TextStyle(
fontSize: 11,
fontWeight:
isSelected ? FontWeight.bold : FontWeight.normal,
color:
isSelected ? Colors.white : AppColor.primaryColor,
return Obx(() {
final isSelected = c.currentTabIndex.value == index;
return GestureDetector(
onTap: () => c.currentTabIndex.value = index,
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 3),
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
decoration: BoxDecoration(
color: isSelected
? AppColor.primaryColor
: AppColor.primaryLight,
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
c.tabIcons[key] ?? Icons.image,
size: 16,
color: isSelected ? Colors.white : AppColor.primaryColor,
),
),
],
const SizedBox(width: 4),
Text(
(c.tabLabels[key] ?? key).tr,
style: TextStyle(
fontSize: 11,
fontWeight:
isSelected ? FontWeight.bold : FontWeight.normal,
color:
isSelected ? Colors.white : AppColor.primaryColor,
),
),
],
),
),
),
);
);
});
},
),
);
@@ -106,8 +108,8 @@ class ReviewDriverPage extends StatelessWidget {
const SizedBox(width: 6),
Text(
c.country.isNotEmpty
? 'Country: ${c.country}'
: 'Detecting country...',
? '${'Country'.tr}: ${c.country.tr}'
: 'Detecting country...'.tr,
style: TextStyle(
fontSize: 13,
fontWeight: FontWeight.w600,

View File

@@ -18,7 +18,7 @@ class ReviewDriverController extends GetxController {
final Map<String, RxString> docUrls = {
'id_front': ''.obs,
'id_back': ''.obs,
'driver_license': ''.obs,
'driver_license_front': ''.obs,
'driver_license_back': ''.obs,
'car_license_front': ''.obs,
'car_license_back': ''.obs,
@@ -29,7 +29,7 @@ class ReviewDriverController extends GetxController {
final Map<String, String> tabLabels = {
'id_front': 'ID Front',
'id_back': 'ID Back',
'driver_license': 'Driver License',
'driver_license_front': 'Driver License',
'driver_license_back': 'License Back',
'car_license_front': 'Car Reg Front',
'car_license_back': 'Car Reg Back',
@@ -40,7 +40,7 @@ class ReviewDriverController extends GetxController {
final Map<String, IconData> tabIcons = {
'id_front': Icons.badge,
'id_back': Icons.badge_outlined,
'driver_license': Icons.drive_eta,
'driver_license_front': Icons.drive_eta,
'driver_license_back': Icons.drive_eta_outlined,
'car_license_front': Icons.description,
'car_license_back': Icons.description_outlined,
@@ -63,7 +63,7 @@ class ReviewDriverController extends GetxController {
['addressController', 'Address', false, false, false, false],
['maritalStatusController', 'Marital Status', false, false, false, false],
],
'driver_license': [
'driver_license_front': [
['licenseTypeController', 'License Type', false, false, false, false],
['licenseCategoriesController', 'License Categories', false, false, false, false],
['licenseIssueDateController', 'License Issue Date', true, false, false, false],
@@ -71,23 +71,20 @@ class ReviewDriverController extends GetxController {
],
'driver_license_back': [],
'car_license_front': [
['makeController', 'Make', false, false, false, false],
['modelController', 'Model', false, false, false, false],
['yearController', 'Year', false, false, false, false],
['ownerController', 'Owner Name', false, false, false, false],
['carPlateController', 'Car Plate', false, false, false, false],
['color', 'Car Color', false, false, true, false],
],
'car_license_back': [
['makeController', 'Make', false, false, false, false],
['modelController', 'Model', false, false, false, false],
['yearController', 'Year', false, false, false, false],
['fuel', 'Fuel Type', false, false, false, true],
['vinController', 'VIN / Chassis', false, false, false, false],
['carLicenseExpiryDateController', 'License Expiry', true, false, false, false],
],
'criminal_record': [],
'profile_picture': [
['phoneController', 'Phone Number', false, false, false, false],
['emailController', 'Email', false, false, false, false],
],
'profile_picture': [],
};
List<List<dynamic>> getFieldsForTab(String tabKey) {