Compare commits
2
Commits
e22cc5c7e4
...
ca766a2d4e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca766a2d4e | ||
|
|
6a33cc7241 |
@@ -22,6 +22,28 @@ class BuildConfig {
|
||||
|
||||
static const String logoAsset = 'assets/images/logo.png';
|
||||
static const String splashLogoAsset = 'assets/images/splash_logo.png';
|
||||
|
||||
/// روابط خارجية لكل مستأجر — تُولَّد مع بقية الملف (N3).
|
||||
static const String storeUrl = String.fromEnvironment(
|
||||
'STORE_URL',
|
||||
defaultValue: 'https://tripz.app',
|
||||
);
|
||||
static const String privacyUrl = String.fromEnvironment(
|
||||
'PRIVACY_URL',
|
||||
defaultValue: 'https://tripz.app/privacy',
|
||||
);
|
||||
|
||||
/// رقم دعم واتساب المستأجر — بصيغة دولية بلا `+`.
|
||||
static const String supportPhone = String.fromEnvironment(
|
||||
'SUPPORT_PHONE',
|
||||
defaultValue: '962790000000',
|
||||
);
|
||||
|
||||
/// رابط تطبيق الطرف الآخر — السائق يدعو ركّاباً والعكس.
|
||||
static const String driverAppUrl = String.fromEnvironment(
|
||||
'RIDER_APP_URL',
|
||||
defaultValue: 'https://tripz.app',
|
||||
);
|
||||
}
|
||||
|
||||
/// أعلام الاستحقاقات (docs/23 §5). **`const` إجبارياً** كي يُحذف كود الميزة
|
||||
|
||||
@@ -16,6 +16,8 @@ import '../features/profile/data/profile_repository.dart';
|
||||
import '../features/rating/cubit/rating_cubit.dart';
|
||||
|
||||
import '../features/rating/data/rating_repository.dart';
|
||||
import '../features/rewards/cubit/rewards_cubit.dart';
|
||||
import '../features/rewards/data/rewards_repository.dart';
|
||||
|
||||
import '../features/settings/cubit/settings_cubit.dart';
|
||||
|
||||
@@ -113,6 +115,12 @@ Future<void> setupInjector() async {
|
||||
sl.registerFactory<HistoryCubit>(() => HistoryCubit(sl()));
|
||||
|
||||
sl.registerSingleton<RatingRepository>(RatingRepository(sl()));
|
||||
|
||||
// المكافآت خلف علم الكوبونات: الدعوات والكوبونات وجهان لنفس الوحدة.
|
||||
if (Features.coupons) {
|
||||
sl.registerSingleton<RewardsRepository>(RewardsRepository(sl()));
|
||||
sl.registerFactory<RewardsCubit>(() => RewardsCubit(sl()));
|
||||
}
|
||||
sl.registerFactory<RatingCubit>(() => RatingCubit(sl()));
|
||||
|
||||
// الدردشة خلف علمها: إطفاؤه يحذف كودها من الـbinary (docs/23 §5).
|
||||
|
||||
@@ -194,6 +194,56 @@
|
||||
"chatEmpty": "لا رسائل بعد",
|
||||
"rideCoupon": "كود خصم",
|
||||
"rideCouponApply": "تطبيق",
|
||||
"rideNoLocation": "فعّل الموقع لنعرف أين أنت",
|
||||
"rideBack": "رجوع",
|
||||
"rideRetryQuote": "أعد حساب الأجرة",
|
||||
"rideFrom": "من",
|
||||
"rideTo": "إلى",
|
||||
"walletChannel": "طريقة الدفع",
|
||||
"rideTypeUnavailable": "غير متاح",
|
||||
"rideSearchNoResults": "لا نتائج — جرّب اسماً آخر أو حدّد من الخريطة",
|
||||
"walletInvoiceTitle": "أكمل التحويل",
|
||||
"walletInvoiceRef": "رقم المرجع",
|
||||
"walletInvoiceTarget": "حوّل إلى",
|
||||
"walletInvoicePending": "سيُضاف الرصيد فور تأكيد التحويل",
|
||||
"walletCopy": "نسخ",
|
||||
"walletCopied": "نُسخ",
|
||||
"walletNoTarget": "لم يُضبط حساب استلام لهذه القناة بعد — راجع المشغّل",
|
||||
"rewardsTitle": "مكافآتي",
|
||||
"rewardsInviteTitle": "ادعُ سائقاً",
|
||||
"rewardsInviteLead": "شارك كودك — تربح عن كل سائق ينضم",
|
||||
"rewardsCode": "كود الدعوة",
|
||||
"rewardsInvited": "دعوتَهم",
|
||||
"rewardsPending": "قيد التأكيد",
|
||||
"rewardsPaid": "مكافآت مدفوعة",
|
||||
"rewardsCoupons": "كوبوناتي",
|
||||
"rewardsCouponsEmpty": "لا كوبونات صالحة الآن",
|
||||
"menuRewards": "مكافآتي",
|
||||
"menuInvite": "ادعُ سائقاً",
|
||||
"menuShare": "شارك التطبيق",
|
||||
"menuNotifications": "الإشعارات",
|
||||
"menuPrivacy": "سياسة الخصوصية",
|
||||
"menuRateApp": "قيّم التطبيق",
|
||||
"shareMessage": "انضم لـTripz كسائق — استعمل كودي {code}",
|
||||
"menuDriverApp": "تطبيق الراكب",
|
||||
"@shareMessage": {
|
||||
"placeholders": {
|
||||
"code": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"supportFaqQ1": "كيف أطلب رحلة؟",
|
||||
"supportFaqA1": "حدّد وجهتك من البحث أو من الخريطة، اختر نوع الرحلة، ثم اضغط «اطلب الرحلة».",
|
||||
"supportFaqQ2": "كيف أشحن رصيدي؟",
|
||||
"supportFaqA2": "من المحفظة اختر المبلغ وطريقة الدفع. ستظهر لك تعليمات التحويل ورقم مرجع — يُضاف الرصيد بعد تأكيد التحويل.",
|
||||
"supportFaqQ3": "لماذا لا يظهر سائق؟",
|
||||
"supportFaqA3": "قد لا يوجد سائقون قريبون في هذا الوقت. جرّب بعد قليل أو غيّر نوع الرحلة.",
|
||||
"supportFaqQ4": "كيف ألغي رحلة؟",
|
||||
"supportFaqA4": "من بطاقة الرحلة اضغط «إلغاء الرحلة». الإلغاء بعد وصول السائق قد يترتّب عليه رسم.",
|
||||
"supportDeviceCheck": "فحص توافق الجهاز",
|
||||
"supportDeviceOk": "جهازك متوافق",
|
||||
"supportDeviceIssues": "مشاكل قد تؤثّر على عمل التطبيق",
|
||||
"obApplyTitle": "سجّل كسائق",
|
||||
"obApplyLead": "خطوات قصيرة ثم تبدأ العمل",
|
||||
"obVehicleMake": "شركة السيارة",
|
||||
|
||||
@@ -194,6 +194,56 @@
|
||||
"chatEmpty": "No messages yet",
|
||||
"rideCoupon": "Promo code",
|
||||
"rideCouponApply": "Apply",
|
||||
"rideNoLocation": "Turn on location so we know where you are",
|
||||
"rideBack": "Back",
|
||||
"rideRetryQuote": "Recalculate fare",
|
||||
"rideFrom": "From",
|
||||
"rideTo": "To",
|
||||
"walletChannel": "Payment method",
|
||||
"rideTypeUnavailable": "Unavailable",
|
||||
"rideSearchNoResults": "No results — try another name or pick on the map",
|
||||
"walletInvoiceTitle": "Complete the transfer",
|
||||
"walletInvoiceRef": "Reference",
|
||||
"walletInvoiceTarget": "Transfer to",
|
||||
"walletInvoicePending": "Your balance updates once the transfer is confirmed",
|
||||
"walletCopy": "Copy",
|
||||
"walletCopied": "Copied",
|
||||
"walletNoTarget": "No receiving account is configured for this channel yet — contact the operator",
|
||||
"rewardsTitle": "My rewards",
|
||||
"rewardsInviteTitle": "Invite a driver",
|
||||
"rewardsInviteLead": "Share your code — earn for every driver who joins",
|
||||
"rewardsCode": "Invite code",
|
||||
"rewardsInvited": "Invited",
|
||||
"rewardsPending": "Pending",
|
||||
"rewardsPaid": "Rewards paid",
|
||||
"rewardsCoupons": "My coupons",
|
||||
"rewardsCouponsEmpty": "No valid coupons right now",
|
||||
"menuRewards": "My rewards",
|
||||
"menuInvite": "Invite a driver",
|
||||
"menuShare": "Share the app",
|
||||
"menuNotifications": "Notifications",
|
||||
"menuPrivacy": "Privacy policy",
|
||||
"menuRateApp": "Rate the app",
|
||||
"shareMessage": "Join Tripz as a driver — use my code {code}",
|
||||
"menuDriverApp": "Rider app",
|
||||
"@shareMessage": {
|
||||
"placeholders": {
|
||||
"code": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"supportFaqQ1": "How do I request a ride?",
|
||||
"supportFaqA1": "Pick your destination from search or the map, choose a ride type, then tap “Request ride”.",
|
||||
"supportFaqQ2": "How do I top up?",
|
||||
"supportFaqA2": "In the wallet, choose an amount and a payment method. You'll get transfer instructions and a reference — your balance updates once the transfer is confirmed.",
|
||||
"supportFaqQ3": "Why is no driver showing up?",
|
||||
"supportFaqA3": "There may be no drivers nearby right now. Try again shortly or change the ride type.",
|
||||
"supportFaqQ4": "How do I cancel?",
|
||||
"supportFaqA4": "Tap “Cancel ride” on the trip card. Cancelling after the driver arrives may incur a fee.",
|
||||
"supportDeviceCheck": "Check device compatibility",
|
||||
"supportDeviceOk": "Your device is compatible",
|
||||
"supportDeviceIssues": "Issues that may affect the app",
|
||||
"obApplyTitle": "Register as a driver",
|
||||
"obApplyLead": "A few short steps, then you're working",
|
||||
"obVehicleMake": "Car make",
|
||||
|
||||
@@ -4,18 +4,23 @@
|
||||
/// المستأجر هو من يحدّد السوق: مشغّل أردني يخدم مستخدماً هاتفه إنجليزي
|
||||
/// وموقعه خارج الأردن يبقى أردنيّ القنوات.
|
||||
///
|
||||
/// ⚠️ **`POST /wallet/topup` شحنٌ تجريبي بلا مزوّد دفع خلفه** — الخادم نفسه
|
||||
/// يصفه بـ«كاش-إن، للإنتاج يُربط بمزوّد دفع أو يُقيَّد للأدمن». اختيار
|
||||
/// القناة هنا يجهّز الواجهة والعقد؛ التحصيل الفعلي عبر `/payments/charge`
|
||||
/// وبوابة كل قناة عملٌ منفصل لم يُنفَّذ بعد.
|
||||
/// الشحن يمرّ بـ**`POST /payments/charge`** لا `POST /wallet/topup` — الأخير
|
||||
/// كاش-إن تجريبي يزيد الرصيد بلا دفع.
|
||||
///
|
||||
/// كليك وشام كاش وزين كاش تعمل بنمط **الفاتورة**: الخادم يولّد مرجعاً ويعرض
|
||||
/// حساب الاستلام، والمستخدم يحوّل، والتسوية تصل لاحقاً عبر مطابقة رسالة
|
||||
/// المزوّد (SMS) — وهو **نفس ما يفعله سيرو** حرفياً
|
||||
/// (`create_cliq_invoice.php`). لا بوابة تحويل حيّة لأيٍّ منها.
|
||||
/// PayMob وحده يعمل بإعادة توجيه فعلية.
|
||||
enum PaymentChannel {
|
||||
// ⚠️ `wire` يجب أن يطابق اسم المحوّل في `PaymentGatewayRegistry` حرفياً —
|
||||
// أي اسم آخر يرجّع 400 `unsupported provider`.
|
||||
cliq('cliq', 'CliQ', 'كليك'),
|
||||
syriatel('syriatel_cash', 'Syriatel Cash', 'سيرياتيل كاش'),
|
||||
mtn('mtn_cash', 'MTN Cash', 'إم تي إن كاش'),
|
||||
shamCash('sham_cash', 'Sham Cash', 'شام كاش'),
|
||||
syriatel('syriatel', 'Syriatel Cash', 'سيرياتيل كاش'),
|
||||
mtn('mtn', 'MTN Cash', 'إم تي إن كاش'),
|
||||
shamCash('shamcash', 'Sham Cash', 'شام كاش'),
|
||||
zainCash('zaincash', 'ZainCash', 'زين كاش'),
|
||||
paymob('paymob', 'PayMob', 'باي موب'),
|
||||
zainCash('zain_cash', 'ZainCash', 'زين كاش'),
|
||||
qiCard('qi_card', 'Qi Card', 'كي كارد'),
|
||||
cash('cash', 'Cash', 'نقداً');
|
||||
|
||||
const PaymentChannel(this.wire, this.nameEn, this.nameAr);
|
||||
@@ -43,11 +48,7 @@ enum PaymentChannel {
|
||||
// العراق: المحافظ الأشيع محلياً. ⚠️ الباك إند لا يعرف حزمة `iq` بعد
|
||||
// (`default-tariffs.ts` فيه jo/sy/eg فقط) — مستأجر عراقي يُزوَّد بلا
|
||||
// تعرفة، وهذا شغل خادم يسبق أي إطلاق عراقي.
|
||||
'iq' => const [
|
||||
PaymentChannel.zainCash,
|
||||
PaymentChannel.qiCard,
|
||||
PaymentChannel.cash,
|
||||
],
|
||||
'iq' => const [PaymentChannel.zainCash, PaymentChannel.cash],
|
||||
// حزمة غير معروفة: النقد وحده — لا نعرض قناة قد لا تعمل في سوقها.
|
||||
_ => const [PaymentChannel.cash],
|
||||
};
|
||||
|
||||
@@ -11,6 +11,7 @@ import '../features/profile/view/profile_edit_page.dart';
|
||||
import '../features/profile/view/profile_setup_page.dart';
|
||||
|
||||
import '../features/rating/data/rating_repository.dart';
|
||||
import '../features/rewards/view/rewards_page.dart';
|
||||
|
||||
import '../features/rating/view/rating_page.dart';
|
||||
|
||||
@@ -46,6 +47,7 @@ class Routes {
|
||||
static const profileEdit = '/account';
|
||||
static const settings = '/settings';
|
||||
static const support = '/support';
|
||||
static const rewards = '/rewards';
|
||||
static const chat = '/chat';
|
||||
static const onboarding = '/onboarding';
|
||||
}
|
||||
@@ -135,6 +137,10 @@ final appRouter = GoRouter(
|
||||
path: Routes.onboarding,
|
||||
builder: (context, state) => const OnboardingPage(),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.rewards,
|
||||
builder: (context, state) => const RewardsPage(),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.support,
|
||||
builder: (context, state) => const SupportPage(),
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../build_config.dart';
|
||||
import '../config.dart';
|
||||
@@ -52,6 +54,13 @@ class AppDrawer extends StatelessWidget {
|
||||
label: isDriver ? l10n.menuEarnings : l10n.menuWallet,
|
||||
route: Routes.wallet,
|
||||
),
|
||||
if (Features.coupons && context.tenantHas('coupons'))
|
||||
_Item(
|
||||
icon: Icons.card_giftcard_rounded,
|
||||
label: l10n.menuRewards,
|
||||
route: Routes.rewards,
|
||||
),
|
||||
const Divider(indent: Space.md, endIndent: Space.md),
|
||||
_Item(
|
||||
icon: Icons.settings_outlined,
|
||||
label: l10n.menuSettings,
|
||||
@@ -62,6 +71,29 @@ class AppDrawer extends StatelessWidget {
|
||||
label: l10n.menuSupport,
|
||||
route: Routes.support,
|
||||
),
|
||||
// مداخل محليّة بلا نقطة خادم — تُنفَّذ في الجهاز مباشرة.
|
||||
_Action(
|
||||
icon: Icons.share_outlined,
|
||||
label: l10n.menuShare,
|
||||
onTap: () => SharePlus.instance
|
||||
.share(ShareParams(text: l10n.shareMessage(''))),
|
||||
),
|
||||
_Action(
|
||||
icon: Icons.star_outline_rounded,
|
||||
label: l10n.menuRateApp,
|
||||
onTap: () => _open(BuildConfig.storeUrl),
|
||||
),
|
||||
_Action(
|
||||
icon: Icons.shield_outlined,
|
||||
label: l10n.menuPrivacy,
|
||||
onTap: () => _open(BuildConfig.privacyUrl),
|
||||
),
|
||||
if (!isDriver)
|
||||
_Action(
|
||||
icon: Icons.local_taxi_outlined,
|
||||
label: l10n.menuDriverApp,
|
||||
onTap: () => _open(BuildConfig.driverAppUrl),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -83,6 +115,13 @@ class AppDrawer extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
static Future<void> _open(String url) async {
|
||||
final uri = Uri.tryParse(url);
|
||||
if (uri == null) return;
|
||||
// فشل الفتح لا يُسقط شيئاً — رابط خارجي ليس جزءاً من التطبيق.
|
||||
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||
}
|
||||
|
||||
Future<void> _confirmLogout(BuildContext context) async {
|
||||
final l10n = context.l10n;
|
||||
final session = context.read<SessionCubit>();
|
||||
@@ -155,6 +194,31 @@ class _Header extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
/// مدخل ينفّذ فعلاً محلياً (مشاركة · رابط خارجي) لا تنقّلاً.
|
||||
class _Action extends StatelessWidget {
|
||||
const _Action({
|
||||
required this.icon,
|
||||
required this.label,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
final IconData icon;
|
||||
final String label;
|
||||
final VoidCallback onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
leading: Icon(icon),
|
||||
title: Text(label),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
onTap();
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _Item extends StatelessWidget {
|
||||
const _Item({required this.icon, required this.label, required this.route});
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../core/api/api_exception.dart';
|
||||
import '../../../core/ui/view_status.dart';
|
||||
import '../data/rewards_repository.dart';
|
||||
|
||||
class RewardsState {
|
||||
const RewardsState({
|
||||
this.status = ViewStatus.idle,
|
||||
this.referrals,
|
||||
this.coupons = const [],
|
||||
this.error,
|
||||
});
|
||||
|
||||
final ViewStatus status;
|
||||
final ReferralSummary? referrals;
|
||||
final List<Coupon> coupons;
|
||||
final String? error;
|
||||
}
|
||||
|
||||
class RewardsCubit extends Cubit<RewardsState> {
|
||||
RewardsCubit(this._repo) : super(const RewardsState());
|
||||
|
||||
final RewardsRepository _repo;
|
||||
|
||||
Future<void> load() async {
|
||||
emit(const RewardsState(status: ViewStatus.loading));
|
||||
try {
|
||||
// النداءان متوازيان: لا سبب لانتظار أحدهما الآخر.
|
||||
final results = await Future.wait([
|
||||
_repo.referrals(),
|
||||
_repo.coupons(),
|
||||
]);
|
||||
if (isClosed) return;
|
||||
emit(RewardsState(
|
||||
status: ViewStatus.success,
|
||||
referrals: results[0] as ReferralSummary,
|
||||
coupons: results[1] as List<Coupon>,
|
||||
));
|
||||
} on ApiException catch (e) {
|
||||
if (!isClosed) {
|
||||
emit(RewardsState(status: ViewStatus.error, error: e.message));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
import '../../../core/api/api_client.dart';
|
||||
|
||||
/// ملخّص الدعوات — شكل مُتحقَّق حيّاً: `{code, total, pending, paid}`.
|
||||
class ReferralSummary {
|
||||
const ReferralSummary({
|
||||
required this.code,
|
||||
required this.total,
|
||||
required this.pending,
|
||||
required this.paid,
|
||||
});
|
||||
|
||||
/// كود دعوتي الذي أشاركه.
|
||||
final String code;
|
||||
|
||||
final int total;
|
||||
final int pending;
|
||||
final int paid;
|
||||
|
||||
factory ReferralSummary.fromJson(Map<String, dynamic> json) =>
|
||||
ReferralSummary(
|
||||
code: json['code'] as String? ?? '',
|
||||
total: (json['total'] as num?)?.toInt() ?? 0,
|
||||
pending: (json['pending'] as num?)?.toInt() ?? 0,
|
||||
paid: (json['paid'] as num?)?.toInt() ?? 0,
|
||||
);
|
||||
}
|
||||
|
||||
class Coupon {
|
||||
const Coupon({
|
||||
required this.code,
|
||||
this.description = '',
|
||||
this.expiresAt,
|
||||
});
|
||||
|
||||
final String code;
|
||||
final String description;
|
||||
final DateTime? expiresAt;
|
||||
|
||||
factory Coupon.fromJson(Map<String, dynamic> json) => Coupon(
|
||||
code: json['code'] as String? ?? '',
|
||||
description: json['description'] as String? ??
|
||||
json['title'] as String? ??
|
||||
'',
|
||||
expiresAt: DateTime.tryParse(json['expires_at']?.toString() ?? ''),
|
||||
);
|
||||
}
|
||||
|
||||
class RewardsRepository {
|
||||
RewardsRepository(this._api);
|
||||
|
||||
final ApiClient _api;
|
||||
|
||||
Future<ReferralSummary> referrals() async {
|
||||
final res = await _api.get<Map<String, dynamic>>('/rewards/referrals');
|
||||
return ReferralSummary.fromJson(res);
|
||||
}
|
||||
|
||||
Future<List<Coupon>> coupons() async {
|
||||
final res = await _api.get<List<dynamic>>('/rewards/coupons');
|
||||
return res
|
||||
.whereType<Map<String, dynamic>>()
|
||||
.map(Coupon.fromJson)
|
||||
.toList(growable: false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
|
||||
import '../../../core/design/tokens.dart';
|
||||
import '../../../core/design/tripz_colors.dart';
|
||||
import '../../../core/design/typography.dart';
|
||||
import '../../../core/di.dart';
|
||||
import '../../../core/l10n/l10n.dart';
|
||||
import '../../../core/ui/tripz_button.dart';
|
||||
import '../../../core/ui/tripz_card.dart';
|
||||
import '../../../core/ui/tripz_scaffold.dart';
|
||||
import '../cubit/rewards_cubit.dart';
|
||||
|
||||
/// «مكافآتي» — الدعوات والكوبونات في شاشة واحدة (نمط سيرو: Promos + Invite).
|
||||
class RewardsPage extends StatefulWidget {
|
||||
const RewardsPage({super.key});
|
||||
|
||||
@override
|
||||
State<RewardsPage> createState() => _RewardsPageState();
|
||||
}
|
||||
|
||||
class _RewardsPageState extends State<RewardsPage> {
|
||||
late final RewardsCubit _cubit = sl<RewardsCubit>()..load();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_cubit.close();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = context.l10n;
|
||||
return BlocProvider.value(
|
||||
value: _cubit,
|
||||
child: BlocBuilder<RewardsCubit, RewardsState>(
|
||||
builder: (context, state) {
|
||||
final ref = state.referrals;
|
||||
return TripzScaffold(
|
||||
title: l10n.rewardsTitle,
|
||||
status: state.status,
|
||||
error: state.error,
|
||||
onRetry: _cubit.load,
|
||||
child: ListView(
|
||||
children: [
|
||||
if (ref != null) _InviteCard(code: ref.code, summary: ref),
|
||||
const SizedBox(height: Space.lg),
|
||||
Text(l10n.rewardsCoupons, style: context.texts.titleMedium),
|
||||
const SizedBox(height: Space.xs),
|
||||
if (state.coupons.isEmpty)
|
||||
Text(
|
||||
l10n.rewardsCouponsEmpty,
|
||||
style: context.texts.bodySmall?.copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
),
|
||||
)
|
||||
else
|
||||
for (final coupon in state.coupons) ...[
|
||||
TripzCard(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.local_offer_outlined,
|
||||
color: context.tripzColors.success,
|
||||
),
|
||||
const SizedBox(width: Space.sm),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
coupon.code,
|
||||
textDirection: TextDirection.ltr,
|
||||
style: numericStyle(context.texts.titleSmall),
|
||||
),
|
||||
if (coupon.description.isNotEmpty)
|
||||
Text(
|
||||
coupon.description,
|
||||
style: context.texts.bodySmall?.copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: Space.xs),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _InviteCard extends StatelessWidget {
|
||||
const _InviteCard({required this.code, required this.summary});
|
||||
|
||||
final String code;
|
||||
final dynamic summary;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = context.l10n;
|
||||
return Container(
|
||||
padding: Space.page,
|
||||
decoration: BoxDecoration(
|
||||
color: context.colors.primaryContainer,
|
||||
borderRadius: Radii.card_,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
l10n.rewardsInviteTitle,
|
||||
style: context.texts.titleMedium?.copyWith(
|
||||
color: context.colors.onPrimaryContainer,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: Space.xxs),
|
||||
Text(
|
||||
l10n.rewardsInviteLead,
|
||||
style: context.texts.bodySmall?.copyWith(
|
||||
color: context.colors.onPrimaryContainer.withValues(alpha: 0.8),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: Space.md),
|
||||
// الكود يُنسخ ويُشارك — الطريقان اللذان يستعملهما الناس فعلاً.
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SelectableText(
|
||||
code,
|
||||
textDirection: TextDirection.ltr,
|
||||
style: numericStyle(context.texts.headlineSmall).copyWith(
|
||||
letterSpacing: 3,
|
||||
color: context.colors.onPrimaryContainer,
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.copy_rounded),
|
||||
color: context.colors.onPrimaryContainer,
|
||||
onPressed: () => Clipboard.setData(ClipboardData(text: code)),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: Space.sm),
|
||||
TripzButton.primary(
|
||||
label: l10n.menuShare,
|
||||
icon: Icons.share_outlined,
|
||||
onPressed: () =>
|
||||
SharePlus.instance.share(ShareParams(text: l10n.shareMessage(code))),
|
||||
),
|
||||
const SizedBox(height: Space.md),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
_Stat(label: l10n.rewardsInvited, value: summary.total),
|
||||
_Stat(label: l10n.rewardsPending, value: summary.pending),
|
||||
_Stat(label: l10n.rewardsPaid, value: summary.paid),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _Stat extends StatelessWidget {
|
||||
const _Stat({required this.label, required this.value});
|
||||
|
||||
final String label;
|
||||
final int value;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Text(
|
||||
'$value',
|
||||
style: numericStyle(context.texts.titleLarge).copyWith(
|
||||
color: context.colors.onPrimaryContainer,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
label,
|
||||
style: context.texts.labelSmall?.copyWith(
|
||||
color: context.colors.onPrimaryContainer.withValues(alpha: 0.8),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../../core/build_config.dart';
|
||||
import '../../../core/design/tokens.dart';
|
||||
@@ -7,35 +10,79 @@ import '../../../core/l10n/l10n.dart';
|
||||
import '../../../core/ui/tripz_card.dart';
|
||||
import '../../../core/ui/tripz_scaffold.dart';
|
||||
|
||||
/// المساعدة و«عن التطبيق». محتوى محلّي عمداً: الخادم لا يوفّر نقطة أسئلة
|
||||
/// شائعة، وربطها بنصّ من الشبكة يعني شاشة فارغة حين ينقطع الاتصال — وهو
|
||||
/// بالضبط الوقت الذي يفتح فيه المستخدم المساعدة.
|
||||
/// المساعدة: أسئلة شائعة · تواصل · فحص توافق الجهاز · عن التطبيق.
|
||||
///
|
||||
/// المحتوى **محلّي عمداً**: الخادم لا يوفّر نقطة أسئلة شائعة، وربطها بالشبكة
|
||||
/// يعني شاشة فارغة حين ينقطع الاتصال — وهو بالضبط الوقت الذي يفتح فيه
|
||||
/// المستخدم المساعدة.
|
||||
class SupportPage extends StatelessWidget {
|
||||
const SupportPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = context.l10n;
|
||||
final faq = [
|
||||
(l10n.supportFaqQ1, l10n.supportFaqA1),
|
||||
(l10n.supportFaqQ2, l10n.supportFaqA2),
|
||||
(l10n.supportFaqQ3, l10n.supportFaqA3),
|
||||
(l10n.supportFaqQ4, l10n.supportFaqA4),
|
||||
];
|
||||
|
||||
return TripzScaffold(
|
||||
title: l10n.supportTitle,
|
||||
child: ListView(
|
||||
children: [
|
||||
TripzCard(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(l10n.supportContact, style: context.texts.titleMedium),
|
||||
const SizedBox(height: Space.xs),
|
||||
Text(
|
||||
l10n.supportWhatsapp,
|
||||
style: context.texts.bodyMedium?.copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
Text(l10n.supportFaq, style: context.texts.titleMedium),
|
||||
const SizedBox(height: Space.xs),
|
||||
for (final (q, a) in faq)
|
||||
Card(
|
||||
margin: const EdgeInsets.only(bottom: Space.xs),
|
||||
child: ExpansionTile(
|
||||
shape: const RoundedRectangleBorder(borderRadius: Radii.card_),
|
||||
title: Text(q, style: context.texts.bodyMedium),
|
||||
children: [
|
||||
Padding(
|
||||
padding: Space.page,
|
||||
child: Text(
|
||||
a,
|
||||
style: context.texts.bodySmall?.copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: Space.lg),
|
||||
Text(l10n.supportContact, style: context.texts.titleMedium),
|
||||
const SizedBox(height: Space.xs),
|
||||
TripzCard(
|
||||
onTap: () => _openWhatsapp(BuildConfig.supportPhone),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.chat_outlined, color: context.tripzColors.success),
|
||||
const SizedBox(width: Space.sm),
|
||||
Expanded(child: Text(l10n.supportWhatsapp)),
|
||||
const Icon(Icons.chevron_left_rounded),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: Space.md),
|
||||
TripzCard(
|
||||
onTap: () => _showDeviceCheck(context),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.phonelink_setup_outlined),
|
||||
const SizedBox(width: Space.sm),
|
||||
Expanded(child: Text(l10n.supportDeviceCheck)),
|
||||
const Icon(Icons.chevron_left_rounded),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: Space.lg),
|
||||
TripzCard(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
@@ -54,4 +101,69 @@ class SupportPage extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static Future<void> _openWhatsapp(String phone) async {
|
||||
final uri = Uri.parse('https://wa.me/$phone');
|
||||
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||
}
|
||||
|
||||
/// فحص توافق الجهاز — نمط سيرو. يفحص ما يُعطّل التطبيق فعلاً: خدمة الموقع
|
||||
/// وإذنها وإذن الإشعارات. أسبابٌ حقيقية لشكاوى «التطبيق لا يعمل».
|
||||
static Future<void> _showDeviceCheck(BuildContext context) async {
|
||||
final l10n = context.l10n;
|
||||
final issues = <String>[];
|
||||
|
||||
if (!await Geolocator.isLocationServiceEnabled()) {
|
||||
issues.add(l10n.rideNoLocation);
|
||||
}
|
||||
final locationPermission = await Permission.locationWhenInUse.status;
|
||||
if (!locationPermission.isGranted && !locationPermission.isLimited) {
|
||||
issues.add(l10n.permissionDeniedForever);
|
||||
}
|
||||
if (await Permission.notification.isDenied) {
|
||||
issues.add(l10n.notifDenied);
|
||||
}
|
||||
|
||||
if (!context.mounted) return;
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(l10n.supportDeviceCheck),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: issues.isEmpty
|
||||
? [
|
||||
Row(children: [
|
||||
Icon(Icons.check_circle_rounded,
|
||||
color: context.tripzColors.success),
|
||||
const SizedBox(width: Space.xs),
|
||||
Expanded(child: Text(l10n.supportDeviceOk)),
|
||||
]),
|
||||
]
|
||||
: [
|
||||
Text(l10n.supportDeviceIssues),
|
||||
const SizedBox(height: Space.xs),
|
||||
for (final issue in issues)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: Space.xxs),
|
||||
child: Row(children: [
|
||||
Icon(Icons.error_outline_rounded,
|
||||
size: Sizes.iconSm,
|
||||
color: context.tripzColors.warning),
|
||||
const SizedBox(width: Space.xs),
|
||||
Expanded(child: Text(issue)),
|
||||
]),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text(l10n.actionContinue),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,13 @@ class MapsRepository {
|
||||
|
||||
final AntlaqApi _api;
|
||||
|
||||
/// ⚠️ **الغلافان مختلفان بين النقطتين** (مثبت بـcurl 2026-08-05):
|
||||
/// `search` يرجّع `{"results":[…]}` بينما `reverse` يرجّع **مصفوفة عارية**.
|
||||
/// افتراض أن كليهما مصفوفة كان يُفشل البحث صامتاً — فيبدو للمستخدم أن
|
||||
/// «البحث لا يستجيب» بينما التحديد من الخريطة يعمل.
|
||||
Future<List<Place>> search(String query, {GeoPoint? near}) async {
|
||||
if (query.trim().isEmpty) return const [];
|
||||
final res = await _api.get<List<dynamic>>(
|
||||
final res = await _api.get<Map<String, dynamic>>(
|
||||
'/geocoding/search',
|
||||
query: {
|
||||
'q': query.trim(),
|
||||
@@ -20,7 +24,9 @@ class MapsRepository {
|
||||
if (near != null) 'lng': near.lng,
|
||||
},
|
||||
);
|
||||
return res
|
||||
final results = res['results'];
|
||||
if (results is! List) return const [];
|
||||
return results
|
||||
.whereType<Map<String, dynamic>>()
|
||||
.map(Place.fromJson)
|
||||
.toList(growable: false);
|
||||
|
||||
@@ -26,6 +26,7 @@ class Place extends Equatable {
|
||||
name: (json['name_ar'] as String?)?.trim().isNotEmpty == true
|
||||
? json['name_ar'] as String
|
||||
: (json['name'] as String? ?? ''),
|
||||
// `address` قد يصل `null` صراحةً من map-saas — لا يُسقِط النتيجة.
|
||||
address: json['address'] as String? ?? '',
|
||||
category: json['category'] as String? ?? '',
|
||||
point: GeoPoint(
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../core/design/tokens.dart';
|
||||
import '../../../../core/design/tripz_colors.dart';
|
||||
|
||||
/// بطاقة اسم فوق نقطة على الخريطة — نمط سيرو: الراكب يقرأ «دوّار عبدون» على
|
||||
/// الخريطة نفسها لا في الورقة السفلية وحدها، فيتأكّد أن النقطة صحيحة قبل
|
||||
/// أن يطلب.
|
||||
///
|
||||
/// تُرسم في طبقة فلاتر فوق الخريطة لا كـmarker: نصّ عربي داخل صورة علامة
|
||||
/// يصعب ضبطه، وطبقة فلاتر تعطينا الخط والاتجاه والثيم مجاناً.
|
||||
class MapLabel extends StatelessWidget {
|
||||
const MapLabel({
|
||||
super.key,
|
||||
required this.text,
|
||||
required this.color,
|
||||
this.icon,
|
||||
});
|
||||
|
||||
final String text;
|
||||
final Color color;
|
||||
final IconData? icon;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (text.isEmpty) return const SizedBox.shrink();
|
||||
return Container(
|
||||
constraints: const BoxConstraints(maxWidth: 200),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: Space.xs,
|
||||
vertical: Space.xxs,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: context.tripzColors.surfaceRaised,
|
||||
borderRadius: Radii.field_,
|
||||
border: Border.all(color: color, width: 1.5),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.18),
|
||||
blurRadius: 6,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: BoxDecoration(color: color, shape: BoxShape.circle),
|
||||
),
|
||||
const SizedBox(width: Space.xxs),
|
||||
Flexible(
|
||||
child: Text(
|
||||
text,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: context.texts.labelMedium,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import '../../../../core/design/tripz_colors.dart';
|
||||
import '../../data/models/geo_point.dart';
|
||||
|
||||
import '../../data/models/route_info.dart';
|
||||
import 'map_label.dart';
|
||||
|
||||
/// الخريطة — **الطبقة الوحيدة التي تعرف `intaleq_maps`**. ما فوقها يتعامل
|
||||
/// مع `GeoPoint` وحده، فتبديل محرّك الخريطة لاحقاً لا يلمس منطقاً.
|
||||
@@ -25,6 +26,8 @@ class RideMap extends StatefulWidget {
|
||||
this.cameraTarget,
|
||||
this.onCameraIdle,
|
||||
this.bottomInset = 280,
|
||||
this.originLabel = '',
|
||||
this.destinationLabel = '',
|
||||
});
|
||||
|
||||
final GeoPoint? origin;
|
||||
@@ -39,6 +42,10 @@ class RideMap extends StatefulWidget {
|
||||
/// ارتفاع ما تغطّيه الورقة السفلية — يُحسب منه إطار المسار.
|
||||
final double bottomInset;
|
||||
|
||||
/// أسماء النقطتين — تُرسم بطاقاتها فوق الخريطة (نمط سيرو).
|
||||
final String originLabel;
|
||||
final String destinationLabel;
|
||||
|
||||
@override
|
||||
State<RideMap> createState() => _RideMapState();
|
||||
}
|
||||
@@ -46,12 +53,14 @@ class RideMap extends StatefulWidget {
|
||||
class _RideMapState extends State<RideMap> {
|
||||
im.IntaleqMapController? _controller;
|
||||
im.LatLng? _center;
|
||||
bool _isStyleLoaded = false;
|
||||
|
||||
static const _fallback = im.LatLng(31.9539, 35.9106); // عمّان
|
||||
|
||||
@override
|
||||
void didUpdateWidget(RideMap old) {
|
||||
super.didUpdateWidget(old);
|
||||
if (!_isStyleLoaded) return;
|
||||
if (widget.route != null && widget.route != old.route) {
|
||||
_fitRoute();
|
||||
return;
|
||||
@@ -110,12 +119,53 @@ class _RideMapState extends State<RideMap> {
|
||||
);
|
||||
}
|
||||
|
||||
/// موضع النقطتين على الشاشة — يُحدَّث عند استقرار الكاميرا كي تتبع
|
||||
/// البطاقاتُ الخريطةَ بلا حساب في كل إطار.
|
||||
Offset? _originPx;
|
||||
Offset? _destPx;
|
||||
|
||||
Future<void> _syncLabelPositions() async {
|
||||
final controller = _controller;
|
||||
if (controller == null) return;
|
||||
final origin = widget.origin;
|
||||
final dest = widget.destination;
|
||||
try {
|
||||
final o = origin == null
|
||||
? null
|
||||
: await controller
|
||||
.getScreenCoordinate(im.LatLng(origin.lat, origin.lng));
|
||||
final d = dest == null
|
||||
? null
|
||||
: await controller.getScreenCoordinate(im.LatLng(dest.lat, dest.lng));
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_originPx = o == null ? null : Offset(o.x.toDouble(), o.y.toDouble());
|
||||
_destPx = d == null ? null : Offset(d.x.toDouble(), d.y.toDouble());
|
||||
});
|
||||
} catch (_) {
|
||||
// الخريطة قد تكون بين حالتين — البطاقات تُخفى بدل أن تُرسم في مكان خطأ.
|
||||
if (mounted) setState(() => _originPx = _destPx = null);
|
||||
}
|
||||
}
|
||||
|
||||
/// بطاقة اسم فوق نقطة، مرفوعة عن الدائرة كي لا تغطّيها.
|
||||
Widget _label(Offset? px, String text, Color color) {
|
||||
if (px == null || text.isEmpty) return const SizedBox.shrink();
|
||||
return Positioned(
|
||||
left: px.dx - 100,
|
||||
top: px.dy - 46,
|
||||
width: 200,
|
||||
child: Center(child: MapLabel(text: text, color: color)),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = context.tripzColors;
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
|
||||
return im.IntaleqMap(
|
||||
return Stack(children: [
|
||||
im.IntaleqMap(
|
||||
apiKey: AppConfig.mapApiKey,
|
||||
initialCameraPosition: im.CameraPosition(
|
||||
target: widget.origin == null
|
||||
@@ -132,32 +182,51 @@ class _RideMapState extends State<RideMap> {
|
||||
compassEnabled: false,
|
||||
zoomControlsEnabled: false,
|
||||
onMapCreated: _onCreated,
|
||||
onStyleLoaded: () {
|
||||
if (mounted && !_isStyleLoaded) {
|
||||
setState(() => _isStyleLoaded = true);
|
||||
}
|
||||
},
|
||||
onCameraMove: (position) => _center = position.target,
|
||||
onCameraIdle: () {
|
||||
final c = _center;
|
||||
if (c != null) widget.onCameraIdle?.call(GeoPoint(c.latitude, c.longitude));
|
||||
if (c != null) {
|
||||
widget.onCameraIdle?.call(GeoPoint(c.latitude, c.longitude));
|
||||
}
|
||||
_syncLabelPositions();
|
||||
},
|
||||
// العلامات دوائر ملوّنة تطابق ألوان الخط الزمني في الورقة السفلية،
|
||||
// فيربط المستخدم بين «من» و«إلى» وما يراه على الخريطة بلا شرح.
|
||||
circles: {
|
||||
if (widget.origin != null)
|
||||
_dot('origin', widget.origin!, colors.mapOrigin),
|
||||
if (widget.destination != null)
|
||||
_dot('destination', widget.destination!, colors.mapDestination),
|
||||
},
|
||||
markers: {
|
||||
if (widget.driver != null) _marker('driver', widget.driver!),
|
||||
},
|
||||
polylines: {
|
||||
if (widget.route != null && widget.route!.encodedPoints.isNotEmpty)
|
||||
im.Polyline(
|
||||
polylineId: const im.PolylineId('route'),
|
||||
points: im.PolylineUtils.decode(widget.route!.encodedPoints),
|
||||
color: colors.mapRoute,
|
||||
width: 5,
|
||||
),
|
||||
},
|
||||
);
|
||||
circles: _isStyleLoaded
|
||||
? {
|
||||
if (widget.origin != null)
|
||||
_dot('origin', widget.origin!, colors.mapOrigin),
|
||||
if (widget.destination != null)
|
||||
_dot('destination', widget.destination!, colors.mapDestination),
|
||||
}
|
||||
: const {},
|
||||
markers: _isStyleLoaded
|
||||
? {
|
||||
if (widget.driver != null) _marker('driver', widget.driver!),
|
||||
}
|
||||
: const {},
|
||||
polylines: _isStyleLoaded
|
||||
? {
|
||||
if (widget.route != null && widget.route!.encodedPoints.isNotEmpty)
|
||||
im.Polyline(
|
||||
polylineId: const im.PolylineId('route'),
|
||||
points: im.PolylineUtils.decode(widget.route!.encodedPoints),
|
||||
color: colors.mapRoute,
|
||||
width: 5,
|
||||
),
|
||||
}
|
||||
: const {},
|
||||
),
|
||||
// أسماء النقطتين فوق الخريطة (نمط سيرو) — طبقة فلاتر لا marker، كي
|
||||
// نرث الخط والاتجاه والثيم.
|
||||
_label(_originPx, widget.originLabel, colors.mapOrigin),
|
||||
_label(_destPx, widget.destinationLabel, colors.mapDestination),
|
||||
]);
|
||||
}
|
||||
|
||||
im.Marker _marker(String id, GeoPoint p) => im.Marker(
|
||||
|
||||
@@ -28,16 +28,30 @@ class WalletCubit extends Cubit<WalletState> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> topup(num amount) async {
|
||||
/// شحن حقيقي. **لا يزيد الرصيد فوراً** إلا في نمط الدفع الفوري — الفاتورة
|
||||
/// تُعرض للمستخدم ويحوّل، والتسوية تصل لاحقاً عبر مطابقة رسالة المزوّد.
|
||||
Future<void> topup({required num amount, required String provider}) async {
|
||||
if (amount <= 0) return;
|
||||
emit(state.copyWith(action: WalletAction.toppingUp));
|
||||
try {
|
||||
await _repo.topup(amount);
|
||||
final result = await _repo.charge(
|
||||
amount: amount,
|
||||
provider: provider,
|
||||
currency: state.currency,
|
||||
);
|
||||
if (isClosed) return;
|
||||
emit(state.copyWith(action: WalletAction.topupDone));
|
||||
// الرصيد يُعاد جلبه من الخادم لا يُحسب محلياً: المال لا يُقدَّر
|
||||
// في التطبيق (docs/23 §0.2).
|
||||
await load();
|
||||
|
||||
if (result.isInstant) {
|
||||
emit(state.copyWith(action: WalletAction.topupDone));
|
||||
// الرصيد يُعاد جلبه من الخادم لا يُحسب محلياً: المال لا يُقدَّر
|
||||
// في التطبيق (docs/23 §0.2).
|
||||
await load();
|
||||
return;
|
||||
}
|
||||
emit(state.copyWith(
|
||||
action: WalletAction.invoiceReady,
|
||||
invoice: result,
|
||||
));
|
||||
} on ApiException {
|
||||
if (!isClosed) emit(state.copyWith(action: WalletAction.topupFailed));
|
||||
}
|
||||
|
||||
@@ -3,8 +3,9 @@ import 'package:equatable/equatable.dart';
|
||||
import '../../../core/ui/view_status.dart';
|
||||
import '../data/models/wallet.dart';
|
||||
import '../data/models/wallet_txn.dart';
|
||||
import '../data/wallet_repository.dart';
|
||||
|
||||
enum WalletAction { none, toppingUp, topupFailed, topupDone }
|
||||
enum WalletAction { none, toppingUp, topupFailed, topupDone, invoiceReady }
|
||||
|
||||
class WalletState extends Equatable {
|
||||
const WalletState({
|
||||
@@ -12,6 +13,7 @@ class WalletState extends Equatable {
|
||||
this.wallet,
|
||||
this.transactions = const [],
|
||||
this.action = WalletAction.none,
|
||||
this.invoice,
|
||||
this.error,
|
||||
});
|
||||
|
||||
@@ -23,6 +25,9 @@ class WalletState extends Equatable {
|
||||
/// المعروض خلفه.
|
||||
final WalletAction action;
|
||||
|
||||
/// فاتورة تحويل بانتظار الدفع — تُعرض للمستخدم بمرجعها وحساب الاستلام.
|
||||
final TopupResult? invoice;
|
||||
|
||||
final String? error;
|
||||
|
||||
String get currency => wallet?.currency ?? '';
|
||||
@@ -32,6 +37,7 @@ class WalletState extends Equatable {
|
||||
Wallet? wallet,
|
||||
List<WalletTxn>? transactions,
|
||||
WalletAction? action,
|
||||
TopupResult? invoice,
|
||||
String? error,
|
||||
}) {
|
||||
return WalletState(
|
||||
@@ -39,10 +45,12 @@ class WalletState extends Equatable {
|
||||
wallet: wallet ?? this.wallet,
|
||||
transactions: transactions ?? this.transactions,
|
||||
action: action ?? this.action,
|
||||
invoice: invoice ?? this.invoice,
|
||||
error: error ?? this.error,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [status, wallet, transactions, action, error];
|
||||
List<Object?> get props =>
|
||||
[status, wallet, transactions, action, invoice?.reference, error];
|
||||
}
|
||||
|
||||
@@ -2,6 +2,33 @@ import '../../../core/api/api_client.dart';
|
||||
import 'models/wallet.dart';
|
||||
import 'models/wallet_txn.dart';
|
||||
|
||||
/// نتيجة الشحن — ثلاثة أنماط: فوري · فاتورة · إعادة توجيه.
|
||||
class TopupResult {
|
||||
const TopupResult({
|
||||
required this.status,
|
||||
this.reference,
|
||||
this.transferTarget,
|
||||
this.instructions,
|
||||
this.redirectUrl,
|
||||
});
|
||||
|
||||
final String status;
|
||||
|
||||
/// مرجع الفاتورة الذي يذكره المستخدم عند التحويل — به تُطابَق رسالة
|
||||
/// المزوّد لاحقاً.
|
||||
final String? reference;
|
||||
|
||||
/// حساب/رقم استلام المستأجر عند هذا المزوّد.
|
||||
final String? transferTarget;
|
||||
|
||||
final String? instructions;
|
||||
final String? redirectUrl;
|
||||
|
||||
bool get isInvoice => reference != null;
|
||||
bool get isInstant => status == 'success';
|
||||
bool get isRedirect => redirectUrl != null;
|
||||
}
|
||||
|
||||
class WalletRepository {
|
||||
WalletRepository(this._api);
|
||||
|
||||
@@ -20,8 +47,35 @@ class WalletRepository {
|
||||
.toList(growable: false);
|
||||
}
|
||||
|
||||
Future<void> topup(num amount) =>
|
||||
_api.post<Map<String, dynamic>>('/wallet/topup', body: {'amount': amount});
|
||||
/// شحن حقيقي عبر `POST /payments/charge`.
|
||||
///
|
||||
/// **لا يزيد الرصيد فوراً.** كليك وشام كاش وزين كاش تعمل بنمط الفاتورة:
|
||||
/// الخادم يولّد مرجعاً ويعرض حساب الاستلام، ثم يحوّل المستخدم، والتسوية
|
||||
/// تصل لاحقاً عبر مطابقة رسالة المزوّد. هذا **نفس مسار سيرو** حرفياً.
|
||||
/// PayMob وحده يرجّع رابط إعادة توجيه، و`cash` وحده فوري.
|
||||
Future<TopupResult> charge({
|
||||
required num amount,
|
||||
required String provider,
|
||||
required String currency,
|
||||
}) async {
|
||||
final res = await _api.post<Map<String, dynamic>>(
|
||||
'/payments/charge',
|
||||
body: {
|
||||
'amount': amount,
|
||||
'provider': provider,
|
||||
'purpose': 'topup',
|
||||
'currency': currency,
|
||||
},
|
||||
);
|
||||
final payment = res['payment'] as Map<String, dynamic>?;
|
||||
return TopupResult(
|
||||
status: payment?['status'] as String? ?? 'pending',
|
||||
reference: res['reference'] as String?,
|
||||
transferTarget: res['transferTarget'] as String?,
|
||||
instructions: res['instructions'] as String?,
|
||||
redirectUrl: res['redirectUrl'] as String?,
|
||||
);
|
||||
}
|
||||
|
||||
// ── السحب: خطوتان لا خطوة ────────────────────────────────────────────
|
||||
// `request` يرسل رمزاً **بلا خصم**، و`confirm` هو ما يخصم ويحجز
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../../../../core/design/tokens.dart';
|
||||
import '../../../../core/design/tripz_colors.dart';
|
||||
import '../../../../core/design/typography.dart';
|
||||
import '../../../../core/l10n/l10n.dart';
|
||||
import '../../../../core/ui/status_banner.dart';
|
||||
import '../../data/wallet_repository.dart';
|
||||
|
||||
/// فاتورة التحويل — نمط سيرو حرفياً (`create_cliq_invoice.php`).
|
||||
///
|
||||
/// المستخدم يحوّل بنفسه إلى حساب المشغّل ويذكر المرجع، والتسوية تصل لاحقاً
|
||||
/// بمطابقة رسالة المزوّد. **الرصيد لا يزيد الآن** — وهذا يُقال صراحةً بدل
|
||||
/// أن ينتظر المستخدم رقماً لن يتغيّر.
|
||||
class InvoiceSheet extends StatelessWidget {
|
||||
const InvoiceSheet({super.key, required this.invoice});
|
||||
|
||||
final TopupResult invoice;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = context.l10n;
|
||||
final target = invoice.transferTarget;
|
||||
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(l10n.walletInvoiceTitle, style: context.texts.titleLarge),
|
||||
const SizedBox(height: Space.md),
|
||||
|
||||
// حساب الاستلام قد لا يكون مضبوطاً للمستأجر — يُقال بوضوح بدل تعليمات
|
||||
// ناقصة تُرسل المال إلى لا مكان.
|
||||
if (target == null || target.isEmpty)
|
||||
StatusBanner(message: l10n.walletNoTarget, tone: BannerTone.danger)
|
||||
else
|
||||
_CopyRow(label: l10n.walletInvoiceTarget, value: target),
|
||||
|
||||
const SizedBox(height: Space.sm),
|
||||
if (invoice.reference != null)
|
||||
_CopyRow(label: l10n.walletInvoiceRef, value: invoice.reference!),
|
||||
|
||||
const SizedBox(height: Space.md),
|
||||
StatusBanner(
|
||||
message: l10n.walletInvoicePending,
|
||||
tone: BannerTone.info,
|
||||
icon: Icons.schedule_rounded,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// قيمة مع زرّ نسخ — الرقم يُحوَّل يدوياً في تطبيق بنك آخر، فالنسخ ليس رفاهية.
|
||||
class _CopyRow extends StatelessWidget {
|
||||
const _CopyRow({required this.label, required this.value});
|
||||
|
||||
final String label;
|
||||
final String value;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: Space.page,
|
||||
decoration: BoxDecoration(
|
||||
color: context.colors.surfaceContainerHighest,
|
||||
borderRadius: Radii.card_,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: context.texts.labelSmall?.copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: Space.xxs),
|
||||
SelectableText(
|
||||
value,
|
||||
textDirection: TextDirection.ltr,
|
||||
style: numericStyle(context.texts.titleMedium),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.copy_rounded),
|
||||
tooltip: context.l10n.walletCopy,
|
||||
onPressed: () {
|
||||
Clipboard.setData(ClipboardData(text: value));
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(context.l10n.walletCopied)),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -877,6 +877,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.6.0"
|
||||
share_plus:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: share_plus
|
||||
sha256: "223873d106614442ea6f20db5a038685cc5b32a2fba81cdecaefbbae0523f7fa"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "12.0.2"
|
||||
share_plus_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: share_plus_platform_interface
|
||||
sha256: "88023e53a13429bd65d8e85e11a9b484f49d4c190abbd96c7932b74d6927cc9a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.0"
|
||||
shared_preferences:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -1010,6 +1026,70 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
url_launcher:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: url_launcher
|
||||
sha256: f6a7e5c4835bb4e3026a04793a4199ca2d14c739ec378fdfe23fc8075d0439f8
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.2"
|
||||
url_launcher_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_android
|
||||
sha256: "17bc677f0b301615530dd1d67e0a9828cafa2d0b6b6eae4cd3679b7eac4a273c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.30"
|
||||
url_launcher_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_ios
|
||||
sha256: "580fe5dfb51671ae38191d316e027f6b76272b026370708c2d898799750a02b0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.4.1"
|
||||
url_launcher_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_linux
|
||||
sha256: d5e14138b3bc193a0f63c10a53c94b91d399df0512b1f29b94a043db7482384a
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.2"
|
||||
url_launcher_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_macos
|
||||
sha256: "368adf46f71ad3c21b8f06614adb38346f193f3a59ba8fe9a2fd74133070ba18"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.5"
|
||||
url_launcher_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_platform_interface
|
||||
sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.2"
|
||||
url_launcher_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_web
|
||||
sha256: "85c81589622fbc87c1c683aaea164d3604a7777495a79d91e39ffcdec39ddb34"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.3"
|
||||
url_launcher_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_windows
|
||||
sha256: "712c70ab1b99744ff066053cbe3e80c73332b38d46e5e945c98689b2e66fc15f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.5"
|
||||
uuid:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -36,6 +36,10 @@ dependencies:
|
||||
geolocator: ^14.0.2
|
||||
socket_io_client: ^3.0.2
|
||||
|
||||
# الدراور: المشاركة وفتح الروابط
|
||||
share_plus: ^12.0.1
|
||||
url_launcher: ^6.3.2
|
||||
|
||||
# م6: الإشعارات — الإعداد الأصلي (google-services) منقول مع الطبقة الأصلية
|
||||
firebase_core: ^4.4.0
|
||||
firebase_messaging: ^16.1.1
|
||||
|
||||
@@ -45,6 +45,11 @@ EXTRA = {
|
||||
"phoneTitle": "أهلاً بك، كابتن",
|
||||
"profileLead": "اسمك يظهر للراكب عند الرحلة.",
|
||||
"historyEmpty": "لا رحلات بعد — اتصل لتصلك الطلبات",
|
||||
"rewardsInviteTitle": "ادعُ سائقاً",
|
||||
"rewardsInviteLead": "شارك كودك — تربح عن كل سائق ينضم",
|
||||
"menuInvite": "ادعُ سائقاً",
|
||||
"menuDriverApp": "تطبيق الراكب",
|
||||
"shareMessage": "انضم لـTripz كسائق — استعمل كودي {code}",
|
||||
},
|
||||
'en': {
|
||||
"obApplyTitle": "Register as a driver",
|
||||
@@ -81,6 +86,11 @@ EXTRA = {
|
||||
"phoneTitle": "Welcome, captain",
|
||||
"profileLead": "Your name is shown to the rider during a trip.",
|
||||
"historyEmpty": "No trips yet — go online to receive requests",
|
||||
"rewardsInviteTitle": "Invite a driver",
|
||||
"rewardsInviteLead": "Share your code — earn for every driver who joins",
|
||||
"menuInvite": "Invite a driver",
|
||||
"menuDriverApp": "Rider app",
|
||||
"shareMessage": "Join Tripz as a driver — use my code {code}",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -12,11 +12,9 @@ cd "$(dirname "$0")/.."
|
||||
# ملفات يملكها السائق ولا تُنسخ من الراكب أبداً
|
||||
OWN=(
|
||||
"core/config.dart" # appRole = driver
|
||||
"core/build_config.dart" # اسم التطبيق (الألوان تُحدَّث يدوياً معاً)
|
||||
"core/build_config.dart" # اسم التطبيق + روابط الطرف الآخر
|
||||
"core/di.dart" # DutyCubit + OnboardingCubit + PayoutCubit
|
||||
"core/router.dart" # DutyPage + EarningsPage + بوابة التسجيل
|
||||
"core/l10n/app_ar.arb"
|
||||
"core/l10n/app_en.arb"
|
||||
"core/l10n/gen"
|
||||
"features/onboarding" # تسجيل السائق — لا مقابل له عند الراكب
|
||||
"features/trip/cubit/duty_cubit.dart"
|
||||
@@ -51,6 +49,8 @@ for p in "${OWN[@]}" "${RIDER_ONLY[@]}"; do args+=(--exclude "$p"); done
|
||||
|
||||
rsync -a "${args[@]}" ../rider_new/lib/ lib/
|
||||
|
||||
# نصوص السائق تُعاد بعد كل مزامنة (ملفا ARB مستثنيان لكن قد يتغيّر المشترك)
|
||||
# ملفّا ARB **يُنسخان** من الراكب كي تصل المفاتيح المشتركة الجديدة، ثم
|
||||
# يُعاد فرض نصوص السائق فوقهما. استثناؤهما من النسخ كان يُسقط كل مفتاح
|
||||
# مشترك جديد ويكسر البناء — تكرّر ثلاث مرات قبل هذا التصحيح.
|
||||
python3 tool/driver_l10n_extra.py
|
||||
echo "✅ تمّت المزامنة — شغّل: flutter gen-l10n && flutter analyze"
|
||||
|
||||
@@ -22,6 +22,28 @@ class BuildConfig {
|
||||
|
||||
static const String logoAsset = 'assets/images/logo.png';
|
||||
static const String splashLogoAsset = 'assets/images/splash_logo.png';
|
||||
|
||||
/// روابط خارجية لكل مستأجر — تُولَّد مع بقية الملف (N3).
|
||||
static const String storeUrl = String.fromEnvironment(
|
||||
'STORE_URL',
|
||||
defaultValue: 'https://tripz.app',
|
||||
);
|
||||
static const String privacyUrl = String.fromEnvironment(
|
||||
'PRIVACY_URL',
|
||||
defaultValue: 'https://tripz.app/privacy',
|
||||
);
|
||||
|
||||
/// رقم دعم واتساب المستأجر — بصيغة دولية بلا `+`.
|
||||
static const String supportPhone = String.fromEnvironment(
|
||||
'SUPPORT_PHONE',
|
||||
defaultValue: '962790000000',
|
||||
);
|
||||
|
||||
/// رابط تطبيق الطرف الآخر — الراكب يدعو نفسه ليصير سائقاً والعكس.
|
||||
static const String driverAppUrl = String.fromEnvironment(
|
||||
'DRIVER_APP_URL',
|
||||
defaultValue: 'https://tripz.app/driver',
|
||||
);
|
||||
}
|
||||
|
||||
/// أعلام الاستحقاقات (docs/23 §5). **`const` إجبارياً** كي يُحذف كود الميزة
|
||||
|
||||
@@ -11,6 +11,8 @@ import '../features/chat/data/chat_repository.dart';
|
||||
import '../features/profile/data/profile_repository.dart';
|
||||
import '../features/rating/cubit/rating_cubit.dart';
|
||||
import '../features/rating/data/rating_repository.dart';
|
||||
import '../features/rewards/cubit/rewards_cubit.dart';
|
||||
import '../features/rewards/data/rewards_repository.dart';
|
||||
import '../features/settings/cubit/settings_cubit.dart';
|
||||
import '../features/trip/cubit/history_cubit.dart';
|
||||
import '../features/trip/cubit/ride_cubit.dart';
|
||||
@@ -83,6 +85,12 @@ Future<void> setupInjector() async {
|
||||
sl.registerFactory<HistoryCubit>(() => HistoryCubit(sl()));
|
||||
|
||||
sl.registerSingleton<RatingRepository>(RatingRepository(sl()));
|
||||
|
||||
// المكافآت خلف علم الكوبونات: الدعوات والكوبونات وجهان لنفس الوحدة.
|
||||
if (Features.coupons) {
|
||||
sl.registerSingleton<RewardsRepository>(RewardsRepository(sl()));
|
||||
sl.registerFactory<RewardsCubit>(() => RewardsCubit(sl()));
|
||||
}
|
||||
sl.registerFactory<RatingCubit>(() => RatingCubit(sl()));
|
||||
|
||||
// الدردشة خلف علمها: إطفاؤه يحذف كودها من الـbinary (docs/23 §5).
|
||||
|
||||
@@ -200,6 +200,48 @@
|
||||
"rideFrom": "من",
|
||||
"rideTo": "إلى",
|
||||
"walletChannel": "طريقة الدفع",
|
||||
"walletTopupNote": "الشحن التجريبي حالياً بلا تحصيل فعلي — ربط البوابة قادم",
|
||||
"rideTypeUnavailable": "غير متاح"
|
||||
"rideTypeUnavailable": "غير متاح",
|
||||
"rideSearchNoResults": "لا نتائج — جرّب اسماً آخر أو حدّد من الخريطة",
|
||||
"walletInvoiceTitle": "أكمل التحويل",
|
||||
"walletInvoiceRef": "رقم المرجع",
|
||||
"walletInvoiceTarget": "حوّل إلى",
|
||||
"walletInvoicePending": "سيُضاف الرصيد فور تأكيد التحويل",
|
||||
"walletCopy": "نسخ",
|
||||
"walletCopied": "نُسخ",
|
||||
"walletNoTarget": "لم يُضبط حساب استلام لهذه القناة بعد — راجع المشغّل",
|
||||
"rewardsTitle": "مكافآتي",
|
||||
"rewardsInviteTitle": "ادعُ صديقاً",
|
||||
"rewardsInviteLead": "شارك كودك — تربح أنت وصديقك",
|
||||
"rewardsCode": "كود الدعوة",
|
||||
"rewardsInvited": "دعوتَهم",
|
||||
"rewardsPending": "قيد التأكيد",
|
||||
"rewardsPaid": "مكافآت مدفوعة",
|
||||
"rewardsCoupons": "كوبوناتي",
|
||||
"rewardsCouponsEmpty": "لا كوبونات صالحة الآن",
|
||||
"menuRewards": "مكافآتي",
|
||||
"menuInvite": "ادعُ صديقاً",
|
||||
"menuShare": "شارك التطبيق",
|
||||
"menuNotifications": "الإشعارات",
|
||||
"menuPrivacy": "سياسة الخصوصية",
|
||||
"menuRateApp": "قيّم التطبيق",
|
||||
"shareMessage": "جرّب تطبيق Tripz — استعمل كودي {code} واحصل على خصم أول رحلة",
|
||||
"menuDriverApp": "سجّل كسائق",
|
||||
"@shareMessage": {
|
||||
"placeholders": {
|
||||
"code": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"supportFaqQ1": "كيف أطلب رحلة؟",
|
||||
"supportFaqA1": "حدّد وجهتك من البحث أو من الخريطة، اختر نوع الرحلة، ثم اضغط «اطلب الرحلة».",
|
||||
"supportFaqQ2": "كيف أشحن رصيدي؟",
|
||||
"supportFaqA2": "من المحفظة اختر المبلغ وطريقة الدفع. ستظهر لك تعليمات التحويل ورقم مرجع — يُضاف الرصيد بعد تأكيد التحويل.",
|
||||
"supportFaqQ3": "لماذا لا يظهر سائق؟",
|
||||
"supportFaqA3": "قد لا يوجد سائقون قريبون في هذا الوقت. جرّب بعد قليل أو غيّر نوع الرحلة.",
|
||||
"supportFaqQ4": "كيف ألغي رحلة؟",
|
||||
"supportFaqA4": "من بطاقة الرحلة اضغط «إلغاء الرحلة». الإلغاء بعد وصول السائق قد يترتّب عليه رسم.",
|
||||
"supportDeviceCheck": "فحص توافق الجهاز",
|
||||
"supportDeviceOk": "جهازك متوافق",
|
||||
"supportDeviceIssues": "مشاكل قد تؤثّر على عمل التطبيق"
|
||||
}
|
||||
@@ -200,6 +200,48 @@
|
||||
"rideFrom": "From",
|
||||
"rideTo": "To",
|
||||
"walletChannel": "Payment method",
|
||||
"walletTopupNote": "Top-up is currently a test cash-in with no real charge — gateway wiring is next",
|
||||
"rideTypeUnavailable": "Unavailable"
|
||||
"rideTypeUnavailable": "Unavailable",
|
||||
"rideSearchNoResults": "No results — try another name or pick on the map",
|
||||
"walletInvoiceTitle": "Complete the transfer",
|
||||
"walletInvoiceRef": "Reference",
|
||||
"walletInvoiceTarget": "Transfer to",
|
||||
"walletInvoicePending": "Your balance updates once the transfer is confirmed",
|
||||
"walletCopy": "Copy",
|
||||
"walletCopied": "Copied",
|
||||
"walletNoTarget": "No receiving account is configured for this channel yet — contact the operator",
|
||||
"rewardsTitle": "My rewards",
|
||||
"rewardsInviteTitle": "Invite a friend",
|
||||
"rewardsInviteLead": "Share your code — you both earn",
|
||||
"rewardsCode": "Invite code",
|
||||
"rewardsInvited": "Invited",
|
||||
"rewardsPending": "Pending",
|
||||
"rewardsPaid": "Rewards paid",
|
||||
"rewardsCoupons": "My coupons",
|
||||
"rewardsCouponsEmpty": "No valid coupons right now",
|
||||
"menuRewards": "My rewards",
|
||||
"menuInvite": "Invite a friend",
|
||||
"menuShare": "Share the app",
|
||||
"menuNotifications": "Notifications",
|
||||
"menuPrivacy": "Privacy policy",
|
||||
"menuRateApp": "Rate the app",
|
||||
"shareMessage": "Try Tripz — use my code {code} for a discount on your first ride",
|
||||
"menuDriverApp": "Become a driver",
|
||||
"@shareMessage": {
|
||||
"placeholders": {
|
||||
"code": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"supportFaqQ1": "How do I request a ride?",
|
||||
"supportFaqA1": "Pick your destination from search or the map, choose a ride type, then tap “Request ride”.",
|
||||
"supportFaqQ2": "How do I top up?",
|
||||
"supportFaqA2": "In the wallet, choose an amount and a payment method. You'll get transfer instructions and a reference — your balance updates once the transfer is confirmed.",
|
||||
"supportFaqQ3": "Why is no driver showing up?",
|
||||
"supportFaqA3": "There may be no drivers nearby right now. Try again shortly or change the ride type.",
|
||||
"supportFaqQ4": "How do I cancel?",
|
||||
"supportFaqA4": "Tap “Cancel ride” on the trip card. Cancelling after the driver arrives may incur a fee.",
|
||||
"supportDeviceCheck": "Check device compatibility",
|
||||
"supportDeviceOk": "Your device is compatible",
|
||||
"supportDeviceIssues": "Issues that may affect the app"
|
||||
}
|
||||
@@ -4,18 +4,23 @@
|
||||
/// المستأجر هو من يحدّد السوق: مشغّل أردني يخدم مستخدماً هاتفه إنجليزي
|
||||
/// وموقعه خارج الأردن يبقى أردنيّ القنوات.
|
||||
///
|
||||
/// ⚠️ **`POST /wallet/topup` شحنٌ تجريبي بلا مزوّد دفع خلفه** — الخادم نفسه
|
||||
/// يصفه بـ«كاش-إن، للإنتاج يُربط بمزوّد دفع أو يُقيَّد للأدمن». اختيار
|
||||
/// القناة هنا يجهّز الواجهة والعقد؛ التحصيل الفعلي عبر `/payments/charge`
|
||||
/// وبوابة كل قناة عملٌ منفصل لم يُنفَّذ بعد.
|
||||
/// الشحن يمرّ بـ**`POST /payments/charge`** لا `POST /wallet/topup` — الأخير
|
||||
/// كاش-إن تجريبي يزيد الرصيد بلا دفع.
|
||||
///
|
||||
/// كليك وشام كاش وزين كاش تعمل بنمط **الفاتورة**: الخادم يولّد مرجعاً ويعرض
|
||||
/// حساب الاستلام، والمستخدم يحوّل، والتسوية تصل لاحقاً عبر مطابقة رسالة
|
||||
/// المزوّد (SMS) — وهو **نفس ما يفعله سيرو** حرفياً
|
||||
/// (`create_cliq_invoice.php`). لا بوابة تحويل حيّة لأيٍّ منها.
|
||||
/// PayMob وحده يعمل بإعادة توجيه فعلية.
|
||||
enum PaymentChannel {
|
||||
// ⚠️ `wire` يجب أن يطابق اسم المحوّل في `PaymentGatewayRegistry` حرفياً —
|
||||
// أي اسم آخر يرجّع 400 `unsupported provider`.
|
||||
cliq('cliq', 'CliQ', 'كليك'),
|
||||
syriatel('syriatel_cash', 'Syriatel Cash', 'سيرياتيل كاش'),
|
||||
mtn('mtn_cash', 'MTN Cash', 'إم تي إن كاش'),
|
||||
shamCash('sham_cash', 'Sham Cash', 'شام كاش'),
|
||||
syriatel('syriatel', 'Syriatel Cash', 'سيرياتيل كاش'),
|
||||
mtn('mtn', 'MTN Cash', 'إم تي إن كاش'),
|
||||
shamCash('shamcash', 'Sham Cash', 'شام كاش'),
|
||||
zainCash('zaincash', 'ZainCash', 'زين كاش'),
|
||||
paymob('paymob', 'PayMob', 'باي موب'),
|
||||
zainCash('zain_cash', 'ZainCash', 'زين كاش'),
|
||||
qiCard('qi_card', 'Qi Card', 'كي كارد'),
|
||||
cash('cash', 'Cash', 'نقداً');
|
||||
|
||||
const PaymentChannel(this.wire, this.nameEn, this.nameAr);
|
||||
@@ -43,11 +48,7 @@ enum PaymentChannel {
|
||||
// العراق: المحافظ الأشيع محلياً. ⚠️ الباك إند لا يعرف حزمة `iq` بعد
|
||||
// (`default-tariffs.ts` فيه jo/sy/eg فقط) — مستأجر عراقي يُزوَّد بلا
|
||||
// تعرفة، وهذا شغل خادم يسبق أي إطلاق عراقي.
|
||||
'iq' => const [
|
||||
PaymentChannel.zainCash,
|
||||
PaymentChannel.qiCard,
|
||||
PaymentChannel.cash,
|
||||
],
|
||||
'iq' => const [PaymentChannel.zainCash, PaymentChannel.cash],
|
||||
// حزمة غير معروفة: النقد وحده — لا نعرض قناة قد لا تعمل في سوقها.
|
||||
_ => const [PaymentChannel.cash],
|
||||
};
|
||||
|
||||
@@ -8,6 +8,7 @@ import '../features/chat/view/chat_page.dart';
|
||||
import '../features/profile/view/profile_edit_page.dart';
|
||||
import '../features/profile/view/profile_setup_page.dart';
|
||||
import '../features/rating/data/rating_repository.dart';
|
||||
import '../features/rewards/view/rewards_page.dart';
|
||||
import '../features/rating/view/rating_page.dart';
|
||||
import '../features/settings/view/settings_page.dart';
|
||||
import '../features/splash/view/splash_page.dart';
|
||||
@@ -31,6 +32,7 @@ class Routes {
|
||||
static const profileEdit = '/account';
|
||||
static const settings = '/settings';
|
||||
static const support = '/support';
|
||||
static const rewards = '/rewards';
|
||||
static const chat = '/chat';
|
||||
}
|
||||
|
||||
@@ -110,6 +112,10 @@ final appRouter = GoRouter(
|
||||
builder: (context, state) =>
|
||||
ChatPage(tripId: state.uri.queryParameters['trip'] ?? ''),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.rewards,
|
||||
builder: (context, state) => const RewardsPage(),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.support,
|
||||
builder: (context, state) => const SupportPage(),
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../build_config.dart';
|
||||
import '../config.dart';
|
||||
@@ -52,6 +54,13 @@ class AppDrawer extends StatelessWidget {
|
||||
label: isDriver ? l10n.menuEarnings : l10n.menuWallet,
|
||||
route: Routes.wallet,
|
||||
),
|
||||
if (Features.coupons && context.tenantHas('coupons'))
|
||||
_Item(
|
||||
icon: Icons.card_giftcard_rounded,
|
||||
label: l10n.menuRewards,
|
||||
route: Routes.rewards,
|
||||
),
|
||||
const Divider(indent: Space.md, endIndent: Space.md),
|
||||
_Item(
|
||||
icon: Icons.settings_outlined,
|
||||
label: l10n.menuSettings,
|
||||
@@ -62,6 +71,29 @@ class AppDrawer extends StatelessWidget {
|
||||
label: l10n.menuSupport,
|
||||
route: Routes.support,
|
||||
),
|
||||
// مداخل محليّة بلا نقطة خادم — تُنفَّذ في الجهاز مباشرة.
|
||||
_Action(
|
||||
icon: Icons.share_outlined,
|
||||
label: l10n.menuShare,
|
||||
onTap: () => SharePlus.instance
|
||||
.share(ShareParams(text: l10n.shareMessage(''))),
|
||||
),
|
||||
_Action(
|
||||
icon: Icons.star_outline_rounded,
|
||||
label: l10n.menuRateApp,
|
||||
onTap: () => _open(BuildConfig.storeUrl),
|
||||
),
|
||||
_Action(
|
||||
icon: Icons.shield_outlined,
|
||||
label: l10n.menuPrivacy,
|
||||
onTap: () => _open(BuildConfig.privacyUrl),
|
||||
),
|
||||
if (!isDriver)
|
||||
_Action(
|
||||
icon: Icons.local_taxi_outlined,
|
||||
label: l10n.menuDriverApp,
|
||||
onTap: () => _open(BuildConfig.driverAppUrl),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -83,6 +115,13 @@ class AppDrawer extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
static Future<void> _open(String url) async {
|
||||
final uri = Uri.tryParse(url);
|
||||
if (uri == null) return;
|
||||
// فشل الفتح لا يُسقط شيئاً — رابط خارجي ليس جزءاً من التطبيق.
|
||||
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||
}
|
||||
|
||||
Future<void> _confirmLogout(BuildContext context) async {
|
||||
final l10n = context.l10n;
|
||||
final session = context.read<SessionCubit>();
|
||||
@@ -155,6 +194,31 @@ class _Header extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
/// مدخل ينفّذ فعلاً محلياً (مشاركة · رابط خارجي) لا تنقّلاً.
|
||||
class _Action extends StatelessWidget {
|
||||
const _Action({
|
||||
required this.icon,
|
||||
required this.label,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
final IconData icon;
|
||||
final String label;
|
||||
final VoidCallback onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
leading: Icon(icon),
|
||||
title: Text(label),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
onTap();
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _Item extends StatelessWidget {
|
||||
const _Item({required this.icon, required this.label, required this.route});
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../core/api/api_exception.dart';
|
||||
import '../../../core/ui/view_status.dart';
|
||||
import '../data/rewards_repository.dart';
|
||||
|
||||
class RewardsState {
|
||||
const RewardsState({
|
||||
this.status = ViewStatus.idle,
|
||||
this.referrals,
|
||||
this.coupons = const [],
|
||||
this.error,
|
||||
});
|
||||
|
||||
final ViewStatus status;
|
||||
final ReferralSummary? referrals;
|
||||
final List<Coupon> coupons;
|
||||
final String? error;
|
||||
}
|
||||
|
||||
class RewardsCubit extends Cubit<RewardsState> {
|
||||
RewardsCubit(this._repo) : super(const RewardsState());
|
||||
|
||||
final RewardsRepository _repo;
|
||||
|
||||
Future<void> load() async {
|
||||
emit(const RewardsState(status: ViewStatus.loading));
|
||||
try {
|
||||
// النداءان متوازيان: لا سبب لانتظار أحدهما الآخر.
|
||||
final results = await Future.wait([
|
||||
_repo.referrals(),
|
||||
_repo.coupons(),
|
||||
]);
|
||||
if (isClosed) return;
|
||||
emit(RewardsState(
|
||||
status: ViewStatus.success,
|
||||
referrals: results[0] as ReferralSummary,
|
||||
coupons: results[1] as List<Coupon>,
|
||||
));
|
||||
} on ApiException catch (e) {
|
||||
if (!isClosed) {
|
||||
emit(RewardsState(status: ViewStatus.error, error: e.message));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
import '../../../core/api/api_client.dart';
|
||||
|
||||
/// ملخّص الدعوات — شكل مُتحقَّق حيّاً: `{code, total, pending, paid}`.
|
||||
class ReferralSummary {
|
||||
const ReferralSummary({
|
||||
required this.code,
|
||||
required this.total,
|
||||
required this.pending,
|
||||
required this.paid,
|
||||
});
|
||||
|
||||
/// كود دعوتي الذي أشاركه.
|
||||
final String code;
|
||||
|
||||
final int total;
|
||||
final int pending;
|
||||
final int paid;
|
||||
|
||||
factory ReferralSummary.fromJson(Map<String, dynamic> json) =>
|
||||
ReferralSummary(
|
||||
code: json['code'] as String? ?? '',
|
||||
total: (json['total'] as num?)?.toInt() ?? 0,
|
||||
pending: (json['pending'] as num?)?.toInt() ?? 0,
|
||||
paid: (json['paid'] as num?)?.toInt() ?? 0,
|
||||
);
|
||||
}
|
||||
|
||||
class Coupon {
|
||||
const Coupon({
|
||||
required this.code,
|
||||
this.description = '',
|
||||
this.expiresAt,
|
||||
});
|
||||
|
||||
final String code;
|
||||
final String description;
|
||||
final DateTime? expiresAt;
|
||||
|
||||
factory Coupon.fromJson(Map<String, dynamic> json) => Coupon(
|
||||
code: json['code'] as String? ?? '',
|
||||
description: json['description'] as String? ??
|
||||
json['title'] as String? ??
|
||||
'',
|
||||
expiresAt: DateTime.tryParse(json['expires_at']?.toString() ?? ''),
|
||||
);
|
||||
}
|
||||
|
||||
class RewardsRepository {
|
||||
RewardsRepository(this._api);
|
||||
|
||||
final ApiClient _api;
|
||||
|
||||
Future<ReferralSummary> referrals() async {
|
||||
final res = await _api.get<Map<String, dynamic>>('/rewards/referrals');
|
||||
return ReferralSummary.fromJson(res);
|
||||
}
|
||||
|
||||
Future<List<Coupon>> coupons() async {
|
||||
final res = await _api.get<List<dynamic>>('/rewards/coupons');
|
||||
return res
|
||||
.whereType<Map<String, dynamic>>()
|
||||
.map(Coupon.fromJson)
|
||||
.toList(growable: false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
|
||||
import '../../../core/design/tokens.dart';
|
||||
import '../../../core/design/tripz_colors.dart';
|
||||
import '../../../core/design/typography.dart';
|
||||
import '../../../core/di.dart';
|
||||
import '../../../core/l10n/l10n.dart';
|
||||
import '../../../core/ui/tripz_button.dart';
|
||||
import '../../../core/ui/tripz_card.dart';
|
||||
import '../../../core/ui/tripz_scaffold.dart';
|
||||
import '../cubit/rewards_cubit.dart';
|
||||
|
||||
/// «مكافآتي» — الدعوات والكوبونات في شاشة واحدة (نمط سيرو: Promos + Invite).
|
||||
class RewardsPage extends StatefulWidget {
|
||||
const RewardsPage({super.key});
|
||||
|
||||
@override
|
||||
State<RewardsPage> createState() => _RewardsPageState();
|
||||
}
|
||||
|
||||
class _RewardsPageState extends State<RewardsPage> {
|
||||
late final RewardsCubit _cubit = sl<RewardsCubit>()..load();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_cubit.close();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = context.l10n;
|
||||
return BlocProvider.value(
|
||||
value: _cubit,
|
||||
child: BlocBuilder<RewardsCubit, RewardsState>(
|
||||
builder: (context, state) {
|
||||
final ref = state.referrals;
|
||||
return TripzScaffold(
|
||||
title: l10n.rewardsTitle,
|
||||
status: state.status,
|
||||
error: state.error,
|
||||
onRetry: _cubit.load,
|
||||
child: ListView(
|
||||
children: [
|
||||
if (ref != null) _InviteCard(code: ref.code, summary: ref),
|
||||
const SizedBox(height: Space.lg),
|
||||
Text(l10n.rewardsCoupons, style: context.texts.titleMedium),
|
||||
const SizedBox(height: Space.xs),
|
||||
if (state.coupons.isEmpty)
|
||||
Text(
|
||||
l10n.rewardsCouponsEmpty,
|
||||
style: context.texts.bodySmall?.copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
),
|
||||
)
|
||||
else
|
||||
for (final coupon in state.coupons) ...[
|
||||
TripzCard(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.local_offer_outlined,
|
||||
color: context.tripzColors.success,
|
||||
),
|
||||
const SizedBox(width: Space.sm),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
coupon.code,
|
||||
textDirection: TextDirection.ltr,
|
||||
style: numericStyle(context.texts.titleSmall),
|
||||
),
|
||||
if (coupon.description.isNotEmpty)
|
||||
Text(
|
||||
coupon.description,
|
||||
style: context.texts.bodySmall?.copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: Space.xs),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _InviteCard extends StatelessWidget {
|
||||
const _InviteCard({required this.code, required this.summary});
|
||||
|
||||
final String code;
|
||||
final dynamic summary;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = context.l10n;
|
||||
return Container(
|
||||
padding: Space.page,
|
||||
decoration: BoxDecoration(
|
||||
color: context.colors.primaryContainer,
|
||||
borderRadius: Radii.card_,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
l10n.rewardsInviteTitle,
|
||||
style: context.texts.titleMedium?.copyWith(
|
||||
color: context.colors.onPrimaryContainer,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: Space.xxs),
|
||||
Text(
|
||||
l10n.rewardsInviteLead,
|
||||
style: context.texts.bodySmall?.copyWith(
|
||||
color: context.colors.onPrimaryContainer.withValues(alpha: 0.8),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: Space.md),
|
||||
// الكود يُنسخ ويُشارك — الطريقان اللذان يستعملهما الناس فعلاً.
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SelectableText(
|
||||
code,
|
||||
textDirection: TextDirection.ltr,
|
||||
style: numericStyle(context.texts.headlineSmall).copyWith(
|
||||
letterSpacing: 3,
|
||||
color: context.colors.onPrimaryContainer,
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.copy_rounded),
|
||||
color: context.colors.onPrimaryContainer,
|
||||
onPressed: () => Clipboard.setData(ClipboardData(text: code)),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: Space.sm),
|
||||
TripzButton.primary(
|
||||
label: l10n.menuShare,
|
||||
icon: Icons.share_outlined,
|
||||
onPressed: () =>
|
||||
SharePlus.instance.share(ShareParams(text: l10n.shareMessage(code))),
|
||||
),
|
||||
const SizedBox(height: Space.md),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
_Stat(label: l10n.rewardsInvited, value: summary.total),
|
||||
_Stat(label: l10n.rewardsPending, value: summary.pending),
|
||||
_Stat(label: l10n.rewardsPaid, value: summary.paid),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _Stat extends StatelessWidget {
|
||||
const _Stat({required this.label, required this.value});
|
||||
|
||||
final String label;
|
||||
final int value;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Text(
|
||||
'$value',
|
||||
style: numericStyle(context.texts.titleLarge).copyWith(
|
||||
color: context.colors.onPrimaryContainer,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
label,
|
||||
style: context.texts.labelSmall?.copyWith(
|
||||
color: context.colors.onPrimaryContainer.withValues(alpha: 0.8),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../../core/build_config.dart';
|
||||
import '../../../core/design/tokens.dart';
|
||||
@@ -7,35 +10,79 @@ import '../../../core/l10n/l10n.dart';
|
||||
import '../../../core/ui/tripz_card.dart';
|
||||
import '../../../core/ui/tripz_scaffold.dart';
|
||||
|
||||
/// المساعدة و«عن التطبيق». محتوى محلّي عمداً: الخادم لا يوفّر نقطة أسئلة
|
||||
/// شائعة، وربطها بنصّ من الشبكة يعني شاشة فارغة حين ينقطع الاتصال — وهو
|
||||
/// بالضبط الوقت الذي يفتح فيه المستخدم المساعدة.
|
||||
/// المساعدة: أسئلة شائعة · تواصل · فحص توافق الجهاز · عن التطبيق.
|
||||
///
|
||||
/// المحتوى **محلّي عمداً**: الخادم لا يوفّر نقطة أسئلة شائعة، وربطها بالشبكة
|
||||
/// يعني شاشة فارغة حين ينقطع الاتصال — وهو بالضبط الوقت الذي يفتح فيه
|
||||
/// المستخدم المساعدة.
|
||||
class SupportPage extends StatelessWidget {
|
||||
const SupportPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = context.l10n;
|
||||
final faq = [
|
||||
(l10n.supportFaqQ1, l10n.supportFaqA1),
|
||||
(l10n.supportFaqQ2, l10n.supportFaqA2),
|
||||
(l10n.supportFaqQ3, l10n.supportFaqA3),
|
||||
(l10n.supportFaqQ4, l10n.supportFaqA4),
|
||||
];
|
||||
|
||||
return TripzScaffold(
|
||||
title: l10n.supportTitle,
|
||||
child: ListView(
|
||||
children: [
|
||||
TripzCard(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(l10n.supportContact, style: context.texts.titleMedium),
|
||||
const SizedBox(height: Space.xs),
|
||||
Text(
|
||||
l10n.supportWhatsapp,
|
||||
style: context.texts.bodyMedium?.copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
Text(l10n.supportFaq, style: context.texts.titleMedium),
|
||||
const SizedBox(height: Space.xs),
|
||||
for (final (q, a) in faq)
|
||||
Card(
|
||||
margin: const EdgeInsets.only(bottom: Space.xs),
|
||||
child: ExpansionTile(
|
||||
shape: const RoundedRectangleBorder(borderRadius: Radii.card_),
|
||||
title: Text(q, style: context.texts.bodyMedium),
|
||||
children: [
|
||||
Padding(
|
||||
padding: Space.page,
|
||||
child: Text(
|
||||
a,
|
||||
style: context.texts.bodySmall?.copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: Space.lg),
|
||||
Text(l10n.supportContact, style: context.texts.titleMedium),
|
||||
const SizedBox(height: Space.xs),
|
||||
TripzCard(
|
||||
onTap: () => _openWhatsapp(BuildConfig.supportPhone),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.chat_outlined, color: context.tripzColors.success),
|
||||
const SizedBox(width: Space.sm),
|
||||
Expanded(child: Text(l10n.supportWhatsapp)),
|
||||
const Icon(Icons.chevron_left_rounded),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: Space.md),
|
||||
TripzCard(
|
||||
onTap: () => _showDeviceCheck(context),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.phonelink_setup_outlined),
|
||||
const SizedBox(width: Space.sm),
|
||||
Expanded(child: Text(l10n.supportDeviceCheck)),
|
||||
const Icon(Icons.chevron_left_rounded),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: Space.lg),
|
||||
TripzCard(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
@@ -54,4 +101,69 @@ class SupportPage extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static Future<void> _openWhatsapp(String phone) async {
|
||||
final uri = Uri.parse('https://wa.me/$phone');
|
||||
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||
}
|
||||
|
||||
/// فحص توافق الجهاز — نمط سيرو. يفحص ما يُعطّل التطبيق فعلاً: خدمة الموقع
|
||||
/// وإذنها وإذن الإشعارات. أسبابٌ حقيقية لشكاوى «التطبيق لا يعمل».
|
||||
static Future<void> _showDeviceCheck(BuildContext context) async {
|
||||
final l10n = context.l10n;
|
||||
final issues = <String>[];
|
||||
|
||||
if (!await Geolocator.isLocationServiceEnabled()) {
|
||||
issues.add(l10n.rideNoLocation);
|
||||
}
|
||||
final locationPermission = await Permission.locationWhenInUse.status;
|
||||
if (!locationPermission.isGranted && !locationPermission.isLimited) {
|
||||
issues.add(l10n.permissionDeniedForever);
|
||||
}
|
||||
if (await Permission.notification.isDenied) {
|
||||
issues.add(l10n.notifDenied);
|
||||
}
|
||||
|
||||
if (!context.mounted) return;
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(l10n.supportDeviceCheck),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: issues.isEmpty
|
||||
? [
|
||||
Row(children: [
|
||||
Icon(Icons.check_circle_rounded,
|
||||
color: context.tripzColors.success),
|
||||
const SizedBox(width: Space.xs),
|
||||
Expanded(child: Text(l10n.supportDeviceOk)),
|
||||
]),
|
||||
]
|
||||
: [
|
||||
Text(l10n.supportDeviceIssues),
|
||||
const SizedBox(height: Space.xs),
|
||||
for (final issue in issues)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: Space.xxs),
|
||||
child: Row(children: [
|
||||
Icon(Icons.error_outline_rounded,
|
||||
size: Sizes.iconSm,
|
||||
color: context.tripzColors.warning),
|
||||
const SizedBox(width: Space.xs),
|
||||
Expanded(child: Text(issue)),
|
||||
]),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text(l10n.actionContinue),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,13 @@ class MapsRepository {
|
||||
|
||||
final AntlaqApi _api;
|
||||
|
||||
/// ⚠️ **الغلافان مختلفان بين النقطتين** (مثبت بـcurl 2026-08-05):
|
||||
/// `search` يرجّع `{"results":[…]}` بينما `reverse` يرجّع **مصفوفة عارية**.
|
||||
/// افتراض أن كليهما مصفوفة كان يُفشل البحث صامتاً — فيبدو للمستخدم أن
|
||||
/// «البحث لا يستجيب» بينما التحديد من الخريطة يعمل.
|
||||
Future<List<Place>> search(String query, {GeoPoint? near}) async {
|
||||
if (query.trim().isEmpty) return const [];
|
||||
final res = await _api.get<List<dynamic>>(
|
||||
final res = await _api.get<Map<String, dynamic>>(
|
||||
'/geocoding/search',
|
||||
query: {
|
||||
'q': query.trim(),
|
||||
@@ -20,7 +24,9 @@ class MapsRepository {
|
||||
if (near != null) 'lng': near.lng,
|
||||
},
|
||||
);
|
||||
return res
|
||||
final results = res['results'];
|
||||
if (results is! List) return const [];
|
||||
return results
|
||||
.whereType<Map<String, dynamic>>()
|
||||
.map(Place.fromJson)
|
||||
.toList(growable: false);
|
||||
|
||||
@@ -26,6 +26,7 @@ class Place extends Equatable {
|
||||
name: (json['name_ar'] as String?)?.trim().isNotEmpty == true
|
||||
? json['name_ar'] as String
|
||||
: (json['name'] as String? ?? ''),
|
||||
// `address` قد يصل `null` صراحةً من map-saas — لا يُسقِط النتيجة.
|
||||
address: json['address'] as String? ?? '',
|
||||
category: json['category'] as String? ?? '',
|
||||
point: GeoPoint(
|
||||
|
||||
@@ -72,6 +72,8 @@ class _RidePageState extends State<RidePage> with WidgetsBindingObserver {
|
||||
driver: s.driverLocation,
|
||||
route: s.route,
|
||||
camera: s.cameraTarget,
|
||||
originLabel: s.originLabel,
|
||||
destinationLabel: s.destinationLabel,
|
||||
),
|
||||
builder: (context, data) => RideMap(
|
||||
origin: data.origin,
|
||||
@@ -83,6 +85,8 @@ class _RidePageState extends State<RidePage> with WidgetsBindingObserver {
|
||||
// الورقة تغطّي نحو ثلث الشاشة — يُحسب منه إطار المسار كي لا
|
||||
// يختفي نصفه تحتها.
|
||||
bottomInset: MediaQuery.sizeOf(context).height * 0.34,
|
||||
originLabel: data.originLabel,
|
||||
destinationLabel: data.destinationLabel,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -134,6 +138,8 @@ class _MapData {
|
||||
this.driver,
|
||||
this.route,
|
||||
this.camera,
|
||||
this.originLabel = '',
|
||||
this.destinationLabel = '',
|
||||
});
|
||||
|
||||
final GeoPoint? origin;
|
||||
@@ -141,6 +147,8 @@ class _MapData {
|
||||
final GeoPoint? driver;
|
||||
final dynamic route;
|
||||
final GeoPoint? camera;
|
||||
final String originLabel;
|
||||
final String destinationLabel;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
@@ -149,10 +157,20 @@ class _MapData {
|
||||
other.destination == destination &&
|
||||
other.driver == driver &&
|
||||
other.route == route &&
|
||||
other.camera == camera;
|
||||
other.camera == camera &&
|
||||
other.originLabel == originLabel &&
|
||||
other.destinationLabel == destinationLabel;
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(origin, destination, driver, route, camera);
|
||||
int get hashCode => Object.hash(
|
||||
origin,
|
||||
destination,
|
||||
driver,
|
||||
route,
|
||||
camera,
|
||||
originLabel,
|
||||
destinationLabel,
|
||||
);
|
||||
}
|
||||
|
||||
class _Sheet extends StatelessWidget {
|
||||
@@ -164,8 +182,10 @@ class _Sheet extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final child = switch (state.phase) {
|
||||
RidePhase.idle =>
|
||||
_Collapsed(noLocation: state.error == RideError.noLocation),
|
||||
RidePhase.idle => _Collapsed(
|
||||
noLocation: state.error == RideError.noLocation,
|
||||
originLabel: state.originLabel,
|
||||
),
|
||||
RidePhase.planning => PlannerSheet(state: state),
|
||||
RidePhase.pickingOnMap => _PickConfirm(onConfirm: onConfirmPick),
|
||||
RidePhase.confirming => ConfirmSheet(state: state),
|
||||
@@ -222,16 +242,22 @@ class _MapFab extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
/// البطاقة المطوية — واجهة «إلى أين؟».
|
||||
///
|
||||
/// حقل بحث حقيقي لا زرّ يفتح شاشة: الراكب يبدأ الكتابة فوراً. وموقعه الحالي
|
||||
/// معروض فوقه كي يتأكّد أن نقطة البداية صحيحة قبل أن يفكّر في الوجهة.
|
||||
class _Collapsed extends StatelessWidget {
|
||||
const _Collapsed({required this.noLocation});
|
||||
const _Collapsed({required this.noLocation, required this.originLabel});
|
||||
|
||||
final bool noLocation;
|
||||
final String originLabel;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cubit = context.read<RideCubit>();
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
// بلا موقع لا خريطة مفيدة — السبب يُعرض مع مخرجه بدل خريطة صامتة
|
||||
// على موقع خاطئ.
|
||||
@@ -247,11 +273,60 @@ class _Collapsed extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: Space.sm),
|
||||
],
|
||||
TripzButton.secondary(
|
||||
label: context.l10n.rideWhereTo,
|
||||
icon: Icons.search_rounded,
|
||||
expanded: true,
|
||||
onPressed: cubit.openPlanner,
|
||||
if (originLabel.isNotEmpty) ...[
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 10,
|
||||
height: 10,
|
||||
decoration: BoxDecoration(
|
||||
color: context.tripzColors.mapOrigin,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: Space.xs),
|
||||
Expanded(
|
||||
child: Text(
|
||||
originLabel,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: context.texts.bodySmall?.copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: Space.sm),
|
||||
],
|
||||
// حقل بحث لا زرّ: الضغط عليه يفتح المخطّط والكيبورد معاً.
|
||||
Material(
|
||||
color: context.colors.surfaceContainerHighest,
|
||||
borderRadius: Radii.card_,
|
||||
child: InkWell(
|
||||
onTap: cubit.openPlanner,
|
||||
borderRadius: Radii.card_,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: Space.md,
|
||||
vertical: Space.sm,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.search_rounded, color: context.colors.primary),
|
||||
const SizedBox(width: Space.sm),
|
||||
Expanded(
|
||||
child: Text(
|
||||
context.l10n.rideWhereTo,
|
||||
style: context.texts.titleMedium?.copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../core/design/tokens.dart';
|
||||
import '../../../../core/design/tripz_colors.dart';
|
||||
|
||||
/// بطاقة اسم فوق نقطة على الخريطة — نمط سيرو: الراكب يقرأ «دوّار عبدون» على
|
||||
/// الخريطة نفسها لا في الورقة السفلية وحدها، فيتأكّد أن النقطة صحيحة قبل
|
||||
/// أن يطلب.
|
||||
///
|
||||
/// تُرسم في طبقة فلاتر فوق الخريطة لا كـmarker: نصّ عربي داخل صورة علامة
|
||||
/// يصعب ضبطه، وطبقة فلاتر تعطينا الخط والاتجاه والثيم مجاناً.
|
||||
class MapLabel extends StatelessWidget {
|
||||
const MapLabel({
|
||||
super.key,
|
||||
required this.text,
|
||||
required this.color,
|
||||
this.icon,
|
||||
});
|
||||
|
||||
final String text;
|
||||
final Color color;
|
||||
final IconData? icon;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (text.isEmpty) return const SizedBox.shrink();
|
||||
return Container(
|
||||
constraints: const BoxConstraints(maxWidth: 200),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: Space.xs,
|
||||
vertical: Space.xxs,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: context.tripzColors.surfaceRaised,
|
||||
borderRadius: Radii.field_,
|
||||
border: Border.all(color: color, width: 1.5),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.18),
|
||||
blurRadius: 6,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: BoxDecoration(color: color, shape: BoxShape.circle),
|
||||
),
|
||||
const SizedBox(width: Space.xxs),
|
||||
Flexible(
|
||||
child: Text(
|
||||
text,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: context.texts.labelMedium,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../../core/design/tokens.dart';
|
||||
import '../../../../core/design/tripz_colors.dart';
|
||||
import '../../../../core/l10n/l10n.dart';
|
||||
import '../../../../core/ui/tripz_button.dart';
|
||||
import '../../../../core/ui/tripz_text_field.dart';
|
||||
@@ -29,6 +30,19 @@ class _PlannerSheetState extends State<PlannerSheet> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
/// أيقونة تعبّر عن نوع المكان — مطعم غير شارع غير مستشفى. يقرأها المستخدم
|
||||
/// أسرع من النصّ.
|
||||
IconData _iconFor(String category) => switch (category) {
|
||||
'street' || 'road' => Icons.route_outlined,
|
||||
'restaurant' || 'cafe' || 'food' => Icons.restaurant_outlined,
|
||||
'hospital' || 'clinic' || 'pharmacy' => Icons.local_hospital_outlined,
|
||||
'school' || 'university' => Icons.school_outlined,
|
||||
'mall' || 'shop' || 'store' => Icons.storefront_outlined,
|
||||
'mosque' => Icons.mosque_outlined,
|
||||
'hotel' => Icons.hotel_outlined,
|
||||
_ => Icons.place_outlined,
|
||||
};
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = context.l10n;
|
||||
@@ -51,13 +65,38 @@ class _PlannerSheetState extends State<PlannerSheet> {
|
||||
controller: _query,
|
||||
hint: l10n.rideSearchHint,
|
||||
prefixIcon: Icons.search_rounded,
|
||||
// الكيبورد يفتح فوراً: المستخدم فتح المخطّط ليكتب، لا لينظر.
|
||||
autofocus: true,
|
||||
onChanged: cubit.searchPlaces,
|
||||
suffix: _query.text.isEmpty
|
||||
? null
|
||||
: IconButton(
|
||||
icon: const Icon(Icons.close_rounded),
|
||||
onPressed: () {
|
||||
_query.clear();
|
||||
cubit.searchPlaces('');
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
),
|
||||
if (state.searching)
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(top: Space.md),
|
||||
child: LinearProgressIndicator(minHeight: 2),
|
||||
),
|
||||
if (!state.searching &&
|
||||
_query.text.trim().length >= 2 &&
|
||||
state.searchResults.isEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: Space.md),
|
||||
child: Text(
|
||||
l10n.rideSearchNoResults,
|
||||
textAlign: TextAlign.center,
|
||||
style: context.texts.bodySmall?.copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (state.searchResults.isNotEmpty)
|
||||
Flexible(
|
||||
child: ListView.separated(
|
||||
@@ -69,9 +108,21 @@ class _PlannerSheetState extends State<PlannerSheet> {
|
||||
final place = state.searchResults[i];
|
||||
return ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: const Icon(Icons.place_outlined),
|
||||
title: Text(place.label),
|
||||
subtitle: place.address.isEmpty ? null : Text(place.address),
|
||||
leading: CircleAvatar(
|
||||
radius: 18,
|
||||
backgroundColor: context.colors.surfaceContainerHighest,
|
||||
child: Icon(
|
||||
_iconFor(place.category),
|
||||
size: Sizes.iconSm,
|
||||
color: context.colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
title: Text(place.label, maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis),
|
||||
subtitle: place.address.isEmpty
|
||||
? null
|
||||
: Text(place.address,
|
||||
maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
onTap: () {
|
||||
_query.clear();
|
||||
cubit.pickPlace(place, PickTarget.destination);
|
||||
|
||||
@@ -9,6 +9,7 @@ import '../../../../core/design/tripz_colors.dart';
|
||||
import '../../data/models/geo_point.dart';
|
||||
|
||||
import '../../data/models/route_info.dart';
|
||||
import 'map_label.dart';
|
||||
|
||||
/// الخريطة — **الطبقة الوحيدة التي تعرف `intaleq_maps`**. ما فوقها يتعامل
|
||||
/// مع `GeoPoint` وحده، فتبديل محرّك الخريطة لاحقاً لا يلمس منطقاً.
|
||||
@@ -25,6 +26,8 @@ class RideMap extends StatefulWidget {
|
||||
this.cameraTarget,
|
||||
this.onCameraIdle,
|
||||
this.bottomInset = 280,
|
||||
this.originLabel = '',
|
||||
this.destinationLabel = '',
|
||||
});
|
||||
|
||||
final GeoPoint? origin;
|
||||
@@ -39,6 +42,10 @@ class RideMap extends StatefulWidget {
|
||||
/// ارتفاع ما تغطّيه الورقة السفلية — يُحسب منه إطار المسار.
|
||||
final double bottomInset;
|
||||
|
||||
/// أسماء النقطتين — تُرسم بطاقاتها فوق الخريطة (نمط سيرو).
|
||||
final String originLabel;
|
||||
final String destinationLabel;
|
||||
|
||||
@override
|
||||
State<RideMap> createState() => _RideMapState();
|
||||
}
|
||||
@@ -46,12 +53,14 @@ class RideMap extends StatefulWidget {
|
||||
class _RideMapState extends State<RideMap> {
|
||||
im.IntaleqMapController? _controller;
|
||||
im.LatLng? _center;
|
||||
bool _isStyleLoaded = false;
|
||||
|
||||
static const _fallback = im.LatLng(31.9539, 35.9106); // عمّان
|
||||
|
||||
@override
|
||||
void didUpdateWidget(RideMap old) {
|
||||
super.didUpdateWidget(old);
|
||||
if (!_isStyleLoaded) return;
|
||||
if (widget.route != null && widget.route != old.route) {
|
||||
_fitRoute();
|
||||
return;
|
||||
@@ -110,12 +119,53 @@ class _RideMapState extends State<RideMap> {
|
||||
);
|
||||
}
|
||||
|
||||
/// موضع النقطتين على الشاشة — يُحدَّث عند استقرار الكاميرا كي تتبع
|
||||
/// البطاقاتُ الخريطةَ بلا حساب في كل إطار.
|
||||
Offset? _originPx;
|
||||
Offset? _destPx;
|
||||
|
||||
Future<void> _syncLabelPositions() async {
|
||||
final controller = _controller;
|
||||
if (controller == null) return;
|
||||
final origin = widget.origin;
|
||||
final dest = widget.destination;
|
||||
try {
|
||||
final o = origin == null
|
||||
? null
|
||||
: await controller
|
||||
.getScreenCoordinate(im.LatLng(origin.lat, origin.lng));
|
||||
final d = dest == null
|
||||
? null
|
||||
: await controller.getScreenCoordinate(im.LatLng(dest.lat, dest.lng));
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_originPx = o == null ? null : Offset(o.x.toDouble(), o.y.toDouble());
|
||||
_destPx = d == null ? null : Offset(d.x.toDouble(), d.y.toDouble());
|
||||
});
|
||||
} catch (_) {
|
||||
// الخريطة قد تكون بين حالتين — البطاقات تُخفى بدل أن تُرسم في مكان خطأ.
|
||||
if (mounted) setState(() => _originPx = _destPx = null);
|
||||
}
|
||||
}
|
||||
|
||||
/// بطاقة اسم فوق نقطة، مرفوعة عن الدائرة كي لا تغطّيها.
|
||||
Widget _label(Offset? px, String text, Color color) {
|
||||
if (px == null || text.isEmpty) return const SizedBox.shrink();
|
||||
return Positioned(
|
||||
left: px.dx - 100,
|
||||
top: px.dy - 46,
|
||||
width: 200,
|
||||
child: Center(child: MapLabel(text: text, color: color)),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = context.tripzColors;
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
|
||||
return im.IntaleqMap(
|
||||
return Stack(children: [
|
||||
im.IntaleqMap(
|
||||
apiKey: AppConfig.mapApiKey,
|
||||
initialCameraPosition: im.CameraPosition(
|
||||
target: widget.origin == null
|
||||
@@ -132,32 +182,51 @@ class _RideMapState extends State<RideMap> {
|
||||
compassEnabled: false,
|
||||
zoomControlsEnabled: false,
|
||||
onMapCreated: _onCreated,
|
||||
onStyleLoaded: () {
|
||||
if (mounted && !_isStyleLoaded) {
|
||||
setState(() => _isStyleLoaded = true);
|
||||
}
|
||||
},
|
||||
onCameraMove: (position) => _center = position.target,
|
||||
onCameraIdle: () {
|
||||
final c = _center;
|
||||
if (c != null) widget.onCameraIdle?.call(GeoPoint(c.latitude, c.longitude));
|
||||
if (c != null) {
|
||||
widget.onCameraIdle?.call(GeoPoint(c.latitude, c.longitude));
|
||||
}
|
||||
_syncLabelPositions();
|
||||
},
|
||||
// العلامات دوائر ملوّنة تطابق ألوان الخط الزمني في الورقة السفلية،
|
||||
// فيربط المستخدم بين «من» و«إلى» وما يراه على الخريطة بلا شرح.
|
||||
circles: {
|
||||
if (widget.origin != null)
|
||||
_dot('origin', widget.origin!, colors.mapOrigin),
|
||||
if (widget.destination != null)
|
||||
_dot('destination', widget.destination!, colors.mapDestination),
|
||||
},
|
||||
markers: {
|
||||
if (widget.driver != null) _marker('driver', widget.driver!),
|
||||
},
|
||||
polylines: {
|
||||
if (widget.route != null && widget.route!.encodedPoints.isNotEmpty)
|
||||
im.Polyline(
|
||||
polylineId: const im.PolylineId('route'),
|
||||
points: im.PolylineUtils.decode(widget.route!.encodedPoints),
|
||||
color: colors.mapRoute,
|
||||
width: 5,
|
||||
),
|
||||
},
|
||||
);
|
||||
circles: _isStyleLoaded
|
||||
? {
|
||||
if (widget.origin != null)
|
||||
_dot('origin', widget.origin!, colors.mapOrigin),
|
||||
if (widget.destination != null)
|
||||
_dot('destination', widget.destination!, colors.mapDestination),
|
||||
}
|
||||
: const {},
|
||||
markers: _isStyleLoaded
|
||||
? {
|
||||
if (widget.driver != null) _marker('driver', widget.driver!),
|
||||
}
|
||||
: const {},
|
||||
polylines: _isStyleLoaded
|
||||
? {
|
||||
if (widget.route != null && widget.route!.encodedPoints.isNotEmpty)
|
||||
im.Polyline(
|
||||
polylineId: const im.PolylineId('route'),
|
||||
points: im.PolylineUtils.decode(widget.route!.encodedPoints),
|
||||
color: colors.mapRoute,
|
||||
width: 5,
|
||||
),
|
||||
}
|
||||
: const {},
|
||||
),
|
||||
// أسماء النقطتين فوق الخريطة (نمط سيرو) — طبقة فلاتر لا marker، كي
|
||||
// نرث الخط والاتجاه والثيم.
|
||||
_label(_originPx, widget.originLabel, colors.mapOrigin),
|
||||
_label(_destPx, widget.destinationLabel, colors.mapDestination),
|
||||
]);
|
||||
}
|
||||
|
||||
im.Marker _marker(String id, GeoPoint p) => im.Marker(
|
||||
|
||||
@@ -28,16 +28,30 @@ class WalletCubit extends Cubit<WalletState> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> topup(num amount) async {
|
||||
/// شحن حقيقي. **لا يزيد الرصيد فوراً** إلا في نمط الدفع الفوري — الفاتورة
|
||||
/// تُعرض للمستخدم ويحوّل، والتسوية تصل لاحقاً عبر مطابقة رسالة المزوّد.
|
||||
Future<void> topup({required num amount, required String provider}) async {
|
||||
if (amount <= 0) return;
|
||||
emit(state.copyWith(action: WalletAction.toppingUp));
|
||||
try {
|
||||
await _repo.topup(amount);
|
||||
final result = await _repo.charge(
|
||||
amount: amount,
|
||||
provider: provider,
|
||||
currency: state.currency,
|
||||
);
|
||||
if (isClosed) return;
|
||||
emit(state.copyWith(action: WalletAction.topupDone));
|
||||
// الرصيد يُعاد جلبه من الخادم لا يُحسب محلياً: المال لا يُقدَّر
|
||||
// في التطبيق (docs/23 §0.2).
|
||||
await load();
|
||||
|
||||
if (result.isInstant) {
|
||||
emit(state.copyWith(action: WalletAction.topupDone));
|
||||
// الرصيد يُعاد جلبه من الخادم لا يُحسب محلياً: المال لا يُقدَّر
|
||||
// في التطبيق (docs/23 §0.2).
|
||||
await load();
|
||||
return;
|
||||
}
|
||||
emit(state.copyWith(
|
||||
action: WalletAction.invoiceReady,
|
||||
invoice: result,
|
||||
));
|
||||
} on ApiException {
|
||||
if (!isClosed) emit(state.copyWith(action: WalletAction.topupFailed));
|
||||
}
|
||||
|
||||
@@ -3,8 +3,9 @@ import 'package:equatable/equatable.dart';
|
||||
import '../../../core/ui/view_status.dart';
|
||||
import '../data/models/wallet.dart';
|
||||
import '../data/models/wallet_txn.dart';
|
||||
import '../data/wallet_repository.dart';
|
||||
|
||||
enum WalletAction { none, toppingUp, topupFailed, topupDone }
|
||||
enum WalletAction { none, toppingUp, topupFailed, topupDone, invoiceReady }
|
||||
|
||||
class WalletState extends Equatable {
|
||||
const WalletState({
|
||||
@@ -12,6 +13,7 @@ class WalletState extends Equatable {
|
||||
this.wallet,
|
||||
this.transactions = const [],
|
||||
this.action = WalletAction.none,
|
||||
this.invoice,
|
||||
this.error,
|
||||
});
|
||||
|
||||
@@ -23,6 +25,9 @@ class WalletState extends Equatable {
|
||||
/// المعروض خلفه.
|
||||
final WalletAction action;
|
||||
|
||||
/// فاتورة تحويل بانتظار الدفع — تُعرض للمستخدم بمرجعها وحساب الاستلام.
|
||||
final TopupResult? invoice;
|
||||
|
||||
final String? error;
|
||||
|
||||
String get currency => wallet?.currency ?? '';
|
||||
@@ -32,6 +37,7 @@ class WalletState extends Equatable {
|
||||
Wallet? wallet,
|
||||
List<WalletTxn>? transactions,
|
||||
WalletAction? action,
|
||||
TopupResult? invoice,
|
||||
String? error,
|
||||
}) {
|
||||
return WalletState(
|
||||
@@ -39,10 +45,12 @@ class WalletState extends Equatable {
|
||||
wallet: wallet ?? this.wallet,
|
||||
transactions: transactions ?? this.transactions,
|
||||
action: action ?? this.action,
|
||||
invoice: invoice ?? this.invoice,
|
||||
error: error ?? this.error,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [status, wallet, transactions, action, error];
|
||||
List<Object?> get props =>
|
||||
[status, wallet, transactions, action, invoice?.reference, error];
|
||||
}
|
||||
|
||||
@@ -2,6 +2,33 @@ import '../../../core/api/api_client.dart';
|
||||
import 'models/wallet.dart';
|
||||
import 'models/wallet_txn.dart';
|
||||
|
||||
/// نتيجة الشحن — ثلاثة أنماط: فوري · فاتورة · إعادة توجيه.
|
||||
class TopupResult {
|
||||
const TopupResult({
|
||||
required this.status,
|
||||
this.reference,
|
||||
this.transferTarget,
|
||||
this.instructions,
|
||||
this.redirectUrl,
|
||||
});
|
||||
|
||||
final String status;
|
||||
|
||||
/// مرجع الفاتورة الذي يذكره المستخدم عند التحويل — به تُطابَق رسالة
|
||||
/// المزوّد لاحقاً.
|
||||
final String? reference;
|
||||
|
||||
/// حساب/رقم استلام المستأجر عند هذا المزوّد.
|
||||
final String? transferTarget;
|
||||
|
||||
final String? instructions;
|
||||
final String? redirectUrl;
|
||||
|
||||
bool get isInvoice => reference != null;
|
||||
bool get isInstant => status == 'success';
|
||||
bool get isRedirect => redirectUrl != null;
|
||||
}
|
||||
|
||||
class WalletRepository {
|
||||
WalletRepository(this._api);
|
||||
|
||||
@@ -20,8 +47,35 @@ class WalletRepository {
|
||||
.toList(growable: false);
|
||||
}
|
||||
|
||||
Future<void> topup(num amount) =>
|
||||
_api.post<Map<String, dynamic>>('/wallet/topup', body: {'amount': amount});
|
||||
/// شحن حقيقي عبر `POST /payments/charge`.
|
||||
///
|
||||
/// **لا يزيد الرصيد فوراً.** كليك وشام كاش وزين كاش تعمل بنمط الفاتورة:
|
||||
/// الخادم يولّد مرجعاً ويعرض حساب الاستلام، ثم يحوّل المستخدم، والتسوية
|
||||
/// تصل لاحقاً عبر مطابقة رسالة المزوّد. هذا **نفس مسار سيرو** حرفياً.
|
||||
/// PayMob وحده يرجّع رابط إعادة توجيه، و`cash` وحده فوري.
|
||||
Future<TopupResult> charge({
|
||||
required num amount,
|
||||
required String provider,
|
||||
required String currency,
|
||||
}) async {
|
||||
final res = await _api.post<Map<String, dynamic>>(
|
||||
'/payments/charge',
|
||||
body: {
|
||||
'amount': amount,
|
||||
'provider': provider,
|
||||
'purpose': 'topup',
|
||||
'currency': currency,
|
||||
},
|
||||
);
|
||||
final payment = res['payment'] as Map<String, dynamic>?;
|
||||
return TopupResult(
|
||||
status: payment?['status'] as String? ?? 'pending',
|
||||
reference: res['reference'] as String?,
|
||||
transferTarget: res['transferTarget'] as String?,
|
||||
instructions: res['instructions'] as String?,
|
||||
redirectUrl: res['redirectUrl'] as String?,
|
||||
);
|
||||
}
|
||||
|
||||
// ── السحب: خطوتان لا خطوة ────────────────────────────────────────────
|
||||
// `request` يرسل رمزاً **بلا خصم**، و`confirm` هو ما يخصم ويحجز
|
||||
|
||||
@@ -17,6 +17,7 @@ import '../../../core/ui/tripz_text_field.dart';
|
||||
import '../cubit/wallet_cubit.dart';
|
||||
import '../cubit/wallet_state.dart';
|
||||
import 'widgets/balance_card.dart';
|
||||
import 'widgets/invoice_sheet.dart';
|
||||
import 'widgets/txn_tile.dart';
|
||||
|
||||
/// محفظة الراكب — **رصيدٌ دفعه ولم يستهلكه**، أي التزامٌ على المنصّة.
|
||||
@@ -50,6 +51,12 @@ class _WalletPageState extends State<WalletPage> {
|
||||
SnackBar(content: Text(l10n.walletTopupFailed)),
|
||||
);
|
||||
}
|
||||
// الفاتورة تُعرض فور جهوزها: المستخدم يحتاج المرجع وحساب الاستلام
|
||||
// قبل أن يغادر التطبيق ليحوّل.
|
||||
final invoice = state.invoice;
|
||||
if (state.action == WalletAction.invoiceReady && invoice != null) {
|
||||
TripzSheet.show(context, child: InvoiceSheet(invoice: invoice));
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
return TripzScaffold(
|
||||
@@ -124,12 +131,13 @@ class _WalletPageState extends State<WalletPage> {
|
||||
onSelect: (c) => setState(() => channel = c),
|
||||
),
|
||||
const SizedBox(height: Space.md),
|
||||
// صراحةٌ مقصودة: الخادم يصف هذه النقطة بـ«كاش-إن تجريبي». إخفاء
|
||||
// ذلك يجعل المستخدم يظنّ أنه دفع فعلاً.
|
||||
StatusBanner(
|
||||
message: l10n.walletTopupNote,
|
||||
tone: BannerTone.warning,
|
||||
),
|
||||
// الشحن ليس فورياً في قنوات الفاتورة — يُقال قبل الضغط لا بعده.
|
||||
if (channel != PaymentChannel.cash)
|
||||
StatusBanner(
|
||||
message: l10n.walletInvoicePending,
|
||||
tone: BannerTone.info,
|
||||
icon: Icons.schedule_rounded,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -138,7 +146,9 @@ class _WalletPageState extends State<WalletPage> {
|
||||
onPressed: () {
|
||||
final amount = num.tryParse(controller.text.trim());
|
||||
Navigator.of(context).pop();
|
||||
if (amount != null) _cubit.topup(amount);
|
||||
if (amount != null) {
|
||||
_cubit.topup(amount: amount, provider: channel.wire);
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../../../../core/design/tokens.dart';
|
||||
import '../../../../core/design/tripz_colors.dart';
|
||||
import '../../../../core/design/typography.dart';
|
||||
import '../../../../core/l10n/l10n.dart';
|
||||
import '../../../../core/ui/status_banner.dart';
|
||||
import '../../data/wallet_repository.dart';
|
||||
|
||||
/// فاتورة التحويل — نمط سيرو حرفياً (`create_cliq_invoice.php`).
|
||||
///
|
||||
/// المستخدم يحوّل بنفسه إلى حساب المشغّل ويذكر المرجع، والتسوية تصل لاحقاً
|
||||
/// بمطابقة رسالة المزوّد. **الرصيد لا يزيد الآن** — وهذا يُقال صراحةً بدل
|
||||
/// أن ينتظر المستخدم رقماً لن يتغيّر.
|
||||
class InvoiceSheet extends StatelessWidget {
|
||||
const InvoiceSheet({super.key, required this.invoice});
|
||||
|
||||
final TopupResult invoice;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = context.l10n;
|
||||
final target = invoice.transferTarget;
|
||||
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(l10n.walletInvoiceTitle, style: context.texts.titleLarge),
|
||||
const SizedBox(height: Space.md),
|
||||
|
||||
// حساب الاستلام قد لا يكون مضبوطاً للمستأجر — يُقال بوضوح بدل تعليمات
|
||||
// ناقصة تُرسل المال إلى لا مكان.
|
||||
if (target == null || target.isEmpty)
|
||||
StatusBanner(message: l10n.walletNoTarget, tone: BannerTone.danger)
|
||||
else
|
||||
_CopyRow(label: l10n.walletInvoiceTarget, value: target),
|
||||
|
||||
const SizedBox(height: Space.sm),
|
||||
if (invoice.reference != null)
|
||||
_CopyRow(label: l10n.walletInvoiceRef, value: invoice.reference!),
|
||||
|
||||
const SizedBox(height: Space.md),
|
||||
StatusBanner(
|
||||
message: l10n.walletInvoicePending,
|
||||
tone: BannerTone.info,
|
||||
icon: Icons.schedule_rounded,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// قيمة مع زرّ نسخ — الرقم يُحوَّل يدوياً في تطبيق بنك آخر، فالنسخ ليس رفاهية.
|
||||
class _CopyRow extends StatelessWidget {
|
||||
const _CopyRow({required this.label, required this.value});
|
||||
|
||||
final String label;
|
||||
final String value;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: Space.page,
|
||||
decoration: BoxDecoration(
|
||||
color: context.colors.surfaceContainerHighest,
|
||||
borderRadius: Radii.card_,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: context.texts.labelSmall?.copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: Space.xxs),
|
||||
SelectableText(
|
||||
value,
|
||||
textDirection: TextDirection.ltr,
|
||||
style: numericStyle(context.texts.titleMedium),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.copy_rounded),
|
||||
tooltip: context.l10n.walletCopy,
|
||||
onPressed: () {
|
||||
Clipboard.setData(ClipboardData(text: value));
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(context.l10n.walletCopied)),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -81,6 +81,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.19.1"
|
||||
cross_file:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cross_file
|
||||
sha256: "92c9c43c383bfa1c32079d3bc492d55d6d4318044b7b47edaff8971cbb555c51"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.5+4"
|
||||
crypto:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -765,6 +773,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.6.0"
|
||||
share_plus:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: share_plus
|
||||
sha256: "223873d106614442ea6f20db5a038685cc5b32a2fba81cdecaefbbae0523f7fa"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "12.0.2"
|
||||
share_plus_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: share_plus_platform_interface
|
||||
sha256: "88023e53a13429bd65d8e85e11a9b484f49d4c190abbd96c7932b74d6927cc9a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.0"
|
||||
shared_preferences:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -898,6 +922,70 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
url_launcher:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: url_launcher
|
||||
sha256: f6a7e5c4835bb4e3026a04793a4199ca2d14c739ec378fdfe23fc8075d0439f8
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.2"
|
||||
url_launcher_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_android
|
||||
sha256: "17bc677f0b301615530dd1d67e0a9828cafa2d0b6b6eae4cd3679b7eac4a273c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.30"
|
||||
url_launcher_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_ios
|
||||
sha256: "580fe5dfb51671ae38191d316e027f6b76272b026370708c2d898799750a02b0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.4.1"
|
||||
url_launcher_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_linux
|
||||
sha256: d5e14138b3bc193a0f63c10a53c94b91d399df0512b1f29b94a043db7482384a
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.2"
|
||||
url_launcher_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_macos
|
||||
sha256: "368adf46f71ad3c21b8f06614adb38346f193f3a59ba8fe9a2fd74133070ba18"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.5"
|
||||
url_launcher_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_platform_interface
|
||||
sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.2"
|
||||
url_launcher_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_web
|
||||
sha256: "85c81589622fbc87c1c683aaea164d3604a7777495a79d91e39ffcdec39ddb34"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.3"
|
||||
url_launcher_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_windows
|
||||
sha256: "712c70ab1b99744ff066053cbe3e80c73332b38d46e5e945c98689b2e66fc15f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.5"
|
||||
uuid:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -36,6 +36,10 @@ dependencies:
|
||||
geolocator: ^14.0.2
|
||||
socket_io_client: ^3.0.2
|
||||
|
||||
# الدراور: المشاركة وفتح الروابط
|
||||
share_plus: ^12.0.1
|
||||
url_launcher: ^6.3.2
|
||||
|
||||
# م6: الإشعارات — الإعداد الأصلي (google-services) منقول مع الطبقة الأصلية
|
||||
firebase_core: ^4.4.0
|
||||
firebase_messaging: ^16.1.1
|
||||
|
||||
Reference in New Issue
Block a user