إصلاح توافق فلاتر مع Theme الجديد

This commit is contained in:
Hamza-Ayed
2026-07-26 11:33:20 +03:00
parent 7830efead7
commit 3af99cc18a
31 changed files with 4256 additions and 2833 deletions
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:siro_admin/constant/colors.dart';
import 'package:siro_admin/controller/admin/financial_v2_controller.dart';
class FinancialV2Page extends StatelessWidget {
@@ -8,19 +7,21 @@ class FinancialV2Page extends StatelessWidget {
@override
Widget build(BuildContext context) {
final cs = Theme.of(context).colorScheme;
final controller = Get.put(FinancialV2Controller());
return Scaffold(
backgroundColor: AppColor.bg,
backgroundColor: cs.surface,
appBar: AppBar(
title: const Text('الإدارة المالية المتقدمة',
style: TextStyle(fontWeight: FontWeight.bold)),
backgroundColor: AppColor.surface,
title: Text('الإدارة المالية المتقدمة',
style: TextStyle(fontWeight: FontWeight.bold, color: cs.onSurface)),
backgroundColor: cs.surface,
elevation: 0,
centerTitle: true,
iconTheme: IconThemeData(color: cs.onSurface),
actions: [
IconButton(
icon: const Icon(Icons.refresh_rounded),
icon: Icon(Icons.refresh_rounded, color: cs.onSurface),
onPressed: () => controller.fetchAllFinancials(),
)
],
@@ -28,8 +29,8 @@ class FinancialV2Page extends StatelessWidget {
body: GetBuilder<FinancialV2Controller>(
builder: (ctrl) {
if (ctrl.isLoading) {
return const Center(
child: CircularProgressIndicator(color: AppColor.accent));
return Center(
child: CircularProgressIndicator(color: cs.primary));
}
return SingleChildScrollView(
@@ -37,13 +38,13 @@ class FinancialV2Page extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildMainFinancialStats(ctrl.stats),
_buildMainFinancialStats(ctrl.stats, cs),
const SizedBox(height: 24),
_buildSectionTitle('طرق الدفع'),
_buildPaymentMethodBreakdown(ctrl.stats),
_buildSectionTitle('طرق الدفع', cs),
_buildPaymentMethodBreakdown(ctrl.stats, cs),
const SizedBox(height: 32),
_buildSectionTitle('تسويات الكباتن (مستحقات معلقة)'),
_buildSettlementsList(ctrl.settlements),
_buildSectionTitle('تسويات الكباتن (مستحقات معلقة)', cs),
_buildSettlementsList(ctrl.settlements, cs),
const SizedBox(height: 40),
],
),
@@ -53,13 +54,13 @@ class FinancialV2Page extends StatelessWidget {
);
}
Widget _buildSectionTitle(String title) {
Widget _buildSectionTitle(String title, ColorScheme cs) {
return Padding(
padding: const EdgeInsets.only(bottom: 16),
child: Text(
title,
style: const TextStyle(
color: AppColor.textPrimary,
style: TextStyle(
color: cs.onSurface,
fontSize: 16,
fontWeight: FontWeight.bold,
),
@@ -67,14 +68,15 @@ class FinancialV2Page extends StatelessWidget {
);
}
Widget _buildMainFinancialStats(Map<String, dynamic> stats) {
Widget _buildMainFinancialStats(Map<String, dynamic> stats, ColorScheme cs) {
return Column(
children: [
_buildFinancialCard(
'إجمالي عمولة المنصة',
'${stats['total_platform_commission'] ?? 0} ج.م',
Icons.account_balance_rounded,
AppColor.accent,
cs.primary,
cs,
),
const SizedBox(height: 12),
Row(
@@ -84,7 +86,8 @@ class FinancialV2Page extends StatelessWidget {
'إجمالي دخل الكباتن',
'${stats['total_driver_pay'] ?? 0}',
Icons.person_pin_rounded,
AppColor.info,
cs.tertiary,
cs,
isSmall: true,
),
),
@@ -94,7 +97,8 @@ class FinancialV2Page extends StatelessWidget {
'إجمالي الإيرادات',
'${stats['total_revenue'] ?? 0}',
Icons.payments_rounded,
AppColor.success,
const Color(0xFF10B981),
cs,
isSmall: true,
),
),
@@ -105,18 +109,18 @@ class FinancialV2Page extends StatelessWidget {
}
Widget _buildFinancialCard(
String title, String value, IconData icon, Color color,
String title, String value, IconData icon, Color color, ColorScheme cs,
{bool isSmall = false}) {
return Container(
padding: EdgeInsets.all(isSmall ? 16 : 24),
decoration: BoxDecoration(
color: AppColor.surface,
color: cs.surfaceContainerHighest,
borderRadius: BorderRadius.circular(20),
border: Border.all(color: color.withOpacity(0.2)),
border: Border.all(color: color.withValues(alpha: 0.2)),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [AppColor.surface, color.withOpacity(0.05)],
colors: [cs.surfaceContainerHighest, color.withValues(alpha: 0.05)],
),
),
child: Row(
@@ -124,7 +128,7 @@ class FinancialV2Page extends StatelessWidget {
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: color.withOpacity(0.1),
color: color.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(14),
),
child: Icon(icon, color: color, size: isSmall ? 20 : 28),
@@ -135,12 +139,12 @@ class FinancialV2Page extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(title,
style: const TextStyle(
color: AppColor.textSecondary, fontSize: 12)),
style: TextStyle(
color: cs.onSurfaceVariant, fontSize: 12)),
const SizedBox(height: 4),
Text(value,
style: TextStyle(
color: AppColor.textPrimary,
color: cs.onSurface,
fontSize: isSmall ? 18 : 24,
fontWeight: FontWeight.bold)),
],
@@ -151,7 +155,7 @@ class FinancialV2Page extends StatelessWidget {
);
}
Widget _buildPaymentMethodBreakdown(Map<String, dynamic> stats) {
Widget _buildPaymentMethodBreakdown(Map<String, dynamic> stats, ColorScheme cs) {
double cash = double.tryParse(stats['cash_payments'].toString()) ?? 0;
double digital = double.tryParse(stats['digital_payments'].toString()) ?? 0;
double total = cash + digital;
@@ -160,21 +164,21 @@ class FinancialV2Page extends StatelessWidget {
return Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: AppColor.surface,
color: cs.surfaceContainerHighest,
borderRadius: BorderRadius.circular(20),
),
child: Column(
children: [
_buildPaymentBar('نقدي (Cash)', cash, total, AppColor.warning),
_buildPaymentBar('نقدي (Cash)', cash, total, cs.tertiary, cs),
const SizedBox(height: 16),
_buildPaymentBar('إلكتروني / محفظة', digital, total, AppColor.info),
_buildPaymentBar('إلكتروني / محفظة', digital, total, cs.tertiary, cs),
],
),
);
}
Widget _buildPaymentBar(
String label, double value, double total, Color color) {
String label, double value, double total, Color color, ColorScheme cs) {
double percent = value / total;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -183,8 +187,7 @@ class FinancialV2Page extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(label,
style:
const TextStyle(color: AppColor.textPrimary, fontSize: 13)),
style: TextStyle(color: cs.onSurface, fontSize: 13)),
Text('${value.toStringAsFixed(0)} ج.م',
style: TextStyle(color: color, fontWeight: FontWeight.bold)),
],
@@ -194,7 +197,7 @@ class FinancialV2Page extends StatelessWidget {
borderRadius: BorderRadius.circular(4),
child: LinearProgressIndicator(
value: percent,
backgroundColor: AppColor.divider,
backgroundColor: cs.outline,
color: color,
minHeight: 8,
),
@@ -203,9 +206,11 @@ class FinancialV2Page extends StatelessWidget {
);
}
Widget _buildSettlementsList(List<dynamic> settlements) {
Widget _buildSettlementsList(List<dynamic> settlements, ColorScheme cs) {
if (settlements.isEmpty) {
return const Center(child: Text('لا توجد تسويات معلقة'));
return Center(
child: Text('لا توجد تسويات معلقة',
style: TextStyle(color: cs.onSurfaceVariant)));
}
return ListView.builder(
@@ -218,9 +223,9 @@ class FinancialV2Page extends StatelessWidget {
margin: const EdgeInsets.only(bottom: 12),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: AppColor.surface,
color: cs.surfaceContainerHighest,
borderRadius: BorderRadius.circular(16),
border: Border.all(color: AppColor.divider),
border: Border.all(color: cs.outline),
),
child: Row(
children: [
@@ -229,36 +234,36 @@ class FinancialV2Page extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('${s['first_name']} ${s['last_name']}',
style: const TextStyle(
color: AppColor.textPrimary,
style: TextStyle(
color: cs.onSurface,
fontWeight: FontWeight.bold)),
Text(s['phone'] ?? '',
style: const TextStyle(
color: AppColor.textSecondary, fontSize: 12)),
style: TextStyle(
color: cs.onSurfaceVariant, fontSize: 12)),
const SizedBox(height: 4),
Text('${s['total_rides']} رحلة مكتملة',
style: const TextStyle(
color: AppColor.info, fontSize: 11)),
style: TextStyle(
color: cs.tertiary, fontSize: 11)),
],
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
const Text('المستحقات',
Text('المستحقات',
style: TextStyle(
color: AppColor.textSecondary, fontSize: 10)),
color: cs.onSurfaceVariant, fontSize: 10)),
Text('${s['total_earned']} ج.م',
style: const TextStyle(
color: AppColor.accent,
style: TextStyle(
color: cs.primary,
fontSize: 18,
fontWeight: FontWeight.bold)),
const SizedBox(height: 4),
ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: AppColor.accent.withOpacity(0.1),
foregroundColor: AppColor.accent,
backgroundColor: cs.primary.withValues(alpha: 0.1),
foregroundColor: cs.primary,
elevation: 0,
minimumSize: const Size(80, 32),
shape: RoundedRectangleBorder(