feat(apps): التقييم والمحفظتان ومسار الرحلة — المرحلة 5
## التقييم مفروض لا اختياري
SessionCubit يفحص GET /trips/rating/pending بعد إثبات الجلسة، ووجود رحلة
معلّقة يحجز التطبيق كله عند /rating حتى تُحسم. دور المستخدم في الرحلة يأتي
من الخادم لا من نوع التطبيق — نفس الرقم قد يكون له حسابان (docs/38 §1).
التقييم المزدوج يرجّع 400، وهو نجاح من منظور المستخدم: الرحلة مُقيَّمة فعلاً
فلا يُحبس في شاشة بلا مخرج.
الجلسة تحتاج معرفة التقييم المعلّق، و core لا يجوز أن يستورد ميزة التقييم —
فأُضيفت الطريقة لواجهة SessionSource ونفّذها AuthRepository.
## core/format/money.dart
كل المبالغ تصل نصوصاً ("0.000")؛ التحويل والعرض من نقطة واحدة. عدد المنازل
من العملة (JOD ثلاث)، والعملة من إعداد المستأجر لا من ثابت في التطبيق.
## المحفظتان لا تُوحَّدان
- الراكب WalletPage: رصيد + شحن = التزام على المنصّة
- السائق EarningsPage: أرباح + سحب = إيراد له
شكلهما متقارب وحسابهما مختلف؛ دمجهما خطأ محاسبي لا اختصار (docs/39 §4).
## السحب بخطوتين
request يرسل رمزاً بلا خصم، و confirm هو ما يخصم ويحجز. شاشة سيرو كانت خطوة
واحدة ولم تُقلَّد. الرمز الخاطئ لا يُرجع المستخدم لخطوة المبلغ.
الرصيد التشغيلي معروض منفصلاً عن الأرباح: منه تُخصم العمولة ونفاده يوقف
وصول الطلبات — خلطه بالأرباح يخفي سبب توقّف العمل عن السائق.
FareSummary يعرض رقم كلّ طرف: price_for_passenger للراكب و price_for_driver
للسائق — حقلان منفصلان والفرق عمولة (docs/38 §4).
الإلغاء بتأكيد صريح مع سبب؛ السبب لا يقبله عقد الخادم بعد لكن السؤال يخفض
الإلغاء العرضي ويجهّز الحقل.
flutter analyze نظيف · الراكب 86 ملف/6,280 سطر · السائق 83 ملف/5,818 سطر.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
1156299d09
commit
66e28acc58
@@ -0,0 +1,67 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../core/design/tokens.dart';
|
||||
import '../../../../core/design/tripz_colors.dart';
|
||||
import '../../../../core/design/typography.dart';
|
||||
import '../../../../core/format/money.dart';
|
||||
|
||||
/// بطاقة الرصيد — الرقم هو بطل الشاشة، فيأخذ أكبر حجم وأعلى تباين.
|
||||
class BalanceCard extends StatelessWidget {
|
||||
const BalanceCard({
|
||||
super.key,
|
||||
required this.label,
|
||||
required this.balance,
|
||||
required this.currency,
|
||||
this.hint,
|
||||
this.action,
|
||||
});
|
||||
|
||||
final String label;
|
||||
final String? balance;
|
||||
final String currency;
|
||||
final String? hint;
|
||||
final Widget? action;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: Space.page,
|
||||
decoration: BoxDecoration(
|
||||
color: context.colors.primaryContainer,
|
||||
borderRadius: Radii.card_,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: context.texts.labelLarge?.copyWith(
|
||||
color: context.colors.onPrimaryContainer,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: Space.xs),
|
||||
Text(
|
||||
Money.format(balance, currency),
|
||||
style: numericStyle(context.texts.displaySmall).copyWith(
|
||||
color: context.colors.onPrimaryContainer,
|
||||
),
|
||||
),
|
||||
if (hint != null) ...[
|
||||
const SizedBox(height: Space.xxs),
|
||||
Text(
|
||||
hint!,
|
||||
style: context.texts.bodySmall?.copyWith(
|
||||
color: context.colors.onPrimaryContainer.withValues(alpha: 0.8),
|
||||
),
|
||||
),
|
||||
],
|
||||
if (action != null) ...[
|
||||
const SizedBox(height: Space.md),
|
||||
action!,
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../core/design/tokens.dart';
|
||||
import '../../../../core/design/tripz_colors.dart';
|
||||
import '../../../../core/design/typography.dart';
|
||||
import '../../../../core/format/money.dart';
|
||||
import '../../data/models/wallet_txn.dart';
|
||||
|
||||
class TxnTile extends StatelessWidget {
|
||||
const TxnTile({super.key, required this.txn, required this.currency});
|
||||
|
||||
final WalletTxn txn;
|
||||
final String currency;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = context.tripzColors;
|
||||
final isCredit = txn.isCredit;
|
||||
|
||||
return ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: CircleAvatar(
|
||||
backgroundColor:
|
||||
(isCredit ? colors.success : colors.danger).withValues(alpha: 0.12),
|
||||
child: Icon(
|
||||
isCredit ? Icons.south_west_rounded : Icons.north_east_rounded,
|
||||
size: Sizes.iconSm,
|
||||
color: isCredit ? colors.success : colors.danger,
|
||||
),
|
||||
),
|
||||
title: Text(txn.reason, style: context.texts.bodyMedium),
|
||||
subtitle: txn.createdAt == null
|
||||
? null
|
||||
: Text(
|
||||
// التاريخ بصيغة الـlocale (docs/26 §5).
|
||||
MaterialLocalizations.of(context).formatFullDate(txn.createdAt!),
|
||||
style: context.texts.bodySmall?.copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
trailing: Text(
|
||||
Money.format(txn.amount, currency),
|
||||
style: numericStyle(context.texts.titleSmall).copyWith(
|
||||
color: isCredit ? colors.success : colors.danger,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user