Update: 2026-06-26 01:43:37

This commit is contained in:
Hamza-Ayed
2026-06-26 01:43:37 +03:00
parent 3002dbd517
commit bd3ba7ecd7
22 changed files with 227 additions and 183 deletions

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:siro_service/views/widgets/mycircular.dart';
import 'package:siro_service/constant/links.dart'; import 'package:siro_service/constant/links.dart';
import 'package:siro_service/controller/functions/crud.dart'; import 'package:siro_service/controller/functions/crud.dart';
import 'package:siro_service/controller/functions/device_helper.dart'; import 'package:siro_service/controller/functions/device_helper.dart';
@@ -50,14 +51,11 @@ class RegisterController extends GetxController {
if (otpSent) { if (otpSent) {
_showOtpDialog(phone.text, res['message']?['message'] ?? "تم تقديم طلبك بنجاح. يرجى انتظار موافقة الإدارة."); _showOtpDialog(phone.text, res['message']?['message'] ?? "تم تقديم طلبك بنجاح. يرجى انتظار موافقة الإدارة.");
} else { } else {
Get.snackbar('Error', 'Failed to send OTP'.tr); mySnackbarError('Failed to send OTP'.tr);
} }
} else { } else {
Get.snackbar( mySnackbarError(
"خطأ", res is Map ? res['message'].toString() : "فشل تقديم طلب التسجيل".tr,
res is Map ? res['message'].toString() : "فشل تقديم طلب التسجيل",
backgroundColor: Colors.red.withOpacity(0.7),
colorText: Colors.white,
); );
} }
} }
@@ -104,7 +102,7 @@ class RegisterController extends GetxController {
Get.back(); // close dialog Get.back(); // close dialog
await _verifyOtpAndFinalize(phoneNumber, otpCode, successMessage); await _verifyOtpAndFinalize(phoneNumber, otpCode, successMessage);
} else { } else {
Get.snackbar('خطأ', 'الرجاء إدخال رمز صحيح'.tr); mySnackbarError('الرجاء إدخال رمز صحيح'.tr);
} }
}, },
); );
@@ -134,12 +132,12 @@ class RegisterController extends GetxController {
textConfirm: "موافق".tr, textConfirm: "موافق".tr,
); );
} else { } else {
Get.snackbar('Error', 'Invalid OTP'.tr); mySnackbarError('Invalid OTP'.tr);
} }
} catch (e) { } catch (e) {
Get.back(); // close loading Get.back(); // close loading
Log.print('OTP VERIFY ERROR: $e'); Log.print('OTP VERIFY ERROR: $e');
Get.snackbar('Error', e.toString()); mySnackbarError(e.toString());
} }
} }

View File

@@ -4,6 +4,7 @@ import 'package:get/get.dart';
import '../../constant/colors.dart'; import '../../constant/colors.dart';
import '../../constant/links.dart'; import '../../constant/links.dart';
import '../../views/widgets/mycircular.dart';
import '../print.dart'; import '../print.dart';
import 'functions/crud.dart'; import 'functions/crud.dart';
@@ -17,7 +18,7 @@ class Driverthebest extends GetxController {
// Log.print('driver: ${driver}'); // Log.print('driver: ${driver}');
update(); update();
} else { } else {
Get.snackbar('error', '', backgroundColor: AppColor.redColor); mySnackbarError('Error'.tr);
} }
} }
@@ -38,7 +39,7 @@ class DriverTheBestGizaController extends GetxController {
update(); update();
} else { } else {
Get.snackbar('error', '', backgroundColor: AppColor.redColor); mySnackbarError('Error'.tr);
} }
} }
@@ -59,7 +60,7 @@ class DriverTheBestAlexandriaController extends GetxController {
driver = res['message']; driver = res['message'];
update(); update();
} else { } else {
Get.snackbar('error', '', backgroundColor: AppColor.redColor); mySnackbarError('Error'.tr);
} }
} }

View File

@@ -3,6 +3,7 @@ import 'dart:io';
import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:siro_service/views/widgets/mycircular.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import '../../constant/api_key.dart'; import '../../constant/api_key.dart';
@@ -64,8 +65,7 @@ class FirebaseMessagesController extends GetxController {
} }
box.write(BoxName.tokens, tokens); box.write(BoxName.tokens, tokens);
} else { } else {
Get.snackbar("Warning".tr, "Server Error".tr, mySnackbarWarning("Server Error".tr);
backgroundColor: AppColor.redColor);
} }
} }

View File

@@ -13,6 +13,7 @@ import 'package:path_provider/path_provider.dart' as path_provider;
import '../../constant/api_key.dart'; import '../../constant/api_key.dart';
import '../../constant/box_name.dart'; import '../../constant/box_name.dart';
import '../../constant/colors.dart'; import '../../constant/colors.dart';
import '../../views/widgets/mycircular.dart';
import '../../main.dart'; import '../../main.dart';
import 'package:siro_service/controller/functions/encrypt_decrypt.dart'; import 'package:siro_service/controller/functions/encrypt_decrypt.dart';
import 'package:siro_service/env/env.dart'; import 'package:siro_service/env/env.dart';
@@ -145,8 +146,7 @@ class ImageController extends GetxController {
link, link,
); );
} catch (e) { } catch (e) {
Get.snackbar('Image Upload Failed'.tr, e.toString(), mySnackbarError(e.toString());
backgroundColor: AppColor.redColor);
} finally { } finally {
isloading = false; isloading = false;
update(); update();
@@ -179,8 +179,7 @@ class ImageController extends GetxController {
link, link,
); );
} catch (e) { } catch (e) {
Get.snackbar('Image Upload Failed'.tr, e.toString(), mySnackbarError(e.toString());
backgroundColor: AppColor.redColor);
} finally { } finally {
isloading = false; isloading = false;
update(); update();
@@ -274,8 +273,7 @@ class ImageController extends GetxController {
link, link,
); );
} catch (e) { } catch (e) {
Get.snackbar('Image Upload Failed'.tr, e.toString(), mySnackbarError(e.toString());
backgroundColor: AppColor.redColor);
} finally { } finally {
isloading = false; isloading = false;
update(); update();

View File

@@ -171,7 +171,7 @@ final Map<String, String> ar_eg = {
"Document Number:": "Document Number:", "Document Number:": "Document Number:",
"Documents check": "Documents check", "Documents check": "Documents check",
"Done": "Done", "Done": "Done",
"Driver": "Driver", "Driver": "السائق",
"Driver Applied the Ride for You": "Driver Applied the Ride for You", "Driver Applied the Ride for You": "Driver Applied the Ride for You",
"Driver Cancel Your Trip": "Driver Cancel Your Trip", "Driver Cancel Your Trip": "Driver Cancel Your Trip",
"Driver Car Plate": "Driver Car Plate", "Driver Car Plate": "Driver Car Plate",
@@ -182,7 +182,7 @@ final Map<String, String> ar_eg = {
"Driver Information": "معلومات عن السائق", "Driver Information": "معلومات عن السائق",
"Driver Name": "Driver Name", "Driver Name": "Driver Name",
"Driver not found": "Driver not found", "Driver not found": "Driver not found",
"Driver phone": "Driver phone", "Driver phone": "هاتف السائق",
"Driver Registration & Requirements": "Driver Registration & Requirements", "Driver Registration & Requirements": "Driver Registration & Requirements",
"Driver Statistics": "إحصاءات السائق", "Driver Statistics": "إحصاءات السائق",
"Driver Wallet": "Driver Wallet", "Driver Wallet": "Driver Wallet",
@@ -243,7 +243,7 @@ final Map<String, String> ar_eg = {
"Feedback data saved successfully": "Feedback data saved successfully", "Feedback data saved successfully": "Feedback data saved successfully",
"Female": "Female", "Female": "Female",
"First Name": "First Name", "First Name": "First Name",
"First name": "First name", "First name": "الاسم الأول",
"Flag-down fee": "Flag-down fee", "Flag-down fee": "Flag-down fee",
"For Speed and Delivery trips, the price is calculated dynamically. For Comfort trips, the price is based on time and distance": "For Speed and Delivery trips, the price is calculated dynamically. For Comfort trips, the price is based on time and distance", "For Speed and Delivery trips, the price is calculated dynamically. For Comfort trips, the price is based on time and distance": "For Speed and Delivery trips, the price is calculated dynamically. For Comfort trips, the price is based on time and distance",
"Frequently Questions": "Frequently Questions", "Frequently Questions": "Frequently Questions",
@@ -370,7 +370,7 @@ final Map<String, String> ar_eg = {
"KM": "KM", "KM": "KM",
"Kuwait": "Kuwait", "Kuwait": "Kuwait",
"Language": "Language", "Language": "Language",
"Last name": "Last name", "Last name": "الاسم الأخير",
"Last Payment Amount": "مبلغ آخر دفعة", "Last Payment Amount": "مبلغ آخر دفعة",
"Last Payment Method": "آخر طريقة دفع", "Last Payment Method": "آخر طريقة دفع",
"Latest Recent Trip": "Latest Recent Trip", "Latest Recent Trip": "Latest Recent Trip",
@@ -385,7 +385,7 @@ final Map<String, String> ar_eg = {
"lime": "ليموني", "lime": "ليموني",
"Log Off": "Log Off", "Log Off": "Log Off",
"Log Out Page": "Log Out Page", "Log Out Page": "Log Out Page",
"Login": "Login", "Login": "تسجيل الدخول",
"Login Captin": "Login Captin", "Login Captin": "Login Captin",
"Login Driver": "Login Driver", "Login Driver": "Login Driver",
"m": "m", "m": "m",
@@ -622,7 +622,7 @@ final Map<String, String> ar_eg = {
"Sign in with Google for easier email and name entry": "Sign in with Google for easier email and name entry", "Sign in with Google for easier email and name entry": "Sign in with Google for easier email and name entry",
"Sign Out": "Sign Out", "Sign Out": "Sign Out",
"silver": "فضي", "silver": "فضي",
"Siro Service": "Siro Service", "Siro Service": "سيرو سيرفس",
"Sky Blue": "أزرق سماوي", "Sky Blue": "أزرق سماوي",
"So go and gain your money": "So go and gain your money", "So go and gain your money": "So go and gain your money",
"SOS Phone": "SOS Phone", "SOS Phone": "SOS Phone",
@@ -867,4 +867,25 @@ final Map<String, String> ar_eg = {
"📊 Reporting & Quality": "📊 Reporting & Quality", "📊 Reporting & Quality": "📊 Reporting & Quality",
"🔍 Search & Inquiries": "🔍 Search & Inquiries", "🔍 Search & Inquiries": "🔍 Search & Inquiries",
"🚗 Vehicle Management": "🚗 Vehicle Management", "🚗 Vehicle Management": "🚗 Vehicle Management",
"Phone number": "رقم الهاتف",
"Password": "كلمة المرور",
"Search results": "نتائج البحث",
"Trip number": "رقم الرحلة",
"Trip": "رحلة",
"Ride monitoring": "متابعة الرحلات",
"Search for trips": "بحث عن رحلات",
"Search by trip number": "بحث برقم الرحلة",
"Car type": "نوع السيارة",
"Submit registration request": "تقديم طلب تسجيل",
"Create new account": "إنشاء حساب جديد",
"Don't have an employee account?": "ليس لديك حساب موظف؟",
"Integrated customer service system": "نظام خدمة العملاء المتكامل",
"Example: 12345": "مثال: 12345",
"0992952235 or 079XXXXXXX": "مثال: 0992952235 أو 079XXXXXXX",
"Unknown": "غير معروف",
"Error": "خطأ",
"Failed to send OTP": "فشل في إرسال رمز التحقق",
"Please enter a valid email.": "يرجى إدخال بريد إلكتروني صحيح",
"Please enter a valid phone number.": "يرجى إدخال رقم هاتف صحيح",
"Connection error": "خطأ في الاتصال",
}; };

View File

@@ -171,7 +171,7 @@ final Map<String, String> ar_jo = {
"Document Number:": "Document Number:", "Document Number:": "Document Number:",
"Documents check": "Documents check", "Documents check": "Documents check",
"Done": "Done", "Done": "Done",
"Driver": "Driver", "Driver": "السائق",
"Driver Applied the Ride for You": "Driver Applied the Ride for You", "Driver Applied the Ride for You": "Driver Applied the Ride for You",
"Driver Cancel Your Trip": "Driver Cancel Your Trip", "Driver Cancel Your Trip": "Driver Cancel Your Trip",
"Driver Car Plate": "Driver Car Plate", "Driver Car Plate": "Driver Car Plate",
@@ -182,7 +182,7 @@ final Map<String, String> ar_jo = {
"Driver Information": "معلومات عن السائق", "Driver Information": "معلومات عن السائق",
"Driver Name": "Driver Name", "Driver Name": "Driver Name",
"Driver not found": "Driver not found", "Driver not found": "Driver not found",
"Driver phone": "Driver phone", "Driver phone": "هاتف السائق",
"Driver Registration & Requirements": "Driver Registration & Requirements", "Driver Registration & Requirements": "Driver Registration & Requirements",
"Driver Statistics": "إحصاءات السائق", "Driver Statistics": "إحصاءات السائق",
"Driver Wallet": "Driver Wallet", "Driver Wallet": "Driver Wallet",
@@ -243,7 +243,7 @@ final Map<String, String> ar_jo = {
"Feedback data saved successfully": "Feedback data saved successfully", "Feedback data saved successfully": "Feedback data saved successfully",
"Female": "Female", "Female": "Female",
"First Name": "First Name", "First Name": "First Name",
"First name": "First name", "First name": "الاسم الأول",
"Flag-down fee": "Flag-down fee", "Flag-down fee": "Flag-down fee",
"For Speed and Delivery trips, the price is calculated dynamically. For Comfort trips, the price is based on time and distance": "For Speed and Delivery trips, the price is calculated dynamically. For Comfort trips, the price is based on time and distance", "For Speed and Delivery trips, the price is calculated dynamically. For Comfort trips, the price is based on time and distance": "For Speed and Delivery trips, the price is calculated dynamically. For Comfort trips, the price is based on time and distance",
"Frequently Questions": "Frequently Questions", "Frequently Questions": "Frequently Questions",
@@ -370,7 +370,7 @@ final Map<String, String> ar_jo = {
"KM": "KM", "KM": "KM",
"Kuwait": "Kuwait", "Kuwait": "Kuwait",
"Language": "Language", "Language": "Language",
"Last name": "Last name", "Last name": "الاسم الأخير",
"Last Payment Amount": "مبلغ آخر دفعة", "Last Payment Amount": "مبلغ آخر دفعة",
"Last Payment Method": "آخر طريقة دفع", "Last Payment Method": "آخر طريقة دفع",
"Latest Recent Trip": "Latest Recent Trip", "Latest Recent Trip": "Latest Recent Trip",
@@ -385,7 +385,7 @@ final Map<String, String> ar_jo = {
"lime": "ليموني", "lime": "ليموني",
"Log Off": "Log Off", "Log Off": "Log Off",
"Log Out Page": "Log Out Page", "Log Out Page": "Log Out Page",
"Login": "Login", "Login": "تسجيل الدخول",
"Login Captin": "Login Captin", "Login Captin": "Login Captin",
"Login Driver": "Login Driver", "Login Driver": "Login Driver",
"m": "m", "m": "m",
@@ -622,7 +622,7 @@ final Map<String, String> ar_jo = {
"Sign in with Google for easier email and name entry": "Sign in with Google for easier email and name entry", "Sign in with Google for easier email and name entry": "Sign in with Google for easier email and name entry",
"Sign Out": "Sign Out", "Sign Out": "Sign Out",
"silver": "فضي", "silver": "فضي",
"Siro Service": "Siro Service", "Siro Service": "سيرو سيرفس",
"Sky Blue": "أزرق سماوي", "Sky Blue": "أزرق سماوي",
"So go and gain your money": "So go and gain your money", "So go and gain your money": "So go and gain your money",
"SOS Phone": "SOS Phone", "SOS Phone": "SOS Phone",
@@ -867,4 +867,25 @@ final Map<String, String> ar_jo = {
"📊 Reporting & Quality": "📊 Reporting & Quality", "📊 Reporting & Quality": "📊 Reporting & Quality",
"🔍 Search & Inquiries": "🔍 Search & Inquiries", "🔍 Search & Inquiries": "🔍 Search & Inquiries",
"🚗 Vehicle Management": "🚗 Vehicle Management", "🚗 Vehicle Management": "🚗 Vehicle Management",
"Phone number": "رقم الهاتف",
"Password": "كلمة المرور",
"Search results": "نتائج البحث",
"Trip number": "رقم الرحلة",
"Trip": "رحلة",
"Ride monitoring": "متابعة الرحلات",
"Search for trips": "بحث عن رحلات",
"Search by trip number": "بحث برقم الرحلة",
"Car type": "نوع السيارة",
"Submit registration request": "تقديم طلب تسجيل",
"Create new account": "إنشاء حساب جديد",
"Don't have an employee account?": "ليس لديك حساب موظف؟",
"Integrated customer service system": "نظام خدمة العملاء المتكامل",
"Example: 12345": "مثال: 12345",
"0992952235 or 079XXXXXXX": "مثال: 0992952235 أو 079XXXXXXX",
"Unknown": "غير معروف",
"Error": "خطأ",
"Failed to send OTP": "فشل في إرسال رمز التحقق",
"Please enter a valid email.": "يرجى إدخال بريد إلكتروني صحيح",
"Please enter a valid phone number.": "يرجى إدخال رقم هاتف صحيح",
"Connection error": "خطأ في الاتصال",
}; };

View File

@@ -171,7 +171,7 @@ final Map<String, String> ar_sy = {
"Document Number:": "Document Number:", "Document Number:": "Document Number:",
"Documents check": "Documents check", "Documents check": "Documents check",
"Done": "Done", "Done": "Done",
"Driver": "Driver", "Driver": "السائق",
"Driver Applied the Ride for You": "Driver Applied the Ride for You", "Driver Applied the Ride for You": "Driver Applied the Ride for You",
"Driver Cancel Your Trip": "Driver Cancel Your Trip", "Driver Cancel Your Trip": "Driver Cancel Your Trip",
"Driver Car Plate": "Driver Car Plate", "Driver Car Plate": "Driver Car Plate",
@@ -182,7 +182,7 @@ final Map<String, String> ar_sy = {
"Driver Information": "معلومات عن السائق", "Driver Information": "معلومات عن السائق",
"Driver Name": "Driver Name", "Driver Name": "Driver Name",
"Driver not found": "Driver not found", "Driver not found": "Driver not found",
"Driver phone": "Driver phone", "Driver phone": "هاتف السائق",
"Driver Registration & Requirements": "Driver Registration & Requirements", "Driver Registration & Requirements": "Driver Registration & Requirements",
"Driver Statistics": "إحصاءات السائق", "Driver Statistics": "إحصاءات السائق",
"Driver Wallet": "Driver Wallet", "Driver Wallet": "Driver Wallet",
@@ -243,7 +243,7 @@ final Map<String, String> ar_sy = {
"Feedback data saved successfully": "Feedback data saved successfully", "Feedback data saved successfully": "Feedback data saved successfully",
"Female": "Female", "Female": "Female",
"First Name": "First Name", "First Name": "First Name",
"First name": "First name", "First name": "الاسم الأول",
"Flag-down fee": "Flag-down fee", "Flag-down fee": "Flag-down fee",
"For Speed and Delivery trips, the price is calculated dynamically. For Comfort trips, the price is based on time and distance": "For Speed and Delivery trips, the price is calculated dynamically. For Comfort trips, the price is based on time and distance", "For Speed and Delivery trips, the price is calculated dynamically. For Comfort trips, the price is based on time and distance": "For Speed and Delivery trips, the price is calculated dynamically. For Comfort trips, the price is based on time and distance",
"Frequently Questions": "Frequently Questions", "Frequently Questions": "Frequently Questions",
@@ -370,7 +370,7 @@ final Map<String, String> ar_sy = {
"KM": "KM", "KM": "KM",
"Kuwait": "Kuwait", "Kuwait": "Kuwait",
"Language": "Language", "Language": "Language",
"Last name": "Last name", "Last name": "الاسم الأخير",
"Last Payment Amount": "مبلغ آخر دفعة", "Last Payment Amount": "مبلغ آخر دفعة",
"Last Payment Method": "آخر طريقة دفع", "Last Payment Method": "آخر طريقة دفع",
"Latest Recent Trip": "Latest Recent Trip", "Latest Recent Trip": "Latest Recent Trip",
@@ -385,7 +385,7 @@ final Map<String, String> ar_sy = {
"lime": "ليموني", "lime": "ليموني",
"Log Off": "Log Off", "Log Off": "Log Off",
"Log Out Page": "Log Out Page", "Log Out Page": "Log Out Page",
"Login": "Login", "Login": "تسجيل الدخول",
"Login Captin": "Login Captin", "Login Captin": "Login Captin",
"Login Driver": "Login Driver", "Login Driver": "Login Driver",
"m": "m", "m": "m",
@@ -622,7 +622,7 @@ final Map<String, String> ar_sy = {
"Sign in with Google for easier email and name entry": "Sign in with Google for easier email and name entry", "Sign in with Google for easier email and name entry": "Sign in with Google for easier email and name entry",
"Sign Out": "Sign Out", "Sign Out": "Sign Out",
"silver": "فضي", "silver": "فضي",
"Siro Service": "Siro Service", "Siro Service": "سيرو سيرفس",
"Sky Blue": "أزرق سماوي", "Sky Blue": "أزرق سماوي",
"So go and gain your money": "So go and gain your money", "So go and gain your money": "So go and gain your money",
"SOS Phone": "SOS Phone", "SOS Phone": "SOS Phone",
@@ -867,4 +867,25 @@ final Map<String, String> ar_sy = {
"📊 Reporting & Quality": "📊 Reporting & Quality", "📊 Reporting & Quality": "📊 Reporting & Quality",
"🔍 Search & Inquiries": "🔍 Search & Inquiries", "🔍 Search & Inquiries": "🔍 Search & Inquiries",
"🚗 Vehicle Management": "🚗 Vehicle Management", "🚗 Vehicle Management": "🚗 Vehicle Management",
"Phone number": "رقم الهاتف",
"Password": "كلمة المرور",
"Search results": "نتائج البحث",
"Trip number": "رقم الرحلة",
"Trip": "رحلة",
"Ride monitoring": "متابعة الرحلات",
"Search for trips": "بحث عن رحلات",
"Search by trip number": "بحث برقم الرحلة",
"Car type": "نوع السيارة",
"Submit registration request": "تقديم طلب تسجيل",
"Create new account": "إنشاء حساب جديد",
"Don't have an employee account?": "ليس لديك حساب موظف؟",
"Integrated customer service system": "نظام خدمة العملاء المتكامل",
"Example: 12345": "مثال: 12345",
"0992952235 or 079XXXXXXX": "مثال: 0992952235 أو 079XXXXXXX",
"Unknown": "غير معروف",
"Error": "خطأ",
"Failed to send OTP": "فشل في إرسال رمز التحقق",
"Please enter a valid email.": "يرجى إدخال بريد إلكتروني صحيح",
"Please enter a valid phone number.": "يرجى إدخال رقم هاتف صحيح",
"Connection error": "خطأ في الاتصال",
}; };

View File

@@ -91,8 +91,8 @@ class LocaleController extends GetxController {
void onInit() { void onInit() {
String? storedLang = box.read(BoxName.lang); String? storedLang = box.read(BoxName.lang);
if (storedLang == null) { if (storedLang == null) {
// Use device language if no language is stored // Default to Arabic if no language is stored
storedLang = Get.deviceLocale!.languageCode; storedLang = 'ar';
box.write(BoxName.lang, storedLang); box.write(BoxName.lang, storedLang);
} }

View File

@@ -10,6 +10,7 @@ import '../constant/box_name.dart';
import '../main.dart'; import '../main.dart';
import '../print.dart'; import '../print.dart';
import '../views/home/main.dart'; import '../views/home/main.dart';
import '../views/widgets/mycircular.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart';
@@ -67,14 +68,11 @@ class LoginController extends GetxController {
if (otpSent) { if (otpSent) {
_showOtpDialog(phone, pass, fingerprint, d); _showOtpDialog(phone, pass, fingerprint, d);
} else { } else {
Get.snackbar('Error', 'Failed to send OTP'.tr); mySnackbarError('Failed to send OTP'.tr);
} }
} else { } else {
Get.snackbar( mySnackbarError(
'خطأ'.tr,
res is Map ? res['message'].toString().tr : 'فشل تسجيل الدخول'.tr, res is Map ? res['message'].toString().tr : 'فشل تسجيل الدخول'.tr,
backgroundColor: Colors.red.withOpacity(0.7),
colorText: Colors.white,
); );
} }
} }
@@ -120,7 +118,7 @@ class LoginController extends GetxController {
Get.back(); // close dialog Get.back(); // close dialog
await _verifyOtpAndFinalize(phone, otpCode, pass, loginData); await _verifyOtpAndFinalize(phone, otpCode, pass, loginData);
} else { } else {
Get.snackbar('خطأ', 'الرجاء إدخال رمز صحيح'.tr); mySnackbarError('الرجاء إدخال رمز صحيح'.tr);
} }
}, },
); );
@@ -161,12 +159,12 @@ class LoginController extends GetxController {
Get.offAll(() => Main()); Get.offAll(() => Main());
} else { } else {
Get.snackbar('Error', 'Invalid OTP'.tr); mySnackbarError('Invalid OTP'.tr);
} }
} catch (e) { } catch (e) {
Get.back(); Get.back();
Log.print('OTP VERIFY ERROR: $e'); Log.print('OTP VERIFY ERROR: $e');
Get.snackbar('Error', e.toString()); mySnackbarError(e.toString());
} }
} }
@@ -175,6 +173,17 @@ class LoginController extends GetxController {
await EncryptionHelper.initialize(); await EncryptionHelper.initialize();
await DeviceHelper.getDeviceFingerprint(); await DeviceHelper.getDeviceFingerprint();
// If stored JWT is still valid, skip login and go straight to Main
String? storedJwt = await storage.read(key: BoxName.jwt);
if (storedJwt != null && CRUD.isJwtValid(r(storedJwt))) {
String? storedPass = await storage.read(key: 'password');
if (storedPass != null) {
await box.write(BoxName.password, storedPass);
}
Get.offAll(() => Main());
return;
}
// Auto login if credentials exist // Auto login if credentials exist
String? storedPassword = await storage.read(key: 'password'); String? storedPassword = await storage.read(key: 'password');
if (storedPassword != null) { if (storedPassword != null) {

View File

@@ -11,6 +11,7 @@ import 'package:siro_service/views/widgets/my_dialog.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import '../../print.dart'; import '../../print.dart';
import '../../views/widgets/mycircular.dart';
import 'pages/passengers_page.dart'; import 'pages/passengers_page.dart';
class MainController extends GetxController { class MainController extends GetxController {
@@ -77,8 +78,7 @@ class MainController extends GetxController {
update(); update();
Get.back(); Get.back();
if (passengerData.isEmpty) { if (passengerData.isEmpty) {
Get.snackbar('Error'.tr, 'Passenger not found'.tr, mySnackbarError('Passenger not found'.tr);
backgroundColor: Colors.red, colorText: Colors.white);
return; return;
} }
Get.to(() => PassengersPage()); Get.to(() => PassengersPage());
@@ -111,11 +111,9 @@ class MainController extends GetxController {
key: value.toString(), key: value.toString(),
}); });
if (res == 'failure') { if (res == 'failure') {
Get.snackbar('Error', 'Failed to update driver data', mySnackbarError('Failed to update driver data'.tr);
backgroundColor: AppColor.redColor);
} else { } else {
Get.snackbar('Success', 'Driver data updated successfully', mySnackbarSuccess('Driver data updated successfully'.tr);
backgroundColor: AppColor.greenColor);
} }
// Optionally fetch driver again // Optionally fetch driver again
// await getDriverData(); // await getDriverData();
@@ -222,11 +220,11 @@ class MainController extends GetxController {
'phone': phone, 'phone': phone,
}); });
if (res != 'failure') { if (res != 'failure') {
Get.snackbar(res, '', backgroundColor: AppColor.greenColor); mySnackbarSuccess(res is Map ? (res['message'] ?? 'Success'.tr) : res.toString());
// await getDriverWantCompleteRegistration(); // await getDriverWantCompleteRegistration();
update(); update();
} else { } else {
Get.snackbar(res, ''); mySnackbarError(res is Map ? (res['message'] ?? 'Error'.tr) : res.toString());
} }
} }
@@ -255,7 +253,7 @@ class MainController extends GetxController {
filteredDrivers = driverWantCompleteRegistration; filteredDrivers = driverWantCompleteRegistration;
update(); update();
} else { } else {
Get.snackbar(res, ''); mySnackbarError(res is Map ? (res['message'] ?? 'Error'.tr) : res.toString());
} }
} }
@@ -278,7 +276,7 @@ class MainController extends GetxController {
"notes": notesController.text, "notes": notesController.text,
}); });
if (res != 'failure') { if (res != 'failure') {
Get.snackbar('Success'.tr, '', backgroundColor: AppColor.greenColor); mySnackbarSuccess('Success'.tr);
} }
} }
@@ -292,7 +290,7 @@ class MainController extends GetxController {
passengerNotCompleteRegistration = d; passengerNotCompleteRegistration = d;
update(); update();
} else { } else {
Get.snackbar(res, ''); mySnackbarError(res is Map ? (res['message'] ?? 'Error'.tr) : res.toString());
} }
} }
@@ -395,18 +393,15 @@ class MainController extends GetxController {
payload: payload), payload: payload),
]); ]);
Get.snackbar('Success', 'Registration successful', mySnackbarSuccess('Registration successful'.tr);
backgroundColor: AppColor.greenColor);
Get.back(); Get.back();
} else { } else {
Log.print('Error: Unexpected status: ${status['status']}'); Log.print('Error: Unexpected status: ${status['status']}');
Get.snackbar('Error', 'Registration failed', mySnackbarError('Registration failed'.tr);
backgroundColor: Colors.red);
} }
} catch (e) { } catch (e) {
Log.print('Error: $e'); Log.print('Error: $e');
Get.snackbar('Error', 'An error occurred during registration', mySnackbarError('An error occurred during registration'.tr);
backgroundColor: Colors.red);
} }
} }
@@ -435,7 +430,7 @@ class MainController extends GetxController {
}); });
Log.print('res: ${res}'); Log.print('res: ${res}');
if (res != 'failure') { if (res != 'failure') {
// Get.snackbar(res, '', backgroundColor: AppColor.greenColor); // mySnackbarSuccess(res is Map ? (res['message'] ?? 'Success'.tr) : res.toString());
Get.back(); Get.back();
carplateController.clear(); carplateController.clear();
yearController.clear(); yearController.clear();
@@ -446,7 +441,7 @@ class MainController extends GetxController {
await getCarPlateNotEdit(); await getCarPlateNotEdit();
update(); update();
} else { } else {
Get.snackbar(res, '', backgroundColor: AppColor.redColor); mySnackbarError(res is Map ? (res['message'] ?? 'Error'.tr) : res.toString());
} }
} }
@@ -456,12 +451,12 @@ class MainController extends GetxController {
// "carPlate": carPlate, // "carPlate": carPlate,
// }); // });
// if (res != 'failure') { // if (res != 'failure') {
// Get.snackbar(res, '', backgroundColor: AppColor.greenColor); // mySnackbarSuccess(res is Map ? (res['message'] ?? 'Success'.tr) : res.toString());
// carplateController.clear(); // carplateController.clear();
// await getCarPlateNotEdit(); // await getCarPlateNotEdit();
// update(); // update();
// } else { // } else {
// Get.snackbar(res, '', backgroundColor: AppColor.redColor); // mySnackbarError(res is Map ? (res['message'] ?? 'Error'.tr) : res.toString());
// } // }
// } // }
@@ -470,11 +465,11 @@ class MainController extends GetxController {
link: AppLink.addNotesDriver, link: AppLink.addNotesDriver,
payload: {"phone": phone, "editor": editor, "note": note}); payload: {"phone": phone, "editor": editor, "note": note});
if (res != 'failure') { if (res != 'failure') {
Get.snackbar(res, '', backgroundColor: AppColor.greenColor); mySnackbarSuccess(res is Map ? (res['message'] ?? 'Success'.tr) : res.toString());
getDriversPhoneNotComplete(); getDriversPhoneNotComplete();
notesController.clear(); notesController.clear();
} else { } else {
Get.snackbar(res, '', backgroundColor: AppColor.redColor); mySnackbarError(res is Map ? (res['message'] ?? 'Error'.tr) : res.toString());
} }
} }
@@ -484,10 +479,10 @@ class MainController extends GetxController {
link: AppLink.addNotesPassenger, link: AppLink.addNotesPassenger,
payload: {"phone": phone, "editor": editor, "note": note}); payload: {"phone": phone, "editor": editor, "note": note});
if (res != 'failure') { if (res != 'failure') {
Get.snackbar(res, '', backgroundColor: AppColor.greenColor); mySnackbarSuccess(res is Map ? (res['message'] ?? 'Success'.tr) : res.toString());
notesController.clear(); notesController.clear();
} else { } else {
Get.snackbar(res, '', backgroundColor: AppColor.redColor); mySnackbarError(res is Map ? (res['message'] ?? 'Error'.tr) : res.toString());
} }
} }
@@ -500,8 +495,7 @@ class MainController extends GetxController {
update(); update();
Get.back(); Get.back();
if (driverData.isEmpty) { if (driverData.isEmpty) {
Get.snackbar('Error'.tr, 'Driver not found'.tr, mySnackbarError('Driver not found'.tr);
backgroundColor: Colors.red, colorText: Colors.white);
return; return;
} }
Get.to(() => DriverPage()); Get.to(() => DriverPage());
@@ -517,8 +511,7 @@ class MainController extends GetxController {
update(); update();
Get.back(); Get.back();
if (driverData.isEmpty) { if (driverData.isEmpty) {
Get.snackbar('Error'.tr, 'Driver not found'.tr, mySnackbarError('Driver not found'.tr);
backgroundColor: Colors.red, colorText: Colors.white);
return; return;
} }
Get.to(() => DriverPage()); Get.to(() => DriverPage());
@@ -547,7 +540,7 @@ class MainController extends GetxController {
driverData = d; driverData = d;
update(); update();
} else { } else {
Get.snackbar('Error', 'Driver not found', backgroundColor: Colors.red); mySnackbarError('Driver not found'.tr);
} }
} }
@@ -561,7 +554,7 @@ class MainController extends GetxController {
driverData = d; driverData = d;
update(); update();
} else { } else {
Get.snackbar('Error', 'Driver not found', backgroundColor: Colors.red); mySnackbarError('Driver not found'.tr);
} }
} }
} }

View File

@@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:siro_service/views/widgets/mycircular.dart';
import 'package:siro_service/controller/functions/encrypt_decrypt.dart'; import 'package:siro_service/controller/functions/encrypt_decrypt.dart';
import 'package:siro_service/views/widgets/my_scafold.dart'; import 'package:siro_service/views/widgets/my_scafold.dart';
@@ -99,7 +100,7 @@ class Driverthebest extends GetxController {
driver = res['message']; driver = res['message'];
update(); update();
} else { } else {
Get.snackbar('error', '', backgroundColor: AppColor.redColor); mySnackbarError('Error'.tr);
} }
} }

View File

@@ -396,7 +396,7 @@ class ReviewDriverPage extends StatelessWidget {
padding: const EdgeInsets.symmetric(vertical: 6), padding: const EdgeInsets.symmetric(vertical: 6),
child: Obx( child: Obx(
() => DropdownButtonFormField<String>( () => DropdownButtonFormField<String>(
initialValue: c.selectedGender.value.isEmpty value: c.selectedGender.value.isEmpty
? null ? null
: c.selectedGender.value, : c.selectedGender.value,
isExpanded: true, isExpanded: true,
@@ -424,7 +424,7 @@ class ReviewDriverPage extends StatelessWidget {
padding: const EdgeInsets.symmetric(vertical: 6), padding: const EdgeInsets.symmetric(vertical: 6),
child: Obx( child: Obx(
() => DropdownButtonFormField<String>( () => DropdownButtonFormField<String>(
initialValue: c.colorHex.value.isEmpty ? null : c.colorHex.value, value: c.colorHex.value.isEmpty ? null : c.colorHex.value,
isExpanded: true, isExpanded: true,
decoration: InputDecoration( decoration: InputDecoration(
labelText: label.tr, labelText: label.tr,
@@ -467,7 +467,7 @@ class ReviewDriverPage extends StatelessWidget {
padding: const EdgeInsets.symmetric(vertical: 6), padding: const EdgeInsets.symmetric(vertical: 6),
child: Obx( child: Obx(
() => DropdownButtonFormField<String>( () => DropdownButtonFormField<String>(
initialValue: ReviewDriverController.kFuelOptions value: ReviewDriverController.kFuelOptions
.contains(c.selectedFuel.value) .contains(c.selectedFuel.value)
? c.selectedFuel.value ? c.selectedFuel.value
: null, : null,

View File

@@ -1,6 +1,7 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:siro_service/views/widgets/mycircular.dart';
import 'package:siro_service/constant/links.dart'; import 'package:siro_service/constant/links.dart';
import 'package:siro_service/controller/functions/crud.dart'; import 'package:siro_service/controller/functions/crud.dart';
import 'package:siro_service/views/widgets/my_scafold.dart'; import 'package:siro_service/views/widgets/my_scafold.dart';
@@ -43,7 +44,7 @@ class ActiveRideModel {
status: ride['status'] ?? '', status: ride['status'] ?? '',
startLocation: ride['start_location'] ?? '', startLocation: ride['start_location'] ?? '',
endLocation: ride['end_location'] ?? '', endLocation: ride['end_location'] ?? '',
driverName: driver['fullname'] ?? driver['first_name'] ?? 'غير معروف', driverName: driver['fullname'] ?? driver['first_name'] ?? 'Unknown'.tr,
driverPhone: driver['phone'] ?? '', driverPhone: driver['phone'] ?? '',
passengerName: '', passengerName: '',
passengerPhone: '', passengerPhone: '',
@@ -105,8 +106,7 @@ class RideMonitorServiceController extends GetxController {
Future<void> searchByPhone() async { Future<void> searchByPhone() async {
final phone = phoneCtrl.text.trim(); final phone = phoneCtrl.text.trim();
if (phone.isEmpty) { if (phone.isEmpty) {
Get.snackbar('تنبيه', 'يرجى إدخال رقم الهاتف', mySnackbarWarning('يرجى إدخال رقم الهاتف'.tr);
backgroundColor: Colors.redAccent, colorText: Colors.white);
return; return;
} }
@@ -176,8 +176,7 @@ class RideMonitorServiceController extends GetxController {
Future<void> searchByRideId() async { Future<void> searchByRideId() async {
final rideId = rideIdCtrl.text.trim(); final rideId = rideIdCtrl.text.trim();
if (rideId.isEmpty) { if (rideId.isEmpty) {
Get.snackbar('تنبيه', 'يرجى إدخال رقم الرحلة', mySnackbarWarning('يرجى إدخال رقم الرحلة'.tr);
backgroundColor: Colors.redAccent, colorText: Colors.white);
return; return;
} }
@@ -240,7 +239,7 @@ class RideMonitorServicePage extends StatelessWidget {
final controller = Get.put(RideMonitorServiceController()); final controller = Get.put(RideMonitorServiceController());
return MyScaffold( return MyScaffold(
title: 'متابعة الرحلات', title: 'Ride monitoring'.tr,
isleading: true, isleading: true,
body: [ body: [
Padding( Padding(
@@ -253,7 +252,7 @@ class RideMonitorServicePage extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: _buildModeButton( child: _buildModeButton(
'رقم الهاتف', 'Phone number'.tr,
Icons.phone_rounded, Icons.phone_rounded,
controller.searchMode.value == 'phone', controller.searchMode.value == 'phone',
() => controller.searchMode.value = 'phone', () => controller.searchMode.value = 'phone',
@@ -262,7 +261,7 @@ class RideMonitorServicePage extends StatelessWidget {
const SizedBox(width: 12), const SizedBox(width: 12),
Expanded( Expanded(
child: _buildModeButton( child: _buildModeButton(
'رقم الرحلة', 'Trip number'.tr,
Icons.confirmation_number_rounded, Icons.confirmation_number_rounded,
controller.searchMode.value == 'ride_id', controller.searchMode.value == 'ride_id',
() => controller.searchMode.value = 'ride_id', () => controller.searchMode.value = 'ride_id',
@@ -320,7 +319,7 @@ class RideMonitorServicePage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
'نتائج البحث (${controller.activeRides.length})', '${'Search results'.tr} (${controller.activeRides.length})',
style: const TextStyle( style: const TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@@ -381,8 +380,8 @@ class RideMonitorServicePage extends StatelessWidget {
controller: controller.phoneCtrl, controller: controller.phoneCtrl,
keyboardType: TextInputType.phone, keyboardType: TextInputType.phone,
decoration: InputDecoration( decoration: InputDecoration(
labelText: 'رقم الهاتف', labelText: 'Phone number'.tr,
hintText: 'مثال: 0992952235 أو 079XXXXXXX', hintText: '0992952235 or 079XXXXXXX'.tr,
prefixIcon: const Icon(Icons.phone_rounded), prefixIcon: const Icon(Icons.phone_rounded),
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)), border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
), ),
@@ -394,8 +393,8 @@ class RideMonitorServicePage extends StatelessWidget {
child: ElevatedButton.icon( child: ElevatedButton.icon(
onPressed: () => controller.searchByPhone(), onPressed: () => controller.searchByPhone(),
icon: const Icon(Icons.search_rounded), icon: const Icon(Icons.search_rounded),
label: const Text('بحث عن رحلات', label: Text('Search for trips'.tr,
style: TextStyle(fontWeight: FontWeight.bold)), style: const TextStyle(fontWeight: FontWeight.bold)),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF4318FF), backgroundColor: const Color(0xFF4318FF),
foregroundColor: Colors.white, foregroundColor: Colors.white,
@@ -415,8 +414,8 @@ class RideMonitorServicePage extends StatelessWidget {
controller: controller.rideIdCtrl, controller: controller.rideIdCtrl,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
decoration: InputDecoration( decoration: InputDecoration(
labelText: 'رقم الرحلة', labelText: 'Trip number'.tr,
hintText: 'مثال: 12345', hintText: 'Example: 12345'.tr,
prefixIcon: const Icon(Icons.confirmation_number_rounded), prefixIcon: const Icon(Icons.confirmation_number_rounded),
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)), border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
), ),
@@ -428,8 +427,8 @@ class RideMonitorServicePage extends StatelessWidget {
child: ElevatedButton.icon( child: ElevatedButton.icon(
onPressed: () => controller.searchByRideId(), onPressed: () => controller.searchByRideId(),
icon: const Icon(Icons.search_rounded), icon: const Icon(Icons.search_rounded),
label: const Text('بحث برقم الرحلة', label: Text('Search by trip number'.tr,
style: TextStyle(fontWeight: FontWeight.bold)), style: const TextStyle(fontWeight: FontWeight.bold)),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF4318FF), backgroundColor: const Color(0xFF4318FF),
foregroundColor: Colors.white, foregroundColor: Colors.white,
@@ -483,7 +482,7 @@ class RideMonitorServicePage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
'رحلة #${ride.rideId}', '${'Trip'.tr} #${ride.rideId}',
style: const TextStyle( style: const TextStyle(
fontSize: 15, fontWeight: FontWeight.bold), fontSize: 15, fontWeight: FontWeight.bold),
), ),
@@ -509,14 +508,14 @@ class RideMonitorServicePage extends StatelessWidget {
style: TextStyle(color: Colors.grey[500], fontSize: 12)), style: TextStyle(color: Colors.grey[500], fontSize: 12)),
const Divider(height: 20), const Divider(height: 20),
// Info rows // Info rows
_buildInfoRow(Icons.person_rounded, 'السائق: ${ride.driverName}'), _buildInfoRow(Icons.person_rounded, '${'Driver'.tr}: ${ride.driverName}'),
if (ride.driverPhone.isNotEmpty) if (ride.driverPhone.isNotEmpty)
_buildInfoRow( _buildInfoRow(
Icons.phone_rounded, 'هاتف السائق: ${ride.driverPhone}'), Icons.phone_rounded, '${'Driver phone'.tr}: ${ride.driverPhone}'),
_buildInfoRow(Icons.payments_rounded, 'السعر: ${ride.price}'), _buildInfoRow(Icons.payments_rounded, '${'Price'.tr}: ${ride.price}'),
if (ride.carType.isNotEmpty) if (ride.carType.isNotEmpty)
_buildInfoRow( _buildInfoRow(
Icons.directions_car_rounded, 'نوع السيارة: ${ride.carType}'), Icons.directions_car_rounded, '${'Car type'.tr}: ${ride.carType}'),
], ],
), ),
), ),

View File

@@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:siro_service/views/widgets/mycircular.dart';
import 'package:siro_service/constant/colors.dart'; import 'package:siro_service/constant/colors.dart';
import 'package:siro_service/constant/style.dart'; import 'package:siro_service/constant/style.dart';
import 'package:siro_service/views/widgets/elevated_btn.dart'; import 'package:siro_service/views/widgets/elevated_btn.dart';
@@ -144,7 +145,7 @@ class DriverCard extends StatelessWidget {
final phone = driver['phone']; final phone = driver['phone'];
if (phone == null || phone.toString().isEmpty) { if (phone == null || phone.toString().isEmpty) {
Get.snackbar("خطأ", "لا يوجد رقم هاتف لهذا السائق"); mySnackbarError('لا يوجد رقم هاتف لهذا السائق'.tr);
return; return;
} }

View File

@@ -10,6 +10,7 @@ import 'package:siro_service/controller/functions/crud.dart';
import 'package:siro_service/main.dart'; import 'package:siro_service/main.dart';
import 'package:siro_service/print.dart'; import 'package:siro_service/print.dart';
import 'package:siro_service/views/widgets/my_dialog.dart'; import 'package:siro_service/views/widgets/my_dialog.dart';
import 'package:siro_service/views/widgets/mycircular.dart';
import 'pages/registration_captain_page.dart'; import 'pages/registration_captain_page.dart';
@@ -119,7 +120,7 @@ class RegisterCaptainServiceController extends GetxController {
} }
} }
} catch (e) { } catch (e) {
Get.snackbar('Error', 'An unexpected error occurred: $e'); mySnackbarError('An unexpected error occurred: \$e'.tr);
} finally { } finally {
isLoading.value = false; isLoading.value = false;
} }
@@ -271,21 +272,11 @@ class RegisterCaptainServiceController extends GetxController {
// Get.off(() => RegisterCaptain()); // Get.off(() => RegisterCaptain());
}); });
} else { } else {
Get.snackbar( mySnackbarError('Failed to update driver: ${decodedResponse is Map ? decodedResponse['message'] : 'failure'}'.tr);
'Error'.tr,
'Failed to update driver: ${decodedResponse is Map ? decodedResponse['message'] : 'failure'}'.tr,
backgroundColor: Colors.red,
colorText: Colors.white,
);
} }
}).catchError((error) { }).catchError((error) {
isLoading.value = false; isLoading.value = false;
Get.snackbar( mySnackbarError('An error occurred: $error'.tr);
'Error'.tr,
'An error occurred: $error'.tr,
backgroundColor: Colors.red,
colorText: Colors.white,
);
}); });
} }

View File

@@ -9,6 +9,7 @@ import 'package:siro_service/controller/functions/crud.dart';
import 'package:siro_service/main.dart'; import 'package:siro_service/main.dart';
import 'package:siro_service/print.dart'; import 'package:siro_service/print.dart';
import 'package:siro_service/views/widgets/my_dialog.dart'; import 'package:siro_service/views/widgets/my_dialog.dart';
import 'package:siro_service/views/widgets/mycircular.dart';
import 'pages/registration_captain_page.dart'; import 'pages/registration_captain_page.dart';
@@ -118,7 +119,7 @@ class RegisterCaptainController extends GetxController {
} }
} }
} catch (e) { } catch (e) {
Get.snackbar('Error', 'An unexpected error occurred: $e'); mySnackbarError('An unexpected error occurred: \$e'.tr);
} finally { } finally {
isLoading.value = false; isLoading.value = false;
} }
@@ -257,21 +258,11 @@ class RegisterCaptainController extends GetxController {
// Get.off(() => RegisterCaptain()); // Get.off(() => RegisterCaptain());
}); });
} else { } else {
Get.snackbar( mySnackbarError('Failed to update driver: ${decodedResponse is Map ? decodedResponse['message'] : 'failure'}'.tr);
'Error'.tr,
'Failed to update driver: ${decodedResponse is Map ? decodedResponse['message'] : 'failure'}'.tr,
backgroundColor: Colors.red,
colorText: Colors.white,
);
} }
}).catchError((error) { }).catchError((error) {
isLoading.value = false; isLoading.value = false;
Get.snackbar( mySnackbarError('An error occurred: $error'.tr);
'Error'.tr,
'An error occurred: $error'.tr,
backgroundColor: Colors.red,
colorText: Colors.white,
);
}); });
} }

View File

@@ -172,7 +172,7 @@ class ReviewDriverController extends GetxController {
_populateDocUrls(raw['documents']); _populateDocUrls(raw['documents']);
} }
} catch (e) { } catch (e) {
mySnackeBarError('Failed to load data: $e'); mySnackbarError('Failed to load data: $e');
} finally { } finally {
isLoading.value = false; isLoading.value = false;
} }
@@ -315,10 +315,10 @@ class ReviewDriverController extends GetxController {
if (response != 'failure' && response['status'] == 'success') { if (response != 'failure' && response['status'] == 'success') {
mySnackbarSuccess('Data saved successfully'); mySnackbarSuccess('Data saved successfully');
} else { } else {
mySnackeBarError('Failed to save changes'); mySnackbarError('Failed to save changes');
} }
} catch (e) { } catch (e) {
mySnackeBarError('Error: $e'); mySnackbarError('Error: $e');
} finally { } finally {
isSaving.value = false; isSaving.value = false;
} }
@@ -337,10 +337,10 @@ class ReviewDriverController extends GetxController {
await Future.delayed(const Duration(milliseconds: 500)); await Future.delayed(const Duration(milliseconds: 500));
Get.back(); Get.back();
} else { } else {
mySnackeBarError('Failed to activate driver'); mySnackbarError('Failed to activate driver');
} }
} catch (e) { } catch (e) {
mySnackeBarError('Error: $e'); mySnackbarError('Error: $e');
} finally { } finally {
isSaving.value = false; isSaving.value = false;
} }
@@ -348,7 +348,7 @@ class ReviewDriverController extends GetxController {
Future<void> rejectDriver(String reason) async { Future<void> rejectDriver(String reason) async {
if (reason.trim().isEmpty) { if (reason.trim().isEmpty) {
mySnackeBarError('Please enter a rejection reason'); mySnackbarError('Please enter a rejection reason');
return; return;
} }
isSaving.value = true; isSaving.value = true;
@@ -365,10 +365,10 @@ class ReviewDriverController extends GetxController {
await Future.delayed(const Duration(milliseconds: 500)); await Future.delayed(const Duration(milliseconds: 500));
Get.back(); Get.back();
} else { } else {
mySnackeBarError('Failed to reject driver'); mySnackbarError('Failed to reject driver');
} }
} catch (e) { } catch (e) {
mySnackeBarError('Error: $e'); mySnackbarError('Error: $e');
} finally { } finally {
isSaving.value = false; isSaving.value = false;
} }

View File

@@ -53,9 +53,9 @@ class LoginPage extends StatelessWidget {
), ),
), ),
const SizedBox(height: 24), const SizedBox(height: 24),
const Center( Center(
child: Text( child: Text(
'سيرو سيرفس', 'Siro Service'.tr,
style: TextStyle( style: TextStyle(
fontSize: 28, fontSize: 28,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@@ -64,9 +64,9 @@ class LoginPage extends StatelessWidget {
), ),
), ),
), ),
const Center( Center(
child: Text( child: Text(
'نظام خدمة العملاء المتكامل', 'Integrated customer service system'.tr,
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
color: Colors.grey, color: Colors.grey,
@@ -76,8 +76,8 @@ class LoginPage extends StatelessWidget {
const SizedBox(height: 60), const SizedBox(height: 60),
// Fields with modern styling // Fields with modern styling
const Text( Text(
'تسجيل الدخول', 'Login'.tr,
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@@ -124,9 +124,9 @@ class LoginPage extends StatelessWidget {
child: InkWell( child: InkWell(
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
onTap: () => controller.login(), onTap: () => controller.login(),
child: const Center( child: Center(
child: Text( child: Text(
'دخول', 'Login'.tr,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 18, fontSize: 18,
@@ -144,14 +144,14 @@ class LoginPage extends StatelessWidget {
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
const Text( Text(
'ليس لديك حساب موظف؟ ', 'Don\'t have an employee account?'.tr,
style: TextStyle(color: Colors.grey), style: TextStyle(color: Colors.grey),
), ),
TextButton( TextButton(
onPressed: () => Get.to(() => const RegisterPage()), onPressed: () => Get.to(() => const RegisterPage()),
child: const Text( child: Text(
'إنشاء حساب جديد', 'Create new account'.tr,
style: TextStyle( style: TextStyle(
color: AppColor.blueColor, color: AppColor.blueColor,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,

View File

@@ -113,10 +113,10 @@ class RegisterPage extends StatelessWidget {
child: InkWell( child: InkWell(
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
onTap: () => controller.register(), onTap: () => controller.register(),
child: const Center( child: Center(
child: Text( child: Text(
'تقديم طلب تسجيل', 'Submit registration request'.tr,
style: TextStyle( style: const TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@@ -137,9 +137,9 @@ class RegisterPage extends StatelessWidget {
), ),
TextButton( TextButton(
onPressed: () => Get.back(), onPressed: () => Get.back(),
child: const Text( child: Text(
'تسجيل الدخول', 'Login'.tr,
style: TextStyle( style: const TextStyle(
color: AppColor.blueColor, color: AppColor.blueColor,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),

View File

@@ -14,6 +14,7 @@ import 'package:siro_service/views/widgets/my_textField.dart';
import '../../constant/style.dart'; import '../../constant/style.dart';
import '../../controller/mainController/pages/ride_monitor_page.dart'; import '../../controller/mainController/pages/ride_monitor_page.dart';
import '../widgets/mycircular.dart';
import '../../controller/mainController/pages/add_car.dart'; import '../../controller/mainController/pages/add_car.dart';
import '../../controller/mainController/pages/drivers_cant_register.dart'; import '../../controller/mainController/pages/drivers_cant_register.dart';
import '../../controller/mainController/pages/new_driver.dart'; import '../../controller/mainController/pages/new_driver.dart';
@@ -178,7 +179,7 @@ class Main extends StatelessWidget {
_buildCategoryTitle('🚗 متابعة الرحلات'.tr), _buildCategoryTitle('🚗 متابعة الرحلات'.tr),
_buildGridSection([ _buildGridSection([
ServiceItem( ServiceItem(
title: 'متابعة رحلة', title: 'Follow up ride'.tr,
icon: Icons.map_rounded, icon: Icons.map_rounded,
color: const Color(0xFF4318FF), color: const Color(0xFF4318FF),
onTap: () => Get.to(() => const RideMonitorServicePage()), onTap: () => Get.to(() => const RideMonitorServicePage()),
@@ -524,8 +525,7 @@ class Main extends StatelessWidget {
mainController.licenseTypeController.clear(); mainController.licenseTypeController.clear();
mainController.siteDriverController.clear(); mainController.siteDriverController.clear();
mainController.phoneController.clear(); mainController.phoneController.clear();
Get.snackbar('Success'.tr, 'Added successfully'.tr, mySnackbarSuccess('Added successfully'.tr);
backgroundColor: AppColor.greenColor, colorText: Colors.white);
} }
}, },
kolor: AppColor.greenColor, kolor: AppColor.greenColor,
@@ -617,8 +617,7 @@ class Main extends StatelessWidget {
mainController.carTypeController.clear(); mainController.carTypeController.clear();
mainController.registrationDateController.clear(); mainController.registrationDateController.clear();
mainController.phoneCarController.clear(); mainController.phoneCarController.clear();
Get.snackbar('Success'.tr, 'Added successfully'.tr, mySnackbarSuccess('Added successfully'.tr);
backgroundColor: AppColor.greenColor, colorText: Colors.white);
} }
}, },
kolor: AppColor.greenColor, kolor: AppColor.greenColor,

View File

@@ -55,7 +55,7 @@ class SnackbarConfig {
); );
} }
SnackbarController mySnackeBarError(String message) { SnackbarController mySnackbarError(String message) {
// Trigger error haptic feedback // Trigger error haptic feedback
HapticFeedback.mediumImpact(); HapticFeedback.mediumImpact();

View File

@@ -117,10 +117,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.4.1" version: "1.4.0"
checked_yaml: checked_yaml:
dependency: transitive dependency: transitive
description: description:
@@ -764,26 +764,26 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker name: leak_tracker
sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "11.0.2" version: "10.0.9"
leak_tracker_flutter_testing: leak_tracker_flutter_testing:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker_flutter_testing name: leak_tracker_flutter_testing
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.10" version: "3.0.9"
leak_tracker_testing: leak_tracker_testing:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker_testing name: leak_tracker_testing
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.2" version: "3.0.1"
lints: lints:
dependency: transitive dependency: transitive
description: description:
@@ -804,26 +804,26 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6" sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.12.18" version: "0.12.17"
material_color_utilities: material_color_utilities:
dependency: transitive dependency: transitive
description: description:
name: material_color_utilities name: material_color_utilities
sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.13.0" version: "0.11.1"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.17.0" version: "1.16.0"
mime: mime:
dependency: transitive dependency: transitive
description: description:
@@ -1168,10 +1168,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
sha256: "93167629bfc610f71560ab9312acdda4959de4df6fac7492c89ff0d3886f6636" sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.7.9" version: "0.7.4"
timezone: timezone:
dependency: transitive dependency: transitive
description: description:
@@ -1264,10 +1264,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.0" version: "2.1.4"
vibration: vibration:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -1365,5 +1365,5 @@ packages:
source: hosted source: hosted
version: "3.1.3" version: "3.1.3"
sdks: sdks:
dart: ">=3.9.0-0 <4.0.0" dart: ">=3.8.0 <4.0.0"
flutter: ">=3.32.0" flutter: ">=3.32.0"