feat: implement core architecture, design system, localization, and trip features for both driver and rider apps.
This commit is contained in:
@@ -0,0 +1,150 @@
|
||||
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)),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../../core/l10n/app_localizations.dart';
|
||||
import '../../../../core/design/tokens.dart';
|
||||
|
||||
/// شريط الحالة العلوي في شاشة التتبع.
|
||||
class TripStatusBanner extends StatelessWidget {
|
||||
final String status;
|
||||
|
||||
const TripStatusBanner({super.key, required this.status});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final cs = Theme.of(context).colorScheme;
|
||||
|
||||
final (text, icon, color) = switch (status) {
|
||||
'searching' => (l10n.searchingDriver, Icons.search_rounded, cs.primary),
|
||||
'assigned' || 'driver_arriving' => (l10n.driverArriving, Icons.directions_car_rounded, cs.tertiary),
|
||||
'driver_arrived' => (l10n.driverArrived, Icons.location_on_rounded, Colors.green),
|
||||
'in_progress' => (l10n.rideInProgress, Icons.play_arrow_rounded, cs.primary),
|
||||
'completed' => (l10n.rideCompleted, Icons.check_circle_rounded, Colors.green),
|
||||
'cancelled' => (l10n.tripCancelled, Icons.cancel_rounded, cs.error),
|
||||
'no_drivers' => (l10n.tripNoDrivers, Icons.error_outline_rounded, cs.error),
|
||||
_ => (l10n.loading, Icons.hourglass_empty_rounded, cs.onSurfaceVariant),
|
||||
};
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: T.pagePadding, vertical: T.s12),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withValues(alpha: 0.15),
|
||||
borderRadius: BorderRadius.circular(T.r12),
|
||||
border: Border.all(color: color.withValues(alpha: 0.3)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon, color: color, size: 20),
|
||||
const SizedBox(width: T.s8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
text,
|
||||
style: Theme.of(context).textTheme.titleSmall?.copyWith(
|
||||
color: color,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user