Update: 2026-08-03 00:20:40
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:siro_admin/constant/map_tiles.dart';
|
||||
import 'package:siro_admin/constant/theme.dart';
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -237,67 +238,65 @@ class _RidesDashboardScreenState extends State<RidesDashboardScreen>
|
||||
physics: const BouncingScrollPhysics(),
|
||||
slivers: [
|
||||
// 1. Sliver AppBar (المتحرك الذكي الذي يصغر عند التمرير)
|
||||
// الرأس: سطح هادئ بدل الكتلة الملوّنة المشبعة.
|
||||
// النسخة السابقة كانت شريحة بلون primary بارتفاع 310 مع تدرّج
|
||||
// وظل — تسحب الانتباه إلى الإطار بدل الأرقام، وهي أول ما يجعل
|
||||
// اللوحة تبدو غير احترافية. اللون الآن يميّز الحالة داخل البطاقات
|
||||
// فقط، حيث يحمل معنى.
|
||||
SliverAppBar(
|
||||
pinned: true,
|
||||
floating: false,
|
||||
expandedHeight: 310.0,
|
||||
backgroundColor: cs.primary,
|
||||
elevation: 4,
|
||||
shadowColor: cs.primary.withValues(alpha: 0.4),
|
||||
iconTheme: IconThemeData(color: cs.onPrimary),
|
||||
centerTitle: true,
|
||||
expandedHeight: 268.0,
|
||||
backgroundColor: cs.surface,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
iconTheme: IconThemeData(color: cs.onSurface),
|
||||
centerTitle: false,
|
||||
titleSpacing: 20,
|
||||
title: Text(
|
||||
'إدارة الرحلات',
|
||||
style: TextStyle(
|
||||
color: cs.onPrimary,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
color: cs.onSurface,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 19,
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
Container(
|
||||
margin:
|
||||
const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14),
|
||||
const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: cs.onPrimary.withValues(alpha: 0.2),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: cs.primary.withValues(alpha: 0.10),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
color: cs.primary.withValues(alpha: 0.22)),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'اليوم',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: cs.onPrimary,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: cs.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background: Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
cs.primary,
|
||||
cs.primary.withValues(alpha: 0.8),
|
||||
],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
),
|
||||
),
|
||||
color: cs.surface,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
// الإحصائيات تختفي عند التمرير لأعلى
|
||||
_buildStatisticsSection(cs),
|
||||
const SizedBox(height: 12),
|
||||
// شريط البحث يختفي عند التمرير لأعلى
|
||||
const SizedBox(height: 14),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: _buildSearchBar(cs),
|
||||
),
|
||||
const SizedBox(height: 60), // مساحة للـ TabBar بالأسفل
|
||||
const SizedBox(height: 62), // مساحة للـ TabBar بالأسفل
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -308,8 +307,8 @@ class _RidesDashboardScreenState extends State<RidesDashboardScreen>
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: cs.surface,
|
||||
borderRadius:
|
||||
const BorderRadius.vertical(top: Radius.circular(24)),
|
||||
border: Border(
|
||||
bottom: BorderSide(color: cs.outline, width: 1)),
|
||||
),
|
||||
child: TabBar(
|
||||
controller: _tabController,
|
||||
@@ -318,8 +317,9 @@ class _RidesDashboardScreenState extends State<RidesDashboardScreen>
|
||||
unselectedLabelColor: cs.onSurfaceVariant,
|
||||
indicatorColor: cs.primary,
|
||||
indicatorWeight: 3,
|
||||
indicatorSize: TabBarIndicatorSize.label,
|
||||
labelStyle: const TextStyle(
|
||||
fontWeight: FontWeight.bold, fontSize: 14),
|
||||
fontWeight: FontWeight.w700, fontSize: 14),
|
||||
tabAlignment: TabAlignment.center,
|
||||
dividerColor: Colors.transparent,
|
||||
tabs: const [
|
||||
@@ -403,9 +403,11 @@ class _RidesDashboardScreenState extends State<RidesDashboardScreen>
|
||||
child: Text(
|
||||
'نظرة عامة',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white.withOpacity(0.8),
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w700,
|
||||
// كان Colors.white ثابتاً — يصلح فوق الرأس الملوّن السابق فقط،
|
||||
// ويصبح غير مقروء إطلاقاً على سطح الوضع الفاتح.
|
||||
color: cs.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -426,7 +428,7 @@ class _RidesDashboardScreenState extends State<RidesDashboardScreen>
|
||||
'مكتملة',
|
||||
controller.completedCount.toString(),
|
||||
Icons.check_circle_rounded,
|
||||
const Color(0xFF14B8A6), cs)),
|
||||
cs.tertiary, cs)),
|
||||
Obx(() => _buildStatCard(
|
||||
'ملغاة',
|
||||
controller.canceledCount.toString(),
|
||||
@@ -446,25 +448,28 @@ class _RidesDashboardScreenState extends State<RidesDashboardScreen>
|
||||
|
||||
Widget _buildStatCard(
|
||||
String label, String value, IconData icon, Color iconColor, ColorScheme cs) {
|
||||
// البطاقة تُبنى على سطح مرتفع بحدّ رفيع وشارة لونية للأيقونة، بدل
|
||||
// بطاقة بيضاء عائمة بظل ثقيل. اللون يعرّف الحالة ولا يملأ المساحة.
|
||||
return Container(
|
||||
width: 105,
|
||||
width: 108,
|
||||
margin: const EdgeInsets.only(left: 10),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 8),
|
||||
padding: const EdgeInsets.symmetric(vertical: 14, horizontal: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: cs.surface,
|
||||
color: cs.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: cs.shadow.withValues(alpha: 0.1),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 4),
|
||||
)
|
||||
],
|
||||
border: Border.all(color: iconColor.withValues(alpha: 0.22)),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(icon, color: iconColor, size: 24),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(7),
|
||||
decoration: BoxDecoration(
|
||||
color: iconColor.withValues(alpha: 0.12),
|
||||
borderRadius: BorderRadius.circular(9),
|
||||
),
|
||||
child: Icon(icon, color: iconColor, size: 18),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
value,
|
||||
@@ -489,15 +494,9 @@ class _RidesDashboardScreenState extends State<RidesDashboardScreen>
|
||||
Widget _buildSearchBar(ColorScheme cs) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: cs.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: cs.shadow.withValues(alpha: 0.05),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 4),
|
||||
)
|
||||
],
|
||||
color: cs.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
border: Border.all(color: cs.outline),
|
||||
),
|
||||
child: TextField(
|
||||
controller: controller.searchController,
|
||||
@@ -600,7 +599,7 @@ class _RidesDashboardScreenState extends State<RidesDashboardScreen>
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: statusColor.withOpacity(0.1),
|
||||
color: statusColor.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
@@ -630,7 +629,7 @@ class _RidesDashboardScreenState extends State<RidesDashboardScreen>
|
||||
Container(
|
||||
width: 2,
|
||||
height: 16,
|
||||
color: Colors.grey.withOpacity(0.3),
|
||||
color: cs.outline,
|
||||
margin: const EdgeInsets.symmetric(vertical: 2)),
|
||||
Icon(Icons.location_on_rounded,
|
||||
size: 14, color: cs.danger),
|
||||
@@ -645,20 +644,20 @@ class _RidesDashboardScreenState extends State<RidesDashboardScreen>
|
||||
ride.startLocation,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black87),
|
||||
color: cs.onSurface),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
ride.endLocation,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black87),
|
||||
color: cs.onSurface),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -736,10 +735,10 @@ class _RidesDashboardScreenState extends State<RidesDashboardScreen>
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: cs.danger.withOpacity(0.08),
|
||||
color: cs.danger.withValues(alpha: 0.08),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: cs.danger.withOpacity(0.2)),
|
||||
color: cs.danger.withValues(alpha: 0.2)),
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -777,6 +776,7 @@ class _RidesDashboardScreenState extends State<RidesDashboardScreen>
|
||||
required Color color,
|
||||
required bool isAdmin,
|
||||
}) {
|
||||
final cs = Theme.of(context).colorScheme;
|
||||
String displayPhone = phone;
|
||||
if (!isAdmin && phone.length > 4) {
|
||||
displayPhone =
|
||||
@@ -791,7 +791,7 @@ class _RidesDashboardScreenState extends State<RidesDashboardScreen>
|
||||
'$title:',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: Colors.grey[600],
|
||||
color: cs.onSurfaceVariant,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
@@ -800,16 +800,16 @@ class _RidesDashboardScreenState extends State<RidesDashboardScreen>
|
||||
name,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black87),
|
||||
color: cs.onSurface),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
displayPhone,
|
||||
style: TextStyle(
|
||||
fontSize: 11, color: Colors.grey[500], letterSpacing: 0.5),
|
||||
fontSize: 11, color: cs.onSurfaceVariant, letterSpacing: 0.5),
|
||||
),
|
||||
if (isAdmin && phone.isNotEmpty) ...[
|
||||
const SizedBox(width: 8),
|
||||
@@ -835,7 +835,7 @@ class _RidesDashboardScreenState extends State<RidesDashboardScreen>
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.08),
|
||||
color: color.withValues(alpha: 0.08),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
@@ -869,7 +869,7 @@ class _RidesDashboardScreenState extends State<RidesDashboardScreen>
|
||||
return cs.danger;
|
||||
}
|
||||
if (status == 'New') return cs.info;
|
||||
return Colors.grey;
|
||||
return cs.onSurfaceVariant;
|
||||
}
|
||||
|
||||
String _getStatusText(String status) {
|
||||
@@ -1000,10 +1000,7 @@ class _RideMapMonitorScreenState extends State<RideMapMonitorScreen> {
|
||||
initialZoom: 13,
|
||||
),
|
||||
children: [
|
||||
TileLayer(
|
||||
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
userAgentPackageName: 'com.siromove.admin',
|
||||
),
|
||||
MapTiles.layer(context),
|
||||
// Route Polyline
|
||||
if (startPos != null && endPos != null)
|
||||
PolylineLayer(
|
||||
@@ -1011,7 +1008,7 @@ class _RideMapMonitorScreenState extends State<RideMapMonitorScreen> {
|
||||
Polyline(
|
||||
points: [startPos!, endPos!],
|
||||
strokeWidth: 5,
|
||||
color: const Color(0xFF4318FF).withOpacity(0.8),
|
||||
color: cs.primary.withValues(alpha: 0.8),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -1030,7 +1027,7 @@ class _RideMapMonitorScreenState extends State<RideMapMonitorScreen> {
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.2),
|
||||
color: Colors.black.withValues(alpha: 0.2),
|
||||
blurRadius: 5),
|
||||
],
|
||||
),
|
||||
@@ -1051,7 +1048,7 @@ class _RideMapMonitorScreenState extends State<RideMapMonitorScreen> {
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.2),
|
||||
color: Colors.black.withValues(alpha: 0.2),
|
||||
blurRadius: 5),
|
||||
],
|
||||
),
|
||||
@@ -1072,7 +1069,7 @@ class _RideMapMonitorScreenState extends State<RideMapMonitorScreen> {
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: cs.info.withOpacity(0.3),
|
||||
color: cs.info.withValues(alpha: 0.3),
|
||||
blurRadius: 8),
|
||||
],
|
||||
),
|
||||
@@ -1096,7 +1093,7 @@ class _RideMapMonitorScreenState extends State<RideMapMonitorScreen> {
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.1),
|
||||
color: Colors.black.withValues(alpha: 0.1),
|
||||
blurRadius: 20,
|
||||
offset: const Offset(0, 10),
|
||||
),
|
||||
@@ -1152,12 +1149,13 @@ class _RideMapMonitorScreenState extends State<RideMapMonitorScreen> {
|
||||
required String phone,
|
||||
required Color color,
|
||||
}) {
|
||||
final cs = Theme.of(context).colorScheme;
|
||||
return Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.1),
|
||||
color: color.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Icon(icon, size: 20, color: color),
|
||||
@@ -1171,7 +1169,7 @@ class _RideMapMonitorScreenState extends State<RideMapMonitorScreen> {
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: Colors.grey[600],
|
||||
color: cs.onSurfaceVariant,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
@@ -1200,11 +1198,11 @@ class _RideMapMonitorScreenState extends State<RideMapMonitorScreen> {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.green.withOpacity(0.1),
|
||||
color: cs.success.withValues(alpha: 0.1),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child:
|
||||
const Icon(Icons.call_rounded, size: 20, color: Colors.green),
|
||||
Icon(Icons.call_rounded, size: 20, color: cs.success),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user