fix(rider): البحث عن مكان والمحفظة الحقيقية وأسماء الخريطة

## البحث لم يكن يستجيب — غلافان مختلفان
مثبت بـcurl: /geocoding/search يرجّع {"results":[…]} بينما /geocoding/reverse
يرجّع مصفوفة عارية. افترضتُ كليهما مصفوفة، فكان البحث يفشل صامتاً — ولهذا
«تحديد من الخريطة» يعمل (يستعمل reverse) والبحث لا. أُضيفت رسالة «لا نتائج»
كي لا يبقى الفراغ غامضاً، وأيقونة لكل صنف مكان.

## المحفظة صارت دفعاً حقيقياً لا كاش-إن
كنت أستعمل POST /wallet/topup — وهو بوصف الخادم كاش-إن تجريبي يزيد الرصيد
بلا دفع. المسار الصحيح موجود أصلاً: POST /payments/charge مع provider
وpurpose، وسجلّ بوابات فيه cash · paymob · syriatel · mtn ومحوّل فاتورة
لـ cliq · shamcash · zaincash.

كليك وشام كاش وزين كاش تعمل بنمط **الفاتورة** — نفس ما يفعله سيرو حرفياً
(create_cliq_invoice.php): الخادم يولّد مرجعاً ويعرض حساب الاستلام، ويحوّل
المستخدم، والتسوية تصل لاحقاً بمطابقة رسالة المزوّد. لا بوابة تحويل حيّة.
- InvoiceSheet يعرض المرجع وحساب الاستلام بزرّي نسخ — الرقم يُحوَّل في تطبيق
  بنك آخر فالنسخ ليس رفاهية
- يُقال صراحةً أن الرصيد لا يزيد الآن، قبل الضغط لا بعده
- حساب استلام غير مضبوط للمستأجر يُعرض كخطأ لا كتعليمات ناقصة
- أسماء المزوّدين صُحّحت لتطابق PaymentGatewayRegistry حرفياً (syriatel لا
  syriatel_cash…) — أي اسم آخر يرجّع 400
- qi_card حُذف: لا محوّل له على الخادم
- السائق: chargeCredit بنيّة credit_topup للرصيد التشغيلي

## الخريطة وواجهة «إلى أين»
- أسماء البداية والنهاية تُرسم فوق الخريطة (نمط سيرو) كطبقة فلاتر لا marker
- البطاقة المطوية صارت حقل بحث بارزاً مع الموقع الحالي فوقه
- حقل البحث يفتح مركّزاً مع زرّ مسح

## أداة
tool/sync_from_rider.sh كان يستثني ملفَّي ARB فيُسقط كل مفتاح مشترك جديد
ويكسر بناء السائق — تكرّر ثلاث مرات. صارا يُنسخان ثم تُفرض نصوص السائق فوقهما.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Hamza-Ayed
2026-08-05 01:26:05 +03:00
co-authored by Claude Opus 5
parent e22cc5c7e4
commit 6a33cc7241
26 changed files with 965 additions and 121 deletions
@@ -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(