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:get/get.dart';
import 'package:siro_service/views/widgets/mycircular.dart';
import 'package:siro_service/constant/links.dart';
import 'package:siro_service/controller/functions/crud.dart';
import 'package:siro_service/controller/functions/device_helper.dart';
@@ -50,14 +51,11 @@ class RegisterController extends GetxController {
if (otpSent) {
_showOtpDialog(phone.text, res['message']?['message'] ?? "تم تقديم طلبك بنجاح. يرجى انتظار موافقة الإدارة.");
} else {
Get.snackbar('Error', 'Failed to send OTP'.tr);
mySnackbarError('Failed to send OTP'.tr);
}
} else {
Get.snackbar(
"خطأ",
res is Map ? res['message'].toString() : "فشل تقديم طلب التسجيل",
backgroundColor: Colors.red.withOpacity(0.7),
colorText: Colors.white,
mySnackbarError(
res is Map ? res['message'].toString() : "فشل تقديم طلب التسجيل".tr,
);
}
}
@@ -104,7 +102,7 @@ class RegisterController extends GetxController {
Get.back(); // close dialog
await _verifyOtpAndFinalize(phoneNumber, otpCode, successMessage);
} else {
Get.snackbar('خطأ', 'الرجاء إدخال رمز صحيح'.tr);
mySnackbarError('الرجاء إدخال رمز صحيح'.tr);
}
},
);
@@ -134,12 +132,12 @@ class RegisterController extends GetxController {
textConfirm: "موافق".tr,
);
} else {
Get.snackbar('Error', 'Invalid OTP'.tr);
mySnackbarError('Invalid OTP'.tr);
}
} catch (e) {
Get.back(); // close loading
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/links.dart';
import '../../views/widgets/mycircular.dart';
import '../print.dart';
import 'functions/crud.dart';
@@ -17,7 +18,7 @@ class Driverthebest extends GetxController {
// Log.print('driver: ${driver}');
update();
} else {
Get.snackbar('error', '', backgroundColor: AppColor.redColor);
mySnackbarError('Error'.tr);
}
}
@@ -38,7 +39,7 @@ class DriverTheBestGizaController extends GetxController {
update();
} else {
Get.snackbar('error', '', backgroundColor: AppColor.redColor);
mySnackbarError('Error'.tr);
}
}
@@ -59,7 +60,7 @@ class DriverTheBestAlexandriaController extends GetxController {
driver = res['message'];
update();
} 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:flutter/material.dart';
import 'package:get/get.dart';
import 'package:siro_service/views/widgets/mycircular.dart';
import 'package:http/http.dart' as http;
import '../../constant/api_key.dart';
@@ -64,8 +65,7 @@ class FirebaseMessagesController extends GetxController {
}
box.write(BoxName.tokens, tokens);
} else {
Get.snackbar("Warning".tr, "Server Error".tr,
backgroundColor: AppColor.redColor);
mySnackbarWarning("Server Error".tr);
}
}

View File

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

View File

@@ -171,7 +171,7 @@ final Map<String, String> ar_eg = {
"Document Number:": "Document Number:",
"Documents check": "Documents check",
"Done": "Done",
"Driver": "Driver",
"Driver": "السائق",
"Driver Applied the Ride for You": "Driver Applied the Ride for You",
"Driver Cancel Your Trip": "Driver Cancel Your Trip",
"Driver Car Plate": "Driver Car Plate",
@@ -182,7 +182,7 @@ final Map<String, String> ar_eg = {
"Driver Information": "معلومات عن السائق",
"Driver Name": "Driver Name",
"Driver not found": "Driver not found",
"Driver phone": "Driver phone",
"Driver phone": "هاتف السائق",
"Driver Registration & Requirements": "Driver Registration & Requirements",
"Driver Statistics": "إحصاءات السائق",
"Driver Wallet": "Driver Wallet",
@@ -243,7 +243,7 @@ final Map<String, String> ar_eg = {
"Feedback data saved successfully": "Feedback data saved successfully",
"Female": "Female",
"First Name": "First Name",
"First name": "First name",
"First name": "الاسم الأول",
"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",
"Frequently Questions": "Frequently Questions",
@@ -370,7 +370,7 @@ final Map<String, String> ar_eg = {
"KM": "KM",
"Kuwait": "Kuwait",
"Language": "Language",
"Last name": "Last name",
"Last name": "الاسم الأخير",
"Last Payment Amount": "مبلغ آخر دفعة",
"Last Payment Method": "آخر طريقة دفع",
"Latest Recent Trip": "Latest Recent Trip",
@@ -385,7 +385,7 @@ final Map<String, String> ar_eg = {
"lime": "ليموني",
"Log Off": "Log Off",
"Log Out Page": "Log Out Page",
"Login": "Login",
"Login": "تسجيل الدخول",
"Login Captin": "Login Captin",
"Login Driver": "Login Driver",
"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 Out": "Sign Out",
"silver": "فضي",
"Siro Service": "Siro Service",
"Siro Service": "سيرو سيرفس",
"Sky Blue": "أزرق سماوي",
"So go and gain your money": "So go and gain your money",
"SOS Phone": "SOS Phone",
@@ -867,4 +867,25 @@ final Map<String, String> ar_eg = {
"📊 Reporting & Quality": "📊 Reporting & Quality",
"🔍 Search & Inquiries": "🔍 Search & Inquiries",
"🚗 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:",
"Documents check": "Documents check",
"Done": "Done",
"Driver": "Driver",
"Driver": "السائق",
"Driver Applied the Ride for You": "Driver Applied the Ride for You",
"Driver Cancel Your Trip": "Driver Cancel Your Trip",
"Driver Car Plate": "Driver Car Plate",
@@ -182,7 +182,7 @@ final Map<String, String> ar_jo = {
"Driver Information": "معلومات عن السائق",
"Driver Name": "Driver Name",
"Driver not found": "Driver not found",
"Driver phone": "Driver phone",
"Driver phone": "هاتف السائق",
"Driver Registration & Requirements": "Driver Registration & Requirements",
"Driver Statistics": "إحصاءات السائق",
"Driver Wallet": "Driver Wallet",
@@ -243,7 +243,7 @@ final Map<String, String> ar_jo = {
"Feedback data saved successfully": "Feedback data saved successfully",
"Female": "Female",
"First Name": "First Name",
"First name": "First name",
"First name": "الاسم الأول",
"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",
"Frequently Questions": "Frequently Questions",
@@ -370,7 +370,7 @@ final Map<String, String> ar_jo = {
"KM": "KM",
"Kuwait": "Kuwait",
"Language": "Language",
"Last name": "Last name",
"Last name": "الاسم الأخير",
"Last Payment Amount": "مبلغ آخر دفعة",
"Last Payment Method": "آخر طريقة دفع",
"Latest Recent Trip": "Latest Recent Trip",
@@ -385,7 +385,7 @@ final Map<String, String> ar_jo = {
"lime": "ليموني",
"Log Off": "Log Off",
"Log Out Page": "Log Out Page",
"Login": "Login",
"Login": "تسجيل الدخول",
"Login Captin": "Login Captin",
"Login Driver": "Login Driver",
"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 Out": "Sign Out",
"silver": "فضي",
"Siro Service": "Siro Service",
"Siro Service": "سيرو سيرفس",
"Sky Blue": "أزرق سماوي",
"So go and gain your money": "So go and gain your money",
"SOS Phone": "SOS Phone",
@@ -867,4 +867,25 @@ final Map<String, String> ar_jo = {
"📊 Reporting & Quality": "📊 Reporting & Quality",
"🔍 Search & Inquiries": "🔍 Search & Inquiries",
"🚗 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:",
"Documents check": "Documents check",
"Done": "Done",
"Driver": "Driver",
"Driver": "السائق",
"Driver Applied the Ride for You": "Driver Applied the Ride for You",
"Driver Cancel Your Trip": "Driver Cancel Your Trip",
"Driver Car Plate": "Driver Car Plate",
@@ -182,7 +182,7 @@ final Map<String, String> ar_sy = {
"Driver Information": "معلومات عن السائق",
"Driver Name": "Driver Name",
"Driver not found": "Driver not found",
"Driver phone": "Driver phone",
"Driver phone": "هاتف السائق",
"Driver Registration & Requirements": "Driver Registration & Requirements",
"Driver Statistics": "إحصاءات السائق",
"Driver Wallet": "Driver Wallet",
@@ -243,7 +243,7 @@ final Map<String, String> ar_sy = {
"Feedback data saved successfully": "Feedback data saved successfully",
"Female": "Female",
"First Name": "First Name",
"First name": "First name",
"First name": "الاسم الأول",
"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",
"Frequently Questions": "Frequently Questions",
@@ -370,7 +370,7 @@ final Map<String, String> ar_sy = {
"KM": "KM",
"Kuwait": "Kuwait",
"Language": "Language",
"Last name": "Last name",
"Last name": "الاسم الأخير",
"Last Payment Amount": "مبلغ آخر دفعة",
"Last Payment Method": "آخر طريقة دفع",
"Latest Recent Trip": "Latest Recent Trip",
@@ -385,7 +385,7 @@ final Map<String, String> ar_sy = {
"lime": "ليموني",
"Log Off": "Log Off",
"Log Out Page": "Log Out Page",
"Login": "Login",
"Login": "تسجيل الدخول",
"Login Captin": "Login Captin",
"Login Driver": "Login Driver",
"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 Out": "Sign Out",
"silver": "فضي",
"Siro Service": "Siro Service",
"Siro Service": "سيرو سيرفس",
"Sky Blue": "أزرق سماوي",
"So go and gain your money": "So go and gain your money",
"SOS Phone": "SOS Phone",
@@ -867,4 +867,25 @@ final Map<String, String> ar_sy = {
"📊 Reporting & Quality": "📊 Reporting & Quality",
"🔍 Search & Inquiries": "🔍 Search & Inquiries",
"🚗 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() {
String? storedLang = box.read(BoxName.lang);
if (storedLang == null) {
// Use device language if no language is stored
storedLang = Get.deviceLocale!.languageCode;
// Default to Arabic if no language is stored
storedLang = 'ar';
box.write(BoxName.lang, storedLang);
}

View File

@@ -10,6 +10,7 @@ import '../constant/box_name.dart';
import '../main.dart';
import '../print.dart';
import '../views/home/main.dart';
import '../views/widgets/mycircular.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
@@ -67,14 +68,11 @@ class LoginController extends GetxController {
if (otpSent) {
_showOtpDialog(phone, pass, fingerprint, d);
} else {
Get.snackbar('Error', 'Failed to send OTP'.tr);
mySnackbarError('Failed to send OTP'.tr);
}
} else {
Get.snackbar(
'خطأ'.tr,
mySnackbarError(
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
await _verifyOtpAndFinalize(phone, otpCode, pass, loginData);
} else {
Get.snackbar('خطأ', 'الرجاء إدخال رمز صحيح'.tr);
mySnackbarError('الرجاء إدخال رمز صحيح'.tr);
}
},
);
@@ -161,12 +159,12 @@ class LoginController extends GetxController {
Get.offAll(() => Main());
} else {
Get.snackbar('Error', 'Invalid OTP'.tr);
mySnackbarError('Invalid OTP'.tr);
}
} catch (e) {
Get.back();
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 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
String? storedPassword = await storage.read(key: 'password');
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 '../../print.dart';
import '../../views/widgets/mycircular.dart';
import 'pages/passengers_page.dart';
class MainController extends GetxController {
@@ -77,8 +78,7 @@ class MainController extends GetxController {
update();
Get.back();
if (passengerData.isEmpty) {
Get.snackbar('Error'.tr, 'Passenger not found'.tr,
backgroundColor: Colors.red, colorText: Colors.white);
mySnackbarError('Passenger not found'.tr);
return;
}
Get.to(() => PassengersPage());
@@ -111,11 +111,9 @@ class MainController extends GetxController {
key: value.toString(),
});
if (res == 'failure') {
Get.snackbar('Error', 'Failed to update driver data',
backgroundColor: AppColor.redColor);
mySnackbarError('Failed to update driver data'.tr);
} else {
Get.snackbar('Success', 'Driver data updated successfully',
backgroundColor: AppColor.greenColor);
mySnackbarSuccess('Driver data updated successfully'.tr);
}
// Optionally fetch driver again
// await getDriverData();
@@ -222,11 +220,11 @@ class MainController extends GetxController {
'phone': phone,
});
if (res != 'failure') {
Get.snackbar(res, '', backgroundColor: AppColor.greenColor);
mySnackbarSuccess(res is Map ? (res['message'] ?? 'Success'.tr) : res.toString());
// await getDriverWantCompleteRegistration();
update();
} else {
Get.snackbar(res, '');
mySnackbarError(res is Map ? (res['message'] ?? 'Error'.tr) : res.toString());
}
}
@@ -255,7 +253,7 @@ class MainController extends GetxController {
filteredDrivers = driverWantCompleteRegistration;
update();
} 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,
});
if (res != 'failure') {
Get.snackbar('Success'.tr, '', backgroundColor: AppColor.greenColor);
mySnackbarSuccess('Success'.tr);
}
}
@@ -292,7 +290,7 @@ class MainController extends GetxController {
passengerNotCompleteRegistration = d;
update();
} else {
Get.snackbar(res, '');
mySnackbarError(res is Map ? (res['message'] ?? 'Error'.tr) : res.toString());
}
}
@@ -395,18 +393,15 @@ class MainController extends GetxController {
payload: payload),
]);
Get.snackbar('Success', 'Registration successful',
backgroundColor: AppColor.greenColor);
mySnackbarSuccess('Registration successful'.tr);
Get.back();
} else {
Log.print('Error: Unexpected status: ${status['status']}');
Get.snackbar('Error', 'Registration failed',
backgroundColor: Colors.red);
mySnackbarError('Registration failed'.tr);
}
} catch (e) {
Log.print('Error: $e');
Get.snackbar('Error', 'An error occurred during registration',
backgroundColor: Colors.red);
mySnackbarError('An error occurred during registration'.tr);
}
}
@@ -435,7 +430,7 @@ class MainController extends GetxController {
});
Log.print('res: ${res}');
if (res != 'failure') {
// Get.snackbar(res, '', backgroundColor: AppColor.greenColor);
// mySnackbarSuccess(res is Map ? (res['message'] ?? 'Success'.tr) : res.toString());
Get.back();
carplateController.clear();
yearController.clear();
@@ -446,7 +441,7 @@ class MainController extends GetxController {
await getCarPlateNotEdit();
update();
} 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,
// });
// if (res != 'failure') {
// Get.snackbar(res, '', backgroundColor: AppColor.greenColor);
// mySnackbarSuccess(res is Map ? (res['message'] ?? 'Success'.tr) : res.toString());
// carplateController.clear();
// await getCarPlateNotEdit();
// update();
// } 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,
payload: {"phone": phone, "editor": editor, "note": note});
if (res != 'failure') {
Get.snackbar(res, '', backgroundColor: AppColor.greenColor);
mySnackbarSuccess(res is Map ? (res['message'] ?? 'Success'.tr) : res.toString());
getDriversPhoneNotComplete();
notesController.clear();
} 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,
payload: {"phone": phone, "editor": editor, "note": note});
if (res != 'failure') {
Get.snackbar(res, '', backgroundColor: AppColor.greenColor);
mySnackbarSuccess(res is Map ? (res['message'] ?? 'Success'.tr) : res.toString());
notesController.clear();
} 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();
Get.back();
if (driverData.isEmpty) {
Get.snackbar('Error'.tr, 'Driver not found'.tr,
backgroundColor: Colors.red, colorText: Colors.white);
mySnackbarError('Driver not found'.tr);
return;
}
Get.to(() => DriverPage());
@@ -517,8 +511,7 @@ class MainController extends GetxController {
update();
Get.back();
if (driverData.isEmpty) {
Get.snackbar('Error'.tr, 'Driver not found'.tr,
backgroundColor: Colors.red, colorText: Colors.white);
mySnackbarError('Driver not found'.tr);
return;
}
Get.to(() => DriverPage());
@@ -547,7 +540,7 @@ class MainController extends GetxController {
driverData = d;
update();
} 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;
update();
} 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:get/get.dart';
import 'package:siro_service/views/widgets/mycircular.dart';
import 'package:siro_service/controller/functions/encrypt_decrypt.dart';
import 'package:siro_service/views/widgets/my_scafold.dart';
@@ -99,7 +100,7 @@ class Driverthebest extends GetxController {
driver = res['message'];
update();
} 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),
child: Obx(
() => DropdownButtonFormField<String>(
initialValue: c.selectedGender.value.isEmpty
value: c.selectedGender.value.isEmpty
? null
: c.selectedGender.value,
isExpanded: true,
@@ -424,7 +424,7 @@ class ReviewDriverPage extends StatelessWidget {
padding: const EdgeInsets.symmetric(vertical: 6),
child: Obx(
() => DropdownButtonFormField<String>(
initialValue: c.colorHex.value.isEmpty ? null : c.colorHex.value,
value: c.colorHex.value.isEmpty ? null : c.colorHex.value,
isExpanded: true,
decoration: InputDecoration(
labelText: label.tr,
@@ -467,7 +467,7 @@ class ReviewDriverPage extends StatelessWidget {
padding: const EdgeInsets.symmetric(vertical: 6),
child: Obx(
() => DropdownButtonFormField<String>(
initialValue: ReviewDriverController.kFuelOptions
value: ReviewDriverController.kFuelOptions
.contains(c.selectedFuel.value)
? c.selectedFuel.value
: null,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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