Update: 2026-08-03 00:20:40
This commit is contained in:
@@ -9,32 +9,46 @@ class BlacklistPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cs = Theme.of(context).colorScheme;
|
||||
Get.put(QualityController()).fetchBlacklist();
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: cs.surface,
|
||||
body: Column(
|
||||
children: [
|
||||
_buildAppBar(context, cs),
|
||||
_buildTabBar(context, cs),
|
||||
Expanded(
|
||||
child: GetBuilder<QualityController>(
|
||||
builder: (controller) {
|
||||
if (controller.isLoading) {
|
||||
return _buildLoadingState(cs);
|
||||
}
|
||||
// كان `Get.put(...).fetchBlacklist()` يُستدعى هنا مباشرة، فيُعاد الجلب مع
|
||||
// كل إعادة بناء للشجرة. نسجّل المتحكّم مرة واحدة ونترك الجلب لـ onInit.
|
||||
final controller = Get.isRegistered<QualityController>()
|
||||
? Get.find<QualityController>()
|
||||
: Get.put(QualityController());
|
||||
|
||||
return TabBarView(
|
||||
controller: DefaultTabController.of(context),
|
||||
children: [
|
||||
_buildDriverList(controller, cs),
|
||||
_buildPassengerList(controller, cs),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
// الشاشة تستدعي DefaultTabController.of(context) في مكانين (TabBar
|
||||
// و TabBarView) دون أن يوجد DefaultTabController في الشجرة إطلاقاً —
|
||||
// فكان الاستدعاء يرمي استثناءً وتظهر الصفحة رمادية فارغة.
|
||||
return DefaultTabController(
|
||||
length: 2,
|
||||
child: Builder(
|
||||
builder: (context) => Scaffold(
|
||||
backgroundColor: cs.surface,
|
||||
body: Column(
|
||||
children: [
|
||||
_buildAppBar(context, cs),
|
||||
_buildTabBar(context, cs),
|
||||
Expanded(
|
||||
child: GetBuilder<QualityController>(
|
||||
init: controller,
|
||||
builder: (controller) {
|
||||
if (controller.isLoading) {
|
||||
return _buildLoadingState(cs);
|
||||
}
|
||||
|
||||
return TabBarView(
|
||||
controller: DefaultTabController.of(context),
|
||||
children: [
|
||||
_buildDriverList(controller, cs),
|
||||
_buildPassengerList(controller, cs),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:siro_admin/constant/theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../controller/admin/quality_controller.dart';
|
||||
@@ -18,7 +19,7 @@ class DriverScorecardPage extends StatelessWidget {
|
||||
appBar: AppBar(
|
||||
title: const Text('بطاقة أداء السائق',
|
||||
style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
backgroundColor: Colors.blueAccent,
|
||||
backgroundColor: cs.info,
|
||||
),
|
||||
body: GetBuilder<QualityController>(
|
||||
builder: (controller) {
|
||||
@@ -56,7 +57,7 @@ class DriverScorecardPage extends StatelessWidget {
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 40,
|
||||
backgroundColor: Colors.grey.shade300,
|
||||
backgroundColor: cs.onSurfaceVariant.shade300,
|
||||
child: const Icon(Icons.person,
|
||||
size: 50, color: Colors.white),
|
||||
),
|
||||
@@ -66,11 +67,11 @@ class DriverScorecardPage extends StatelessWidget {
|
||||
style: const TextStyle(
|
||||
fontSize: 22, fontWeight: FontWeight.bold)),
|
||||
Text('هاتف: ${basicInfo['phone']}',
|
||||
style: const TextStyle(color: Colors.grey)),
|
||||
style: const TextStyle(color: cs.onSurfaceVariant)),
|
||||
const Divider(height: 30),
|
||||
Text('التقييم الشامل (Score)',
|
||||
style: TextStyle(
|
||||
fontSize: 18, color: Colors.grey.shade700)),
|
||||
fontSize: 18, color: cs.onSurfaceVariant.shade700)),
|
||||
const SizedBox(height: 5),
|
||||
Stack(
|
||||
alignment: Alignment.center,
|
||||
@@ -81,7 +82,7 @@ class DriverScorecardPage extends StatelessWidget {
|
||||
child: CircularProgressIndicator(
|
||||
value: overallScore / 100,
|
||||
strokeWidth: 10,
|
||||
backgroundColor: Colors.grey.shade200,
|
||||
backgroundColor: cs.onSurfaceVariant.shade200,
|
||||
color: scoreColor,
|
||||
),
|
||||
),
|
||||
@@ -103,7 +104,7 @@ class DriverScorecardPage extends StatelessWidget {
|
||||
Card(
|
||||
elevation: 2,
|
||||
child: ListTile(
|
||||
leading: const Icon(Icons.drive_eta, color: Colors.blue),
|
||||
leading: const Icon(Icons.drive_eta, color: cs.info),
|
||||
title: const Text('نسبة الإنجاز'),
|
||||
trailing: Text('${ridesStats['completion_rate']}%',
|
||||
style: const TextStyle(
|
||||
@@ -128,7 +129,7 @@ class DriverScorecardPage extends StatelessWidget {
|
||||
child: Column(
|
||||
children: [
|
||||
const Icon(Icons.star,
|
||||
color: Colors.orange, size: 30),
|
||||
color: cs.warning, size: 30),
|
||||
const SizedBox(height: 5),
|
||||
Text('${rating.toString()}/5.0',
|
||||
style: const TextStyle(
|
||||
@@ -136,7 +137,7 @@ class DriverScorecardPage extends StatelessWidget {
|
||||
fontWeight: FontWeight.bold)),
|
||||
const Text('متوسط التقييم',
|
||||
style: TextStyle(
|
||||
fontSize: 12, color: Colors.grey)),
|
||||
fontSize: 12, color: cs.onSurfaceVariant)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -150,7 +151,7 @@ class DriverScorecardPage extends StatelessWidget {
|
||||
child: Column(
|
||||
children: [
|
||||
const Icon(Icons.warning,
|
||||
color: Colors.redAccent, size: 30),
|
||||
color: cs.danger, size: 30),
|
||||
const SizedBox(height: 5),
|
||||
Text('${complaints['total_complaints']} شكوى',
|
||||
style: const TextStyle(
|
||||
@@ -158,7 +159,7 @@ class DriverScorecardPage extends StatelessWidget {
|
||||
fontWeight: FontWeight.bold)),
|
||||
Text('${complaints['open_complaints']} مفتوحة',
|
||||
style: const TextStyle(
|
||||
fontSize: 12, color: Colors.red)),
|
||||
fontSize: 12, color: cs.danger)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -221,7 +222,7 @@ class DriverScorecardPage extends StatelessWidget {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(icon, size: 20, color: Colors.grey.shade600),
|
||||
Icon(icon, size: 20, color: cs.onSurfaceVariant.shade600),
|
||||
const SizedBox(width: 8),
|
||||
Text(title, style: const TextStyle(fontSize: 15)),
|
||||
],
|
||||
@@ -233,8 +234,8 @@ class DriverScorecardPage extends StatelessWidget {
|
||||
}
|
||||
|
||||
Color _getScoreColor(num score) {
|
||||
if (score >= 80) return Colors.green;
|
||||
if (score >= 60) return Colors.orange;
|
||||
return Colors.red;
|
||||
if (score >= 80) return cs.success;
|
||||
if (score >= 60) return cs.warning;
|
||||
return cs.danger;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user