chore: استيراد أولي من سيرو (ecfe7568) — بلا أي تعديل
نسخة كاملة من مستودع سيرو عند ecfe7568 لتكون أساس تطبيق «انطلق». نُسخ المتعقَّب في git فقط (12,509 ملفاً / 302 م.ب) بـ git archive، لا `cp -r` — فاستُثنيت تلقائياً مخلفات البناء (build · node_modules · .dart_tool · .gradle · Pods ≈ 10.7 غ.ب) وكل ما يستثنيه .gitignore. هذا الكوميت **بلا أي تعديل عمداً** حتى يكون كل ما يليه فرقاً مقروءاً مقابل سيرو الأصلي. سيرو نفسه لم يُمسّ. ⚠️ لا يبني بعد: `.env` و`lib/env/env.g.dart` غير متعقَّبين في سيرو (وهذا صحيح — أسرار لكل مستأجر). كل تطبيق فلاتر هنا يحتاج .env خاصاً بانطلق ثم توليد env.g.dart عبر build_runner. لا تُنسخ أسرار سيرو. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:siro_rider/constant/box_name.dart';
|
||||
import 'package:siro_rider/main.dart';
|
||||
|
||||
class PaymentTier {
|
||||
final double amount;
|
||||
final double bonus;
|
||||
const PaymentTier(this.amount, this.bonus);
|
||||
}
|
||||
|
||||
class PaymentTierConfig {
|
||||
final String currencyCode;
|
||||
final List<PaymentTier> tiers;
|
||||
const PaymentTierConfig({required this.currencyCode, required this.tiers});
|
||||
|
||||
static const Map<String, PaymentTierConfig> _configs = {
|
||||
'Jordan': PaymentTierConfig(
|
||||
currencyCode: 'JOD',
|
||||
tiers: [
|
||||
PaymentTier(5, 0),
|
||||
PaymentTier(10, 0.5),
|
||||
PaymentTier(20, 1),
|
||||
PaymentTier(50, 3),
|
||||
],
|
||||
),
|
||||
'Egypt': PaymentTierConfig(
|
||||
currencyCode: 'EGP',
|
||||
tiers: [
|
||||
PaymentTier(100, 0),
|
||||
PaymentTier(200, 10),
|
||||
PaymentTier(400, 20),
|
||||
PaymentTier(1000, 50),
|
||||
],
|
||||
),
|
||||
'Syria': PaymentTierConfig(
|
||||
currencyCode: 'SYP',
|
||||
tiers: [
|
||||
PaymentTier(100, 0),
|
||||
PaymentTier(200, 10),
|
||||
PaymentTier(400, 20),
|
||||
PaymentTier(1000, 50),
|
||||
],
|
||||
),
|
||||
};
|
||||
|
||||
static PaymentTierConfig get current {
|
||||
final country = box.read(BoxName.countryCode) ?? 'Jordan';
|
||||
return _configs[country] ?? _configs['Jordan']!;
|
||||
}
|
||||
|
||||
static List<PaymentTier> get currentTiers => current.tiers;
|
||||
static String get currentCurrency => current.currencyCode;
|
||||
|
||||
static String formatAmount(double v) {
|
||||
return v == v.roundToDouble() ? v.toInt().toString() : v.toStringAsFixed(1);
|
||||
}
|
||||
|
||||
static String tierLabel(int index) {
|
||||
final t = currentTiers[index];
|
||||
final cur = currentCurrency;
|
||||
if (t.bonus > 0) {
|
||||
return '${'Pay'.tr} ${formatAmount(t.amount)} $cur, ${'Get'.tr} ${formatAmount(t.amount + t.bonus)} $cur';
|
||||
}
|
||||
return '${formatAmount(t.amount)} $cur';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user