import 'package:flutter/material.dart'; import '../../../../core/l10n/app_localizations.dart'; import '../../../../core/design/tokens.dart'; /// بطاقة السائق في شاشة التتبع. class DriverCard extends StatelessWidget { final String driverName; final String vehicleMake; final String vehicleModel; final String vehiclePlate; final String vehicleColor; final String status; final VoidCallback? onCall; final VoidCallback? onChat; final VoidCallback? onCancel; const DriverCard({ super.key, required this.driverName, required this.vehicleMake, required this.vehicleModel, required this.vehiclePlate, required this.vehicleColor, required this.status, this.onCall, this.onChat, this.onCancel, }); @override Widget build(BuildContext context) { final l10n = AppLocalizations.of(context)!; final cs = Theme.of(context).colorScheme; return Card( elevation: 4, child: Padding( padding: const EdgeInsets.all(T.pagePadding), child: Column( mainAxisSize: MainAxisSize.min, children: [ // صف الصورة + المعلومات Row( children: [ // صورة السائق ( Placeholder ) CircleAvatar( radius: 28, backgroundColor: cs.primaryContainer, child: Icon(Icons.person, color: cs.onPrimaryContainer), ), const SizedBox(width: T.s12), // اسم السائق + التقييم Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( driverName.isNotEmpty ? driverName : l10n.loading, style: Theme.of(context).textTheme.titleMedium?.copyWith( fontWeight: FontWeight.w600, ), ), const SizedBox(height: 2), Row( children: [ Icon(Icons.star_rounded, size: 16, color: Colors.amber), const SizedBox(width: 4), Text('4.8', style: Theme.of(context).textTheme.bodySmall), ], ), ], ), ), ], ), const SizedBox(height: T.s12), const Divider(height: 1), const SizedBox(height: T.s12), // معلومات المركبة Row( children: [ Icon(Icons.directions_car_filled_rounded, size: 20, color: cs.onSurfaceVariant), const SizedBox(width: T.s8), Expanded( child: Text( '$vehicleColor $vehicleMake $vehicleModel', style: Theme.of(context).textTheme.bodyMedium, maxLines: 1, overflow: TextOverflow.ellipsis, ), ), // رقم اللوحة — بارز بوضوح Container( padding: const EdgeInsets.symmetric(horizontal: T.s8, vertical: T.s4), decoration: BoxDecoration( color: cs.surfaceContainerHighest, borderRadius: BorderRadius.circular(T.r8), ), child: Text( vehiclePlate, style: Theme.of(context).textTheme.labelLarge?.copyWith( fontWeight: FontWeight.w700, fontFeatures: const [FontFeature.tabularFigures()], ), ), ), ], ), const SizedBox(height: T.s12), // أزرار الإجراءات Row( children: [ Expanded( child: OutlinedButton.icon( onPressed: onCall, icon: const Icon(Icons.call_rounded, size: 18), label: Text(l10n.callDriver), ), ), const SizedBox(width: T.s8), Expanded( child: OutlinedButton.icon( onPressed: onChat, icon: const Icon(Icons.chat_rounded, size: 18), label: Text(l10n.chatWithDriver), ), ), ], ), if (onCancel != null) ...[ const SizedBox(height: T.s8), SizedBox( width: double.infinity, child: TextButton( onPressed: onCancel, child: Text(l10n.cancel, style: TextStyle(color: cs.error)), ), ), ], ], ), ), ); } }