إصلاح توافق فلاتر مع Theme الجديد
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
// org_list_page.dart — قائمة مؤسسات مواصلاتي (لوحة إدارة سيرو)
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
import '../../controller/transit/transit_admin_controller.dart';
|
||||
import '../../controller/transit/transit_admin_models.dart';
|
||||
import 'org_create_page.dart';
|
||||
@@ -27,22 +25,25 @@ class _TransitOrgListPageState extends State<TransitOrgListPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cs = Theme.of(context).colorScheme;
|
||||
|
||||
return GetBuilder<TransitAdminController>(
|
||||
builder: (c) => Scaffold(
|
||||
backgroundColor: AppColor.bg,
|
||||
backgroundColor: cs.surface,
|
||||
appBar: AppBar(
|
||||
backgroundColor: AppColor.bg,
|
||||
backgroundColor: cs.surface,
|
||||
elevation: 0,
|
||||
title: const Text('مواصلاتي — المؤسسات', style: TextStyle(color: AppColor.textPrimary)),
|
||||
title: Text('مواصلاتي — المؤسسات',
|
||||
style: TextStyle(color: cs.onSurface)),
|
||||
iconTheme: IconThemeData(color: cs.onSurface),
|
||||
actions: [
|
||||
// زر اعتماد الخطوط
|
||||
IconButton(
|
||||
icon: const Icon(Icons.route_rounded, color: AppColor.warning),
|
||||
icon: Icon(Icons.route_rounded, color: cs.tertiary),
|
||||
tooltip: 'اعتماد الخطوط',
|
||||
onPressed: () => Get.to(() => const RouteApprovalPage()),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.add, color: AppColor.accent),
|
||||
icon: Icon(Icons.add, color: cs.primary),
|
||||
onPressed: () async {
|
||||
final created = await Get.to(() => const TransitOrgCreatePage());
|
||||
if (created == true) c.fetchOrgs();
|
||||
@@ -56,17 +57,17 @@ class _TransitOrgListPageState extends State<TransitOrgListPage> {
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: TextField(
|
||||
controller: _searchCtrl,
|
||||
style: const TextStyle(color: AppColor.textPrimary),
|
||||
style: TextStyle(color: cs.onSurface),
|
||||
onSubmitted: (v) {
|
||||
c.searchQuery = v;
|
||||
c.fetchOrgs();
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
hintText: 'ابحث عن مؤسسة...',
|
||||
hintStyle: const TextStyle(color: AppColor.textSecondary),
|
||||
prefixIcon: const Icon(Icons.search, color: AppColor.textSecondary),
|
||||
hintStyle: TextStyle(color: cs.onSurfaceVariant),
|
||||
prefixIcon: Icon(Icons.search, color: cs.onSurfaceVariant),
|
||||
filled: true,
|
||||
fillColor: AppColor.surface,
|
||||
fillColor: cs.surfaceContainerHighest,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide.none,
|
||||
@@ -76,17 +77,18 @@ class _TransitOrgListPageState extends State<TransitOrgListPage> {
|
||||
),
|
||||
Expanded(
|
||||
child: c.isLoadingList
|
||||
? const Center(child: CircularProgressIndicator(color: AppColor.accent))
|
||||
? Center(child: CircularProgressIndicator(color: cs.primary))
|
||||
: c.orgs.isEmpty
|
||||
? const Center(
|
||||
child: Text('لا توجد مؤسسات', style: TextStyle(color: AppColor.textSecondary)),
|
||||
? Center(
|
||||
child: Text('لا توجد مؤسسات',
|
||||
style: TextStyle(color: cs.onSurfaceVariant)),
|
||||
)
|
||||
: RefreshIndicator(
|
||||
onRefresh: c.fetchOrgs,
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
itemCount: c.orgs.length,
|
||||
itemBuilder: (_, i) => _orgCard(c.orgs[i]),
|
||||
itemBuilder: (_, i) => _orgCard(c.orgs[i], cs),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -96,30 +98,30 @@ class _TransitOrgListPageState extends State<TransitOrgListPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _orgCard(TransitOrgSummary org) {
|
||||
Widget _orgCard(TransitOrgSummary org, ColorScheme cs) {
|
||||
Color statusColor;
|
||||
switch (org.contractStatus) {
|
||||
case 'active':
|
||||
statusColor = AppColor.success;
|
||||
statusColor = const Color(0xFF10B981);
|
||||
break;
|
||||
case 'trial':
|
||||
statusColor = AppColor.info;
|
||||
statusColor = cs.tertiary;
|
||||
break;
|
||||
case 'suspended':
|
||||
statusColor = AppColor.warning;
|
||||
statusColor = cs.tertiary;
|
||||
break;
|
||||
default:
|
||||
statusColor = AppColor.danger;
|
||||
statusColor = cs.error;
|
||||
}
|
||||
|
||||
return Card(
|
||||
color: AppColor.surface,
|
||||
color: cs.surfaceContainerHighest,
|
||||
margin: const EdgeInsets.only(bottom: 10),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
|
||||
child: ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
title: Text(org.nameAr,
|
||||
style: const TextStyle(color: AppColor.textPrimary, fontWeight: FontWeight.bold)),
|
||||
style: TextStyle(color: cs.onSurface, fontWeight: FontWeight.bold)),
|
||||
subtitle: Padding(
|
||||
padding: const EdgeInsets.only(top: 6),
|
||||
child: Row(
|
||||
@@ -127,7 +129,7 @@ class _TransitOrgListPageState extends State<TransitOrgListPage> {
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: statusColor.withOpacity(0.15),
|
||||
color: statusColor.withValues(alpha: 0.15),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(org.contractStatus,
|
||||
@@ -135,21 +137,21 @@ class _TransitOrgListPageState extends State<TransitOrgListPage> {
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text('${org.city} · ${org.country}',
|
||||
style: const TextStyle(color: AppColor.textSecondary, fontSize: 12)),
|
||||
style: TextStyle(color: cs.onSurfaceVariant, fontSize: 12)),
|
||||
const Spacer(),
|
||||
Icon(Icons.directions_bus, size: 14, color: AppColor.textSecondary),
|
||||
Icon(Icons.directions_bus, size: 14, color: cs.onSurfaceVariant),
|
||||
const SizedBox(width: 2),
|
||||
Text('${org.vehiclesCount}',
|
||||
style: const TextStyle(color: AppColor.textSecondary, fontSize: 12)),
|
||||
style: TextStyle(color: cs.onSurfaceVariant, fontSize: 12)),
|
||||
const SizedBox(width: 10),
|
||||
Icon(Icons.people, size: 14, color: AppColor.textSecondary),
|
||||
Icon(Icons.people, size: 14, color: cs.onSurfaceVariant),
|
||||
const SizedBox(width: 2),
|
||||
Text('${org.activeEnrollments}',
|
||||
style: const TextStyle(color: AppColor.textSecondary, fontSize: 12)),
|
||||
style: TextStyle(color: cs.onSurfaceVariant, fontSize: 12)),
|
||||
],
|
||||
),
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_forward_ios, size: 14, color: AppColor.textSecondary),
|
||||
trailing: Icon(Icons.arrow_forward_ios, size: 14, color: cs.onSurfaceVariant),
|
||||
onTap: () => Get.to(() => TransitOrgDetailsPage(orgId: org.id, orgName: org.nameAr)),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user