Update: 2026-08-07 01:35:27
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
/// شارة نوع الطلب: خاص أم عام.
|
||||
///
|
||||
/// الخادم يمنح السائق الأفضل ترتيباً سبقاً حصرياً بضع ثوانٍ قبل أن يُطلق
|
||||
/// الطلب للجميع (DISPATCH_MODE=batched). بدون هذه الشارة يبدو الفرق
|
||||
/// عشوائياً للسائق؛ معها يفهم أنه صاحب الأولوية الآن وأن التأخير يكلّفه
|
||||
/// الطلب.
|
||||
///
|
||||
/// المصدر: حقل `offer_type` في حمولة السوكِت — 'exclusive' أو 'public'.
|
||||
/// غيابه يعني طلباً عاماً (كل المسارات القديمة والبثّ الحر)، فلا تظهر
|
||||
/// الشارة إطلاقاً في وضع البثّ العادي.
|
||||
class OfferTypeBadge extends StatelessWidget {
|
||||
final Map rideInfo;
|
||||
|
||||
const OfferTypeBadge({Key? key, required this.rideInfo}) : super(key: key);
|
||||
|
||||
bool get _isExclusive =>
|
||||
rideInfo['offer_type']?.toString() == 'exclusive';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// لا شارة في الوضع العادي — لا نضيف ضجيجاً بصرياً بلا معنى.
|
||||
if (rideInfo['offer_type'] == null) return const SizedBox.shrink();
|
||||
|
||||
final Color color = _isExclusive ? Colors.amber.shade800 : Colors.blueGrey;
|
||||
final IconData icon = _isExclusive ? Icons.star_rounded : Icons.public;
|
||||
final String label = _isExclusive ? 'طلب خاص لك'.tr : 'طلب عام'.tr;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.12),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(color: color.withOpacity(0.5)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(icon, color: color, size: 16),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
color: color,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user