feat: implement splash and onboarding flows, update app assets, and add project design documentation

This commit is contained in:
Hamza-Ayed
2026-07-24 04:15:07 +03:00
parent 9f7bc31408
commit 213b459912
208 changed files with 23801 additions and 1066 deletions
@@ -0,0 +1,51 @@
class DialPlan {
final String callingCode;
final int nationalLength;
const DialPlan({required this.callingCode, required this.nationalLength});
}
/// أداة تطبيع رقم الهاتف لصيغة دولية موحدة (مطابقة للباك إند PhoneService).
class PhoneNormalizer {
static const Map<String, DialPlan> dialPlans = {
'JO': DialPlan(callingCode: '962', nationalLength: 9),
'SY': DialPlan(callingCode: '963', nationalLength: 9),
'EG': DialPlan(callingCode: '20', nationalLength: 10),
'SA': DialPlan(callingCode: '966', nationalLength: 9),
'AE': DialPlan(callingCode: '971', nationalLength: 9),
'IQ': DialPlan(callingCode: '964', nationalLength: 10),
};
/// يرجع الرقم في صيغة موحّدة (مثل 962791234567 أو +962791234567 حسب الحاجة).
static String normalize(String rawNumber, {String isoCode = 'JO', bool withPlus = true}) {
final countryKey = isoCode.toUpperCase();
final plan = dialPlans[countryKey] ?? const DialPlan(callingCode: '962', nationalLength: 9);
// إزالة كل الرموز باستثناء الأرقام
var digits = rawNumber.replaceAll(RegExp(r'\D'), '');
if (digits.isEmpty) return rawNumber;
// إزالة البادئة الدولية "00" إن وجدت
if (digits.startsWith('00')) {
digits = digits.substring(2);
}
String resultDigits = digits;
// 1) الرقم مكتوب بالفعل بمفتاح الدولة كلياً
if (digits.startsWith(plan.callingCode) &&
digits.length == plan.callingCode.length + plan.nationalLength) {
resultDigits = digits;
}
// 2) رقم محلي يبدأ بصفر (مثل 0791234567)
else if (digits.startsWith('0') && digits.length == plan.nationalLength + 1) {
resultDigits = plan.callingCode + digits.substring(1);
}
// 3) رقم محلي محذوف منه الصفر البادئ (مثل 791234567)
else if (digits.length == plan.nationalLength) {
resultDigits = plan.callingCode + digits;
}
return withPlus ? '+$resultDigits' : resultDigits;
}
}