fix marker rendering & modernize riding widgets for dark mode - 2026-04-11

This commit is contained in:
Hamza-Ayed
2026-04-11 01:14:09 +03:00
parent 3f03f25142
commit 454276d1e0
88 changed files with 50376 additions and 23310 deletions

View File

@@ -1,3 +1,4 @@
import 'package:Intaleq/print.dart';
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
@@ -11,25 +12,25 @@ Future<bool> verifyCertificateManually(
final certificate = socket.peerCertificate;
if (certificate == null) {
print("❌ لا يوجد شهادة.");
Log.print("❌ لا يوجد شهادة.");
return false;
}
final der = certificate.der;
final actualPin = base64.encode(sha256.convert(der).bytes);
print("📛 HOST: $host");
print("📜 Subject: ${certificate.subject}");
print("📜 Issuer: ${certificate.issuer}");
print("📅 Valid From: ${certificate.startValidity}");
print("📅 Valid To: ${certificate.endValidity}");
print(
Log.print("📛 HOST: $host");
Log.print("📜 Subject: ${certificate.subject}");
Log.print("📜 Issuer: ${certificate.issuer}");
Log.print("📅 Valid From: ${certificate.startValidity}");
Log.print("📅 Valid To: ${certificate.endValidity}");
Log.print(
"🔐 Server Pin: $actualPin${actualPin == expectedPin ? '✅ MATCH' : '❌ MISMATCH'}");
socket.destroy();
return actualPin == expectedPin;
} catch (e) {
print("❌ خطأ أثناء الاتصال أو الفحص: $e");
Log.print("❌ خطأ أثناء الاتصال أو الفحص: $e");
return false;
}
}
@@ -37,4 +38,4 @@ Future<bool> verifyCertificateManually(
/// تحويل المفتاح العام إلى بصمة SHA-256
List<int> sha256Convert(Uint8List der) {
return sha256.convert(der).bytes;
}
}

View File

@@ -1,4 +1,3 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
@@ -8,6 +7,7 @@ import 'package:url_launcher/url_launcher.dart';
import '../../constant/box_name.dart';
import '../../constant/links.dart';
import '../../main.dart';
import '../../print.dart';
import '../functions/crud.dart';
import '../../onbording_page.dart';
import 'login_controller.dart';
@@ -38,7 +38,9 @@ class GoogleSignInHelper {
// silent login if possible
try {
await _signIn.attemptLightweightAuthentication();
} catch (_) {}
} catch (e) {
Log.print("Error: $e");
}
}
/// ✅ تسجيل دخول عادي
@@ -46,16 +48,14 @@ class GoogleSignInHelper {
try {
final user =
await _signIn.authenticate(scopeHint: const ['email', 'profile']);
if (user != null) {
_lastUser = user;
await _handleSignUp(user);
_lastUser = user;
await _handleSignUp(user);
// اطبع القيم (للتأكد)
print("Google ID: ${user.id}");
print("Email: ${user.email}");
print("Name: ${user.displayName}");
print("Photo: ${user.photoUrl}");
}
// اطبع القيم (للتأكد)
Log.print("Google ID: ${user.id}");
Log.print("Email: ${user.email}");
Log.print("Name: ${user.displayName}");
Log.print("Photo: ${user.photoUrl}");
return user;
} on PlatformException catch (e) {
if (e.code == 'sign_in_required') {

View File

@@ -119,11 +119,11 @@ class PhoneAuthHelper {
if (response != 'failure') {
final data = (response);
// Log.print('data: ${data}');
Log.print('data: ${data}');
if (data['status'] == 'success') {
final isRegistered = data['message']['isRegistered'] ?? false;
// Log.print('isRegistered: ${isRegistered}');
Log.print('isRegistered: ${isRegistered}');
if (isRegistered) {
// ✅ المستخدم موجود مسبقاً -> تسجيل دخول مباشر
@@ -148,18 +148,14 @@ class PhoneAuthHelper {
static Future<void> _addTokens() async {
String fingerPrint = await DeviceHelper.getDeviceFingerprint();
await CRUD()
.post(link: "${AppLink.server}/ride/firebase/add.php", payload: {
'token': (box.read(BoxName.tokenFCM.toString())),
'passengerID': box.read(BoxName.passengerID).toString(),
"fingerPrint": fingerPrint
});
await CRUD()
.post(link: "${AppLink.paymentServer}/ride/firebase/add.php", payload: {
var res = await CRUD()
// this for register and login //
.post(link: "${AppLink.server}/ride/firebase/addToken.php", payload: {
'token': (box.read(BoxName.tokenFCM.toString())),
'passengerID': box.read(BoxName.passengerID).toString(),
"fingerPrint": fingerPrint
});
Log.print('res token: ${res}');
}
static Future<void> registerUser({

View File

@@ -75,7 +75,7 @@ class FirebaseMessagesController extends GetxController {
// 🔹 الاشتراك في topic
await fcmToken
.subscribeToTopic("passengers"); // أو "users" حسب نوع المستخدم
print("Subscribed to 'passengers' topic ✅");
Log.print("Subscribed to 'passengers' topic ✅");
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
// If the app is in the background or terminated, show a system tray message
@@ -132,7 +132,7 @@ class FirebaseMessagesController extends GetxController {
// 🔥 فك التشفير: تحويل الـ String إلى Map
driverInfoMap = jsonDecode(rawJson);
} catch (e) {
print("❌ Error decoding FCM driver_info: $e");
Log.print("❌ Error decoding FCM driver_info: $e");
}
}
@@ -209,7 +209,7 @@ class FirebaseMessagesController extends GetxController {
try {
driverList = jsonDecode(rawData) as List<dynamic>;
} catch (e) {
print("❌ Error decoding DriverList: $e");
Log.print("❌ Error decoding DriverList: $e");
}
}
@@ -485,7 +485,7 @@ class FirebaseMessagesController extends GetxController {
// // token: driverList[0].toString(),
// // remoteID: driverList[2].toString(),
// // ));
// } catch (e) {}
// } catch (e) { Log.print("Error occurred: $e"); }
// } else if (message.notification!.title! == 'Call Income from Driver'.tr) {
// try {
// var myListString = message.data['DriverList'];
@@ -504,7 +504,7 @@ class FirebaseMessagesController extends GetxController {
// // token: driverList[0].toString(),
// // remoteID: driverList[2].toString(),
// // ));
// } catch (e) {}
// } catch (e) { Log.print("Error occurred: $e"); }
// } else if (message.notification!.title! == 'Call End'.tr) {
// try {
// var myListString = message.data['DriverList'];
@@ -518,7 +518,7 @@ class FirebaseMessagesController extends GetxController {
// }
// // Assuming GetMaterialApp is initialized and context is valid for navigation
// // Get.off(const CallPage());
// } catch (e) {}
// } catch (e) { Log.print("Error occurred: $e"); }
// } else if (message.notification!.title! == 'Driver Cancelled Your Trip') {
// // Get.snackbar(
// // 'You will be pay the cost to driver or we will get it from you on next trip'
@@ -569,13 +569,13 @@ class FirebaseMessagesController extends GetxController {
snackPosition: SnackPosition.TOP,
titleText: Text(
'Applied'.tr,
style: const TextStyle(color: AppColor.redColor),
style: TextStyle(color: AppColor.redColor),
),
messageText: Text(
'Driver Applied the Ride for You'.tr,
style: AppStyle.title,
),
icon: const Icon(Icons.approval),
icon: Icon(Icons.approval, color: AppColor.primaryColor),
shouldIconPulse: true,
margin: const EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
@@ -659,7 +659,7 @@ class DriverTipWidget extends StatelessWidget {
Toast.show(
context,
'${'Tip is '.tr}${(controller.totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}',
AppColor.blueColor);
AppColor.cyanBlue);
controller.update();
},
child: Container(
@@ -678,7 +678,7 @@ class DriverTipWidget extends StatelessWidget {
Toast.show(
context,
'${'Tip is'.tr} ${(controller.totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}',
AppColor.blueColor);
AppColor.cyanBlue);
controller.update();
},
child: Container(
@@ -697,7 +697,7 @@ class DriverTipWidget extends StatelessWidget {
Toast.show(
context,
'${'Tip is'.tr} ${(controller.totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}',
AppColor.blueColor);
AppColor.cyanBlue);
controller.update();
},
child: Container(
@@ -716,7 +716,7 @@ class DriverTipWidget extends StatelessWidget {
Toast.show(
context,
'${'Tip is'.tr} ${(controller.totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}',
AppColor.blueColor);
AppColor.cyanBlue);
controller.update();
},
child: Container(

View File

@@ -1,3 +1,4 @@
import 'package:Intaleq/print.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -13,7 +14,7 @@ class _LiveActivityScreenState extends State<LiveActivityScreen> {
try {
await platform.invokeMethod('startLiveActivity');
} on PlatformException catch (e) {
print("Failed to start Live Activity: '${e.message}'.");
Log.print("Failed to start Live Activity: '${e.message}'.");
}
}
@@ -21,7 +22,7 @@ class _LiveActivityScreenState extends State<LiveActivityScreen> {
try {
await platform.invokeMethod('updateLiveActivity', {"progress": progress});
} on PlatformException catch (e) {
print("Failed to update Live Activity: '${e.message}'.");
Log.print("Failed to update Live Activity: '${e.message}'.");
}
}
@@ -29,7 +30,7 @@ class _LiveActivityScreenState extends State<LiveActivityScreen> {
try {
await platform.invokeMethod('endLiveActivity');
} on PlatformException catch (e) {
print("Failed to end Live Activity: '${e.message}'.");
Log.print("Failed to end Live Activity: '${e.message}'.");
}
}
@@ -56,4 +57,4 @@ class _LiveActivityScreenState extends State<LiveActivityScreen> {
),
);
}
}
}

View File

@@ -1,3 +1,4 @@
import 'package:Intaleq/print.dart';
import 'dart:async';
import 'dart:io';
@@ -38,7 +39,7 @@ class NotificationController extends GetxController {
settings: initializationSettings);
tz.initializeTimeZones();
print('Notifications initialized');
Log.print('Notifications initialized');
}
// Displays a notification with the given title and message
@@ -63,7 +64,7 @@ class NotificationController extends GetxController {
NotificationDetails(android: android, iOS: ios);
await _flutterLocalNotificationsPlugin.show(
id: 0, title: title, body: message, notificationDetails: details);
print('Notification shown: $title - $message');
Log.print('Notification shown: $title - $message');
}
// /Users/hamzaaleghwairyeen/development/App/ride 2/lib/controller/firebase/local_notification.dart
@@ -93,9 +94,9 @@ class NotificationController extends GetxController {
// if (Platform.isAndroid) {
// if (await Permission.scheduleExactAlarm.isDenied) {
// if (await Permission.scheduleExactAlarm.request().isGranted) {
// print('SCHEDULE_EXACT_ALARM permission granted');
// Log.print('SCHEDULE_EXACT_ALARM permission granted');
// } else {
// print('SCHEDULE_EXACT_ALARM permission denied');
// Log.print('SCHEDULE_EXACT_ALARM permission denied');
// return;
// }
// }
@@ -116,7 +117,7 @@ class NotificationController extends GetxController {
// day, 20, 0, title, message, details, day * 1000 + 3); // Unique ID
// }
// print('Notifications scheduled successfully for the next 7 days');
// Log.print('Notifications scheduled successfully for the next 7 days');
// }
void scheduleNotificationsForSevenDays(
String title, String message, String tone) async {
@@ -142,9 +143,9 @@ class NotificationController extends GetxController {
if (Platform.isAndroid) {
if (await Permission.scheduleExactAlarm.isDenied) {
if (await Permission.scheduleExactAlarm.request().isGranted) {
print('SCHEDULE_EXACT_ALARM permission granted');
Log.print('SCHEDULE_EXACT_ALARM permission granted');
} else {
print('SCHEDULE_EXACT_ALARM permission denied');
Log.print('SCHEDULE_EXACT_ALARM permission denied');
return;
}
}
@@ -180,12 +181,12 @@ class NotificationController extends GetxController {
// Mark this notification ID as scheduled in GetStorage
box.write('notification_$notificationId', true);
} else {
print('Notification with ID $notificationId is already scheduled.');
Log.print('Notification with ID $notificationId is already scheduled.');
}
}
}
print('Notifications scheduled successfully for the next 7 days');
Log.print('Notifications scheduled successfully for the next 7 days');
}
void scheduleNotificationsForTimeSelected(
@@ -212,9 +213,9 @@ class NotificationController extends GetxController {
if (Platform.isAndroid) {
if (await Permission.scheduleExactAlarm.isDenied) {
if (await Permission.scheduleExactAlarm.request().isGranted) {
print('SCHEDULE_EXACT_ALARM permission granted');
Log.print('SCHEDULE_EXACT_ALARM permission granted');
} else {
print('SCHEDULE_EXACT_ALARM permission denied');
Log.print('SCHEDULE_EXACT_ALARM permission denied');
return;
}
}
@@ -237,7 +238,7 @@ class NotificationController extends GetxController {
2, // Unique ID for 30-minute before notification
);
print('Notifications scheduled successfully for the time selected');
Log.print('Notifications scheduled successfully for the time selected');
}
Future<void> _scheduleNotificationForTimeVIP(
@@ -262,13 +263,13 @@ class NotificationController extends GetxController {
.subtract(const Duration(minutes: 10))
.isBefore(now)) {
// If the 10 minutes before the scheduled time is in the past, don't schedule
print(
Log.print(
'Scheduled time minus 10 minutes is in the past. Skipping notification.');
return; // Skip this notification
}
print('Current time (Cairo): $now');
print('Scheduling notification for: $scheduledTZDateTime');
Log.print('Current time (Cairo): $now');
Log.print('Scheduling notification for: $scheduledTZDateTime');
await _flutterLocalNotificationsPlugin.zonedSchedule(
id: notificationId, // Unique ID for each notification
@@ -283,7 +284,7 @@ class NotificationController extends GetxController {
null, // Don't repeat automatically; we handle manually
);
print('Notification scheduled successfully for: $scheduledTZDateTime');
Log.print('Notification scheduled successfully for: $scheduledTZDateTime');
}
Future<void> _scheduleNotificationForTime(
@@ -314,8 +315,8 @@ class NotificationController extends GetxController {
scheduledDate = scheduledDate.add(const Duration(days: 1));
}
print('Current time (Cairo): $now');
print('Scheduling notification for: $scheduledDate');
Log.print('Current time (Cairo): $now');
Log.print('Scheduling notification for: $scheduledDate');
await _flutterLocalNotificationsPlugin.zonedSchedule(
id: notificationId, // Unique ID for each notification
@@ -330,6 +331,6 @@ class NotificationController extends GetxController {
null, // Don't repeat automatically; we handle 7 days manually
);
print('Notification scheduled successfully for: $scheduledDate');
Log.print('Notification scheduled successfully for: $scheduledDate');
}
}
}

View File

@@ -1,6 +1,8 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:get/get.dart'; // للترجمة .tr
import 'package:get/get.dart';
import '../../print.dart'; // للترجمة .tr
class NotificationService {
static const String _serverUrl =
@@ -50,14 +52,15 @@ class NotificationService {
);
if (response.statusCode == 200) {
print('✅ Notification sent successfully.');
// print('Response: ${response.body}');
Log.print('✅ Notification sent successfully.');
// Log.print('Response: ${response.body}');
} else {
print('❌ Failed to send notification. Code: ${response.statusCode}');
print('Error Body: ${response.body}');
Log.print(
'❌ Failed to send notification. Code: ${response.statusCode}');
Log.print('Error Body: ${response.body}');
}
} catch (e) {
print('❌ Error sending notification: $e');
Log.print('❌ Error sending notification: $e');
}
}
}

View File

@@ -1,3 +1,4 @@
import 'package:Intaleq/print.dart';
import 'dart:io';
// import 'package:flutter_sound/flutter_sound.dart';
@@ -24,7 +25,7 @@ class AudioRecorderController extends GetxController {
await audioPlayer.setAsset(sound);
audioPlayer.play();
} catch (e) {
print("Error playing sound: $e");
Log.print("Error playing sound: $e");
}
}
@@ -163,4 +164,4 @@ class AudioRecorderController extends GetxController {
recorder.dispose();
super.onClose();
}
}
}

View File

@@ -65,7 +65,9 @@ class CRUD {
'details': details,
},
);
} catch (e) {}
} catch (e) {
Log.print("Error occurred: $e");
}
}
// ─────────────────────────────────────────────────────────────
@@ -414,7 +416,9 @@ class CRUD {
} else {
String errorBody = await response.stream.bytesToString();
}
} catch (e) {}
} catch (e) {
Log.print("Error occurred: $e");
}
}
Future<dynamic> getAgoraToken({
@@ -558,7 +562,7 @@ class CRUD {
var request = http.Request('POST', Uri.parse(link));
request.bodyFields = payload!;
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
await request.send();
}
Future<dynamic> postFromDialogue({
@@ -596,7 +600,7 @@ class CRUD {
final Uri verificationUri = Uri.parse(
'https://verify.twilio.com/v2/Services/$verifySid/Verifications');
final response = await http.post(
await http.post(
verificationUri,
headers: {
'Authorization':
@@ -647,18 +651,26 @@ class CRUD {
}
}
Future<dynamic> delete({
required String endpoint,
required String id,
Future<dynamic> getMapSaas({
required String link,
}) async {
var url = Uri.parse('$endpoint/$id');
var response = await http.delete(
url,
headers: {
'Authorization':
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
},
);
return json.decode(response.body);
var url = Uri.parse(link);
try {
var response = await http.get(
url,
headers: {
'Content-Type': 'application/json',
'x-api-key': Env.mapSaasKey,
},
);
if (response.statusCode == 200) {
return jsonDecode(response.body);
}
Log.print('MapSaas Error: ${response.statusCode} - ${response.body}');
return null;
} catch (e) {
Log.print('MapSaas Exception: $e');
return null;
}
}
}

View File

@@ -78,7 +78,7 @@ class DeviceInfoPlus {
};
deviceDataList.add(deviceData);
}
} catch (e) {}
} catch (e) { Log.print("Error occurred: $e"); }
return deviceDataList;
}

View File

@@ -1,3 +1,4 @@
import 'package:Intaleq/print.dart';
import 'package:url_launcher/url_launcher.dart';
import 'dart:io';
@@ -41,7 +42,7 @@ Future<void> makePhoneCall(String phoneNumber) async {
}
} catch (e) {
// طباعة الخطأ في حال الفشل التام
print("Error launching call: $e");
Log.print("Error launching call: $e");
}
}
@@ -104,4 +105,4 @@ void launchCommunication(
if (await canLaunchUrl(Uri.parse(url))) {
await launchUrl(Uri.parse(url));
} else {}
}
}

View File

@@ -20,7 +20,7 @@ Future<void> checkForUpdate(BuildContext context) async {
final packageInfo = await PackageInfo.fromPlatform();
final currentVersion = packageInfo.buildNumber;
final version = packageInfo.version;
print('currentVersion is : $currentVersion');
Log.print('currentVersion is : $currentVersion');
// Fetch the latest version from your server
String latestVersion = box.read(BoxName.package);
box.write(BoxName.packagInfo, version);
@@ -238,11 +238,11 @@ class SecurityHelper {
debugPrint("checkForIssues: $checkForIssues");
debugPrint("isDevMode: $isDevMode");
debugPrint("isTampered: $isTampered");
debugPrint("Bundle ID: $bundleId"); // Print the bundle ID
debugPrint("Bundle ID: $bundleId"); //Log.print the bundle ID
// Check for security risks and potentially show a warning
if (isJailBroken || isRealDevice == false || isTampered) {
// print("security_warning".tr); //using easy_localization
// Log.print("security_warning".tr); //using easy_localization
// Use a more robust approach to show a warning, like a dialog:
_showSecurityWarning();
} else {
@@ -309,7 +309,7 @@ class SecurityHelper {
await storage.deleteAll();
await box.erase();
exit(0); // Exit the app
print('exit');
Log.print('exit');
}
}
@@ -349,7 +349,7 @@ class DeviceHelper {
final String encryptedFp =
EncryptionHelper.instance.encryptData(fingerprint);
box.write(BoxName.deviceFpEncrypted, encryptedFp);
// print(EncryptionHelper.instance.encryptData(fingerprint));
//Log.print(EncryptionHelper.instance.encryptData(fingerprint));
return encryptedFp;
} catch (e) {
throw Exception('Failed to generate device fingerprint');

View File

@@ -1,3 +1,4 @@
import 'package:Intaleq/print.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
@@ -15,7 +16,7 @@ class SecurityChecks {
.invokeMethod('isNativeRooted'); // Invoke the native method
return result;
} on PlatformException catch (e) {
print("Failed to check security status: ${e.message}");
Log.print("Failed to check security status: ${e.message}");
return true; // Treat platform errors as a compromised device (for safety)
}
}
@@ -46,7 +47,7 @@ class SecurityChecks {
box.write(BoxName.security_check, 'passed');
print("Device is secure.");
Log.print("Device is secure.");
}
}
}
}

View File

@@ -1,3 +1,4 @@
import 'package:Intaleq/print.dart';
import 'dart:async';
import 'package:app_links/app_links.dart';
import 'package:get/get.dart';
@@ -18,7 +19,7 @@ class DeepLinkController extends GetxController {
Future<void> initDeepLinks() async {
// الاستماع للروابط والتطبيق يعمل في الخلفية
_linkSubscription = _appLinks.uriLinkStream.listen((uri) {
print('🔗 Received deep link (Stream): $uri');
Log.print('🔗 Received deep link (Stream): $uri');
rawDeepLink.value = uri.toString();
});
@@ -26,11 +27,11 @@ class DeepLinkController extends GetxController {
try {
final initialUri = await _appLinks.getInitialLink();
if (initialUri != null) {
print('🔗 Received initial deep link (Cold Start): $initialUri');
Log.print('🔗 Received initial deep link (Cold Start): $initialUri');
rawDeepLink.value = initialUri.toString();
}
} catch (e) {
print('Error getting initial link: $e');
Log.print('Error getting initial link: $e');
}
}
@@ -39,4 +40,4 @@ class DeepLinkController extends GetxController {
_linkSubscription?.cancel();
super.onClose();
}
}
}

View File

@@ -1,3 +1,4 @@
import 'package:Intaleq/print.dart';
import 'dart:io';
import 'dart:convert';
import 'package:live_activities/live_activities.dart';
@@ -41,7 +42,7 @@ class IosLiveActivityService {
activityModel,
);
} catch (e) {
print("❌ Live Activity Start Error: $e");
Log.print("❌ Live Activity Start Error: $e");
}
}
@@ -70,4 +71,4 @@ class IosLiveActivityService {
await _liveActivitiesPlugin.endActivity(_activityId!);
_activityId = null;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -129,9 +129,9 @@ ${'Download the Intaleq app now and enjoy your ride!'.tr}
// **IMPROVEMENT**: Provide feedback if some contacts were filtered out.
if (contactsWithPhones < totalContactsOnDevice) {
Get.snackbar('Contacts Loaded'.tr,
'${'Showing'.tr} $contactsWithPhones ${'of'.tr} $totalContactsOnDevice ${'contacts. Others were hidden because they don\'t have a phone number.'.tr}',
snackPosition: SnackPosition.BOTTOM);
// Get.snackbar('Contacts Loaded'.tr,
// '${'Showing'.tr} $contactsWithPhones ${'of'.tr} $totalContactsOnDevice ${'contacts. Others were hidden because they don\'t have a phone number.'.tr}',
// snackPosition: SnackPosition.BOTTOM);
}
} else {
Get.snackbar('No contacts found'.tr,

View File

@@ -1,3 +1,4 @@
import 'package:Intaleq/print.dart';
import 'dart:async';
import 'dart:math';
import 'package:Intaleq/controller/functions/crud.dart';
@@ -169,7 +170,7 @@ class SplashScreenController extends GetxController
box.write(BoxName.packagInfo, info.version);
update();
} catch (e) {
print("Could not get package info: $e");
Log.print("Could not get package info: $e");
}
}
@@ -225,4 +226,4 @@ class SplashScreenController extends GetxController
_glowController.dispose();
super.onClose();
}
}
}

View File

@@ -9,96 +9,46 @@ class LocaleController extends GetxController {
Locale? language;
String countryCode = '';
ThemeData appTheme = lightThemeEnglish;
ThemeMode themeMode = ThemeMode.system;
void changeLang(String langcode) {
Locale locale;
switch (langcode) {
case "ar":
locale = const Locale("ar");
appTheme = lightThemeArabic;
box.write(BoxName.lang, 'ar');
break;
case "ar-main":
locale = const Locale("ar-main");
appTheme = lightThemeArabic;
box.write(BoxName.lang, 'ar-main');
break;
case "en":
locale = const Locale("en");
appTheme = lightThemeEnglish;
box.write(BoxName.lang, 'en');
break;
case "tr":
locale = const Locale("tr");
appTheme = lightThemeEnglish;
box.write(BoxName.lang, 'tr');
break;
case "fr":
locale = const Locale("fr");
appTheme = lightThemeEnglish;
box.write(BoxName.lang, 'fr');
break;
case "it":
locale = const Locale("it");
appTheme = lightThemeEnglish;
box.write(BoxName.lang, 'it');
break;
case "de":
locale = const Locale("de");
appTheme = lightThemeEnglish;
box.write(BoxName.lang, 'de');
break;
case "el":
locale = const Locale("el");
appTheme = lightThemeEnglish;
box.write(BoxName.lang, 'el');
break;
case "es":
locale = const Locale("es");
appTheme = lightThemeEnglish;
box.write(BoxName.lang, 'es');
break;
case "fa":
locale = const Locale("fa");
appTheme = lightThemeEnglish;
box.write(BoxName.lang, 'fa');
break;
case "zh":
locale = const Locale("zh");
appTheme = lightThemeEnglish;
box.write(BoxName.lang, 'zh');
break;
case "ru":
locale = const Locale("ru");
appTheme = lightThemeEnglish;
box.write(BoxName.lang, 'ru');
break;
case "hi":
locale = const Locale("hi");
appTheme = lightThemeEnglish;
box.write(BoxName.lang, 'hi');
break;
case "ar-ma":
locale = const Locale("ar-ma");
appTheme = lightThemeArabic;
box.write(BoxName.lang, 'ar-ma');
break;
case "ar-gulf":
locale = const Locale("ar-gulf");
appTheme = lightThemeArabic;
box.write(BoxName.lang, 'ar-gulf');
break;
default:
locale = Locale(Get.deviceLocale!.languageCode);
box.write(BoxName.lang, Get.deviceLocale!.languageCode);
appTheme = lightThemeEnglish;
break;
Locale newLocale;
ThemeData newTheme;
bool isArabic = langcode.startsWith('ar');
if (isArabic) {
newLocale = const Locale("ar");
newTheme = Get.isDarkMode ? darkThemeArabic : lightThemeArabic;
} else {
newLocale = const Locale("en");
newTheme = Get.isDarkMode ? darkThemeEnglish : lightThemeEnglish;
}
box.write(BoxName.lang, langcode);
Get.changeTheme(appTheme);
Get.updateLocale(locale);
language = newLocale;
Get.changeTheme(newTheme);
Get.updateLocale(newLocale);
update();
}
void changeThemeMode(ThemeMode mode) {
themeMode = mode;
Get.changeThemeMode(mode);
// Explicitly update ThemeData to ensure immediate font and color changes
bool goDark = mode == ThemeMode.dark ||
(mode == ThemeMode.system && Get.isPlatformDarkMode);
bool isArabic = (language?.languageCode ?? 'en').startsWith('ar');
ThemeData newTheme;
if (isArabic) {
newTheme = goDark ? darkThemeArabic : lightThemeArabic;
} else {
newTheme = goDark ? darkThemeEnglish : lightThemeEnglish;
}
Get.changeTheme(newTheme);
box.write(BoxName.themeMode, mode.toString());
update();
}
@@ -111,95 +61,18 @@ class LocaleController extends GetxController {
box.write(BoxName.lang, storedLang);
}
String? storedTheme = box.read(BoxName.themeMode);
if (storedTheme != null) {
if (storedTheme == ThemeMode.light.toString()) {
themeMode = ThemeMode.light;
} else if (storedTheme == ThemeMode.dark.toString()) {
themeMode = ThemeMode.dark;
} else {
themeMode = ThemeMode.system;
}
}
changeLang(storedLang);
super.onInit();
}
}
// class LocaleController extends GetxController {
// Locale? language;
// String countryCode = '';
// void restartApp() {
// runApp(const MyApp());
// }
// ThemeData appTheme = themeEnglish;
// changeLang(String langcode) {
// Locale locale;
// switch (langcode) {
// case "ar":
// locale = const Locale("ar");
// appTheme = themeArabic;
// break;
// case "en":
// locale = const Locale("en");
// appTheme = themeEnglish;
// break;
// case "tr":
// locale = const Locale("tr");
// appTheme = themeEnglish;
// break;
// case "fr":
// locale = const Locale("fr");
// appTheme = themeEnglish;
// break;
// case "it":
// locale = const Locale("it");
// appTheme = themeEnglish;
// break;
// case "de":
// locale = const Locale("de");
// appTheme = themeEnglish;
// break;
// case "el":
// locale = const Locale("el");
// appTheme = themeEnglish;
// break;
// case "es":
// locale = const Locale("es");
// appTheme = themeEnglish;
// break;
// case "fa":
// locale = const Locale("fa");
// appTheme = themeArabic;
// break;
// case "zh":
// locale = const Locale("zh");
// appTheme = themeEnglish;
// break;
// case "ru":
// locale = const Locale("ru");
// appTheme = themeEnglish;
// break;
// case "hi":
// locale = const Locale("hi");
// appTheme = themeEnglish;
// break;
// default:
// locale = Locale(Get.deviceLocale!.languageCode);
// appTheme = themeEnglish;
// break;
// }
// box.write(BoxName.lang, langcode);
// Get.changeTheme(appTheme);
// Get.updateLocale(locale);
// restartApp();
// update();
// }
// @override
// void onInit() {
// String? storedLang = box.read(BoxName.lang);
// if (storedLang == null) {
// // Use device language if no language is stored
// storedLang = Get.deviceLocale!.languageCode;
// box.write(BoxName.lang, storedLang);
// }
// changeLang(storedLang);
// super.onInit();
// }
// }

View File

@@ -1,5 +1,6 @@
library intl_phone_field;
import 'package:Intaleq/print.dart';
import 'dart:async';
import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:flutter/material.dart';
@@ -77,7 +78,7 @@ class IntlPhoneField extends StatefulWidget {
/// to the [focusNode]:
///
/// ```dart
/// focusNode.addListener(() { print(myFocusNode.hasFocus); });
/// focusNode.addListener(() { Log.print(myFocusNode.hasFocus); });
/// ```
///
/// If null, this widget will create its own [FocusNode].
@@ -518,4 +519,4 @@ class _IntlPhoneFieldState extends State<IntlPhoneField> {
enum IconPosition {
leading,
trailing,
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -295,8 +295,8 @@ class PaymentController extends GetxController {
)),
allowsDelayedPaymentMethods: true,
customerEphemeralKeySecret: Stripe.merchantIdentifier,
appearance: const PaymentSheetAppearance(
shapes: PaymentSheetShape(borderRadius: 12),
appearance: PaymentSheetAppearance(
shapes: const PaymentSheetShape(borderRadius: 12),
colors: PaymentSheetAppearanceColors(
background: AppColor.secondaryColor,
),
@@ -691,8 +691,8 @@ class PaymentController extends GetxController {
// final passengerID = box.read(BoxName.passengerID).toString();
// final formattedAmount = double.parse(amount).toStringAsFixed(0);
// print("🚀 بدء عملية دفع MTN");
// print(
// Log.print("🚀 بدء عملية دفع MTN");
// Log.print(
// "📦 Payload: passengerID: $passengerID, amount: $formattedAmount, phone: $phone");
// // التحقق بالبصمة (اختياري) + حماية من الـ await
@@ -704,7 +704,7 @@ class PaymentController extends GetxController {
// );
// if (!didAuth) {
// if (Get.isDialogOpen == true) Get.back();
// print("❌ المستخدم لم يؤكد بالبصمة/الوجه");
// Log.print("❌ المستخدم لم يؤكد بالبصمة/الوجه");
// return;
// }
// }
@@ -720,8 +720,8 @@ class PaymentController extends GetxController {
// },
// );
// // print("✅ استجابة الخادم (mtn_start_payment.php):");
// // print(responseData);
// // Log.print("✅ استجابة الخادم (mtn_start_payment.php):");
// // Log.print(responseData);
// Log.print('responseData: ${responseData}');
// // فحص الاستجابة بقوة
@@ -745,7 +745,7 @@ class PaymentController extends GetxController {
// final operationNumber = messageData["operationNumber"].toString();
// final guid = messageData["guid"].toString();
// // print(
// // Log.print(
// // "📄 invoiceNumber: $invoiceNumber, 🔢 operationNumber: $operationNumber, 🧭 guid: $guid");
// // أغلق السبينر قبل إظهار حوار OTP
@@ -780,10 +780,10 @@ class PaymentController extends GetxController {
// ).then((res) => otpInput = (res ?? "") as String);
// if (otpInput.isEmpty) {
// print("❌ لم يتم إدخال OTP");
// Log.print("❌ لم يتم إدخال OTP");
// return;
// }
// print("🔐 تم إدخال OTP: $otpInput");
// Log.print("🔐 تم إدخال OTP: $otpInput");
// // سبينر أثناء التأكيد
// Get.dialog(const Center(child: CircularProgressIndicator()),
@@ -804,7 +804,7 @@ class PaymentController extends GetxController {
// if (Get.isDialogOpen == true) Get.back();
// // print("✅ استجابة mtn_confirm.php:");
// // Log.print("✅ استجابة mtn_confirm.php:");
// // Log.print('confirmRes: ${confirmRes}');
// final ok = (confirmRes is Map && confirmRes['status'] == 'success');
@@ -820,9 +820,9 @@ class PaymentController extends GetxController {
// Get.defaultDialog(title: "❌ فشل", content: Text(errorMsg.tr));
// }
// } catch (e, s) {
// print("🔥 خطأ أثناء الدفع عبر MTN:");
// print(e);
// print(s);
// Log.print("🔥 خطأ أثناء الدفع عبر MTN:");
// Log.print(e);
// Log.print(s);
// if (Get.isDialogOpen == true) Get.back();
// Get.defaultDialog(
// title: 'حدث خطأ',
@@ -853,8 +853,8 @@ class PaymentController extends GetxController {
final passengerId = box.read(BoxName.passengerID).toString();
final formattedAmount = double.parse(amount).toStringAsFixed(0);
print("🚀 Syriatel payment start");
print(
Log.print("🚀 Syriatel payment start");
Log.print(
"📦 Payload => passengerId:$passengerId amount:$formattedAmount phone:$phone");
// مصادقة حيوية (اختياري)
@@ -865,7 +865,7 @@ class PaymentController extends GetxController {
);
if (!ok) {
_closeAnyDialog();
print("❌ User did not authenticate");
Log.print("❌ User did not authenticate");
return;
}
}
@@ -881,7 +881,7 @@ class PaymentController extends GetxController {
},
);
print("✅ Server response (start): $startRaw");
Log.print("✅ Server response (start): $startRaw");
// تحويل الاستجابة إلى Map
late final Map<String, dynamic> startRes;
@@ -901,7 +901,7 @@ class PaymentController extends GetxController {
final messageData = startRes['message'] as Map<String, dynamic>;
final transactionID = messageData['transactionID'].toString();
print("📄 transactionID: $transactionID");
Log.print("📄 transactionID: $transactionID");
//
// 2) اطلب من المستخدم إدخال OTP عبر Get.dialog (بدون context)
_closeAnyDialog(); // أغلق اللودينغ أولاً
@@ -929,10 +929,10 @@ class PaymentController extends GetxController {
);
if (otp == null || otp.isEmpty) {
print("❌ OTP not provided");
Log.print("❌ OTP not provided");
return;
}
print("🔐 OTP: $otp");
Log.print("🔐 OTP: $otp");
await _showLoading();
@@ -947,7 +947,7 @@ class PaymentController extends GetxController {
_closeAnyDialog(); // أغلق اللودينغ
print("✅ Response (confirm): $confirmRaw");
Log.print("✅ Response (confirm): $confirmRaw");
late final Map<String, dynamic> confirmRes;
if (confirmRaw is Map<String, dynamic>) {
@@ -971,7 +971,7 @@ class PaymentController extends GetxController {
);
}
} catch (e, s) {
print("🔥 Error during Syriatel Wallet payment:\n$e\n$s");
Log.print("🔥 Error during Syriatel Wallet payment:\n$e\n$s");
_closeAnyDialog();
Get.defaultDialog(
title: 'حدث خطأ',
@@ -1013,7 +1013,7 @@ class _EcashDriverPaymentScreenState extends State<EcashDriverPaymentScreen> {
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setNavigationDelegate(NavigationDelegate(
onPageFinished: (url) async {
print('Ecash Driver WebView URL Finished: $url');
Log.print('Ecash Driver WebView URL Finished: $url');
await Get.find<PaymentController>().getPassengerWallet();
// هنا نتحقق فقط من أن المستخدم عاد إلى صفحة النجاح
// لا حاجة لاستدعاء أي API هنا، فالـ Webhook يقوم بكل العمل

View File

@@ -1,3 +1,4 @@
import 'package:Intaleq/print.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:webview_flutter/webview_flutter.dart';
@@ -23,7 +24,7 @@ class _EcashPaymentScreenState extends State<EcashPaymentScreen> {
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setNavigationDelegate(NavigationDelegate(
onPageFinished: (url) {
print('Ecash WebView URL Finished: $url');
Log.print('Ecash WebView URL Finished: $url');
// ✅ هنا نتحقق فقط من أن المستخدم عاد إلى صفحة النجاح
// هذه الصفحة هي التي حددناها في `APP_REDIRECT_URL_SUCCESS` في ملف PHP
@@ -96,4 +97,4 @@ class _EcashPaymentScreenState extends State<EcashPaymentScreen> {
body: WebViewWidget(controller: _controller),
);
}
}
}

View File

@@ -42,36 +42,34 @@ ThemeData lightThemeEnglish = ThemeData(
ThemeData darkThemeEnglish = ThemeData(
brightness: Brightness.dark,
fontFamily: "SFPro",
primaryColor: AppColor.primaryColor,
scaffoldBackgroundColor: const Color(0xFF121212),
cardColor: const Color(0xFF1E1E1E),
textTheme: TextTheme(
displaySmall: AppStyle.title,
displayLarge: AppStyle.headTitle,
displayMedium: AppStyle.headTitle2,
bodyLarge: AppStyle.title,
bodyMedium: AppStyle.subtitle,
displaySmall: AppStyle.title.copyWith(color: Colors.white),
displayLarge: AppStyle.headTitle.copyWith(color: Colors.white),
displayMedium: AppStyle.headTitle2.copyWith(color: Colors.white),
bodyLarge: AppStyle.title.copyWith(color: Colors.white70),
bodyMedium: AppStyle.subtitle.copyWith(color: Colors.white60),
),
primarySwatch: Colors.blue,
dialogTheme: DialogThemeData(
backgroundColor: AppColor.secondaryColor,
contentTextStyle: AppStyle.title,
titleTextStyle: AppStyle.headTitle2,
primarySwatch: Colors.green,
dialogTheme: const DialogThemeData(
backgroundColor: Color(0xFF1E1E1E),
contentTextStyle: TextStyle(color: Colors.white),
titleTextStyle: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
),
appBarTheme: AppBarTheme(
appBarTheme: const AppBarTheme(
elevation: 0,
color: AppColor.secondaryColor,
color: Color(0xFF121212),
centerTitle: true,
iconTheme: const IconThemeData(
color: AppColor.primaryColor,
iconTheme: IconThemeData(
color: Colors.white,
),
titleTextStyle: TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold,
),
toolbarTextStyle: TextTheme(
titleSmall: AppStyle.subtitle,
headlineSmall: AppStyle.title,
titleLarge: AppStyle.headTitle2,
).bodyMedium,
titleTextStyle: TextTheme(
titleSmall: AppStyle.subtitle,
headlineSmall: AppStyle.title,
titleLarge: AppStyle.headTitle2,
).titleLarge,
),
);
@@ -114,35 +112,33 @@ ThemeData lightThemeArabic = ThemeData(
ThemeData darkThemeArabic = ThemeData(
brightness: Brightness.dark,
fontFamily: 'SFArabic',
primaryColor: AppColor.primaryColor,
scaffoldBackgroundColor: const Color(0xFF121212),
cardColor: const Color(0xFF1E1E1E),
textTheme: TextTheme(
displaySmall: AppStyle.title,
displayLarge: AppStyle.headTitle,
displayMedium: AppStyle.headTitle2,
bodyLarge: AppStyle.title,
bodyMedium: AppStyle.subtitle,
displaySmall: AppStyle.title.copyWith(color: Colors.white),
displayLarge: AppStyle.headTitle.copyWith(color: Colors.white),
displayMedium: AppStyle.headTitle2.copyWith(color: Colors.white),
bodyLarge: AppStyle.title.copyWith(color: Colors.white70),
bodyMedium: AppStyle.subtitle.copyWith(color: Colors.white60),
),
primarySwatch: Colors.blue,
dialogTheme: DialogThemeData(
backgroundColor: AppColor.secondaryColor,
contentTextStyle: AppStyle.title,
titleTextStyle: AppStyle.headTitle2,
primarySwatch: Colors.green,
dialogTheme: const DialogThemeData(
backgroundColor: Color(0xFF1E1E1E),
contentTextStyle: TextStyle(color: Colors.white),
titleTextStyle: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
),
appBarTheme: AppBarTheme(
appBarTheme: const AppBarTheme(
elevation: 0,
color: AppColor.secondaryColor,
color: Color(0xFF121212),
centerTitle: true,
iconTheme: const IconThemeData(
color: AppColor.primaryColor,
iconTheme: IconThemeData(
color: Colors.white,
),
titleTextStyle: TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold,
),
toolbarTextStyle: TextTheme(
titleSmall: AppStyle.subtitle,
headlineSmall: AppStyle.title,
titleLarge: AppStyle.headTitle2,
).bodyMedium,
titleTextStyle: TextTheme(
titleSmall: AppStyle.subtitle,
headlineSmall: AppStyle.title,
titleLarge: AppStyle.headTitle2,
).titleLarge,
),
);