Update: 2026-07-12 05:40:28
This commit is contained in:
@@ -21,6 +21,10 @@ class MapSocketController extends GetxController {
|
||||
int _socketLocationUpdatesCount = 0;
|
||||
Timer? _watchdogTimer;
|
||||
|
||||
// 🚌 مواصلاتي — الخط الحالي المشترَك فيه + مستمع تحديث موقع الباص
|
||||
int? _subscribedTransitRouteId;
|
||||
void Function(Map<String, dynamic> data)? onBusLocationUpdate;
|
||||
|
||||
DateTime? get lastDriverLocationTime => _lastSocketLocationTime;
|
||||
int get socketLocationUpdatesCount => _socketLocationUpdatesCount;
|
||||
|
||||
@@ -61,6 +65,10 @@ class MapSocketController extends GetxController {
|
||||
});
|
||||
Log.print("📡 Re-subscribed to driver location after connect");
|
||||
}
|
||||
if (_subscribedTransitRouteId != null) {
|
||||
socket.emit('subscribe_transit_route', {'route_id': _subscribedTransitRouteId});
|
||||
Log.print("🚌 Re-subscribed to transit route after connect");
|
||||
}
|
||||
update();
|
||||
});
|
||||
|
||||
@@ -89,6 +97,10 @@ class MapSocketController extends GetxController {
|
||||
});
|
||||
Log.print("📡 Re-subscribed to driver location after reconnect");
|
||||
}
|
||||
if (_subscribedTransitRouteId != null) {
|
||||
socket.emit('subscribe_transit_route', {'route_id': _subscribedTransitRouteId});
|
||||
Log.print("🚌 Re-subscribed to transit route after reconnect");
|
||||
}
|
||||
|
||||
if (rideLifecycle.isActiveRideState()) {
|
||||
Log.print("✅ Socket back online — stopping Fast Polling Fallback");
|
||||
@@ -131,6 +143,39 @@ class MapSocketController extends GetxController {
|
||||
socket.on('driver_location_update', (data) {
|
||||
handleDriverLocationUpdate(data);
|
||||
});
|
||||
|
||||
// 🚌 مواصلاتي — بثّ موقع الباص الحي لخط مشترَك فيه
|
||||
socket.on('bus_location_update', (data) {
|
||||
if (data == null) return;
|
||||
try {
|
||||
final map = Map<String, dynamic>.from(data as Map);
|
||||
onBusLocationUpdate?.call(map);
|
||||
} catch (e) {
|
||||
Log.print('Error parsing bus_location_update: $e');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ── مواصلاتي: اشتراك/إلغاء اشتراك ببثّ موقع خط ─────────────
|
||||
// يُستدعى عند فتح/إغلاق شاشة تتبع الباص الحي. يضمن السوكيت متصلاً أولاً.
|
||||
void subscribeToTransitRoute(int routeId) {
|
||||
_subscribedTransitRouteId = routeId;
|
||||
if (!isSocketConnected) {
|
||||
initConnectionWithSocket();
|
||||
// سيُعاد الاشتراك تلقائياً من onConnect إن أضفنا ذلك، لكن نحاول فوراً أيضاً
|
||||
}
|
||||
if (socket.connected) {
|
||||
socket.emit('subscribe_transit_route', {'route_id': routeId});
|
||||
Log.print('🚌 Subscribed to transit route #$routeId');
|
||||
}
|
||||
}
|
||||
|
||||
void unsubscribeFromTransitRoute(int routeId) {
|
||||
if (_subscribedTransitRouteId == routeId) _subscribedTransitRouteId = null;
|
||||
if (isSocketConnected && socket.connected) {
|
||||
socket.emit('unsubscribe_transit_route', {'route_id': routeId});
|
||||
Log.print('🚌 Unsubscribed from transit route #$routeId');
|
||||
}
|
||||
}
|
||||
|
||||
void _startHeartbeat() {
|
||||
|
||||
@@ -1,4 +1,26 @@
|
||||
final Map<String, String> ar_eg = {
|
||||
// ── مواصلاتي (Mawasalati) ──
|
||||
"Mawasalati": "مواصلاتي",
|
||||
"My Memberships": "عضوياتي",
|
||||
"Not enrolled in any institution yet": "لست مشتركاً في أي مؤسسة بعد",
|
||||
"Activate your membership in your university or institution to track your bus live":
|
||||
"فعّل عضويتك في جامعتك أو مؤسستك لمتابعة الباص الخاص بك حياً",
|
||||
"Join a new institution": "انضمام لمؤسسة جديدة",
|
||||
"University, school, or hotel": "جامعة، مدرسة، أو فندق",
|
||||
"Active": "نشطة",
|
||||
"Pending Review": "قيد المراجعة",
|
||||
"Suspended": "موقوفة",
|
||||
"Choose your institution": "اختر مؤسستك",
|
||||
"Search for a university or institution...": "ابحث عن جامعة أو مؤسسة...",
|
||||
"No results": "لا توجد نتائج",
|
||||
"Enter your student/employee ID to activate membership":
|
||||
"أدخل رقمك الجامعي/الوظيفي لتفعيل العضوية",
|
||||
"Student ID": "الرقم الجامعي",
|
||||
"Activate": "تفعيل",
|
||||
"No active routes currently": "لا توجد خطوط نشطة حالياً",
|
||||
"Stops": "محطات",
|
||||
"No bus running on this route right now": "لا يوجد باص يعمل على هذا الخط الآن",
|
||||
"Bus is delayed": "الباص متأخر",
|
||||
" ')[0]).toString()}.\\n\${' I am using": " ')[0]).toString()}.\\n\${' I am using",
|
||||
" I am currently located at ": " أنا حالياً في ",
|
||||
" I am using": " أنا استخدم",
|
||||
|
||||
@@ -1,4 +1,26 @@
|
||||
final Map<String, String> ar_jo = {
|
||||
// ── مواصلاتي (Mawasalati) ──
|
||||
"Mawasalati": "مواصلاتي",
|
||||
"My Memberships": "عضوياتي",
|
||||
"Not enrolled in any institution yet": "لست مشتركاً في أي مؤسسة بعد",
|
||||
"Activate your membership in your university or institution to track your bus live":
|
||||
"فعّل عضويتك في جامعتك أو مؤسستك لمتابعة الباص الخاص بك حياً",
|
||||
"Join a new institution": "انضمام لمؤسسة جديدة",
|
||||
"University, school, or hotel": "جامعة، مدرسة، أو فندق",
|
||||
"Active": "نشطة",
|
||||
"Pending Review": "قيد المراجعة",
|
||||
"Suspended": "موقوفة",
|
||||
"Choose your institution": "اختر مؤسستك",
|
||||
"Search for a university or institution...": "ابحث عن جامعة أو مؤسسة...",
|
||||
"No results": "لا توجد نتائج",
|
||||
"Enter your student/employee ID to activate membership":
|
||||
"أدخل رقمك الجامعي/الوظيفي لتفعيل العضوية",
|
||||
"Student ID": "الرقم الجامعي",
|
||||
"Activate": "تفعيل",
|
||||
"No active routes currently": "لا توجد خطوط نشطة حالياً",
|
||||
"Stops": "محطات",
|
||||
"No bus running on this route right now": "لا يوجد باص يعمل على هذا الخط الآن",
|
||||
"Bus is delayed": "الباص متأخر",
|
||||
" ')[0]).toString()}.\\n\${' I am using": " ')[0]).toString()}.\\n\${' I am using",
|
||||
" I am currently located at ": " أنا حالياً في ",
|
||||
" I am using": " أنا استخدم",
|
||||
|
||||
@@ -1,4 +1,26 @@
|
||||
final Map<String, String> ar_sy = {
|
||||
// ── مواصلاتي (Mawasalati) ──
|
||||
"Mawasalati": "مواصلاتي",
|
||||
"My Memberships": "عضوياتي",
|
||||
"Not enrolled in any institution yet": "لست مشتركاً في أي مؤسسة بعد",
|
||||
"Activate your membership in your university or institution to track your bus live":
|
||||
"فعّل عضويتك في جامعتك أو مؤسستك لمتابعة الباص الخاص بك حياً",
|
||||
"Join a new institution": "انضمام لمؤسسة جديدة",
|
||||
"University, school, or hotel": "جامعة، مدرسة، أو فندق",
|
||||
"Active": "نشطة",
|
||||
"Pending Review": "قيد المراجعة",
|
||||
"Suspended": "موقوفة",
|
||||
"Choose your institution": "اختر مؤسستك",
|
||||
"Search for a university or institution...": "ابحث عن جامعة أو مؤسسة...",
|
||||
"No results": "لا توجد نتائج",
|
||||
"Enter your student/employee ID to activate membership":
|
||||
"أدخل رقمك الجامعي/الوظيفي لتفعيل العضوية",
|
||||
"Student ID": "الرقم الجامعي",
|
||||
"Activate": "تفعيل",
|
||||
"No active routes currently": "لا توجد خطوط نشطة حالياً",
|
||||
"Stops": "محطات",
|
||||
"No bus running on this route right now": "لا يوجد باص يعمل على هذا الخط الآن",
|
||||
"Bus is delayed": "الباص متأخر",
|
||||
" ')[0]).toString()}.\\n\${' I am using": " ')[0]).toString()}.\\n\${' I am using",
|
||||
" I am currently located at ": " أنا حالياً في ",
|
||||
" I am using": " أنا استخدم",
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
// transit_controller.dart — تحكم شاشات مواصلاتي (جهة الراكب)
|
||||
import 'package:get/get.dart';
|
||||
import '../home/map/map_socket_controller.dart';
|
||||
import '../../print.dart';
|
||||
import 'transit_models.dart';
|
||||
import 'transit_service.dart';
|
||||
|
||||
class TransitController extends GetxController {
|
||||
bool isLoadingEnrollments = false;
|
||||
List<TransitEnrollment> myEnrollments = [];
|
||||
|
||||
bool isLoadingOrgs = false;
|
||||
List<TransitOrg> browsableOrgs = [];
|
||||
|
||||
bool isLoadingRoutes = false;
|
||||
List<TransitRouteSummary> currentOrgRoutes = [];
|
||||
int? currentOrgId;
|
||||
|
||||
// ── تتبع الباص الحي ──────────────────────────────────────────
|
||||
int? liveRouteId;
|
||||
int? liveTripId;
|
||||
Map<String, dynamic>? liveTripData;
|
||||
BusPosition? liveBusPosition;
|
||||
String liveError = '';
|
||||
bool isLoadingLiveTrip = false;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
fetchMyEnrollments();
|
||||
}
|
||||
|
||||
Future<void> fetchMyEnrollments() async {
|
||||
isLoadingEnrollments = true;
|
||||
update();
|
||||
final res = await TransitService.getMyEnrollments();
|
||||
if (res.success) myEnrollments = res.data ?? [];
|
||||
isLoadingEnrollments = false;
|
||||
update();
|
||||
}
|
||||
|
||||
Future<void> browseOrgs({String? search}) async {
|
||||
isLoadingOrgs = true;
|
||||
update();
|
||||
final res = await TransitService.browseOrgs(search: search);
|
||||
if (res.success) browsableOrgs = res.data ?? [];
|
||||
isLoadingOrgs = false;
|
||||
update();
|
||||
}
|
||||
|
||||
Future<bool> activateEnrollment(int orgId, String studentId) async {
|
||||
final res = await TransitService.activateEnrollment(
|
||||
orgId: orgId,
|
||||
studentId: studentId,
|
||||
);
|
||||
if (res.success) {
|
||||
await fetchMyEnrollments();
|
||||
return true;
|
||||
}
|
||||
Get.snackbar('مواصلاتي', res.message);
|
||||
return false;
|
||||
}
|
||||
|
||||
Future<void> openOrgRoutes(int orgId) async {
|
||||
currentOrgId = orgId;
|
||||
isLoadingRoutes = true;
|
||||
currentOrgRoutes = [];
|
||||
update();
|
||||
|
||||
final res = await TransitService.getRoutesForOrg(orgId);
|
||||
if (res.success) {
|
||||
currentOrgRoutes = res.data ?? [];
|
||||
} else {
|
||||
Get.snackbar('مواصلاتي', res.message);
|
||||
}
|
||||
isLoadingRoutes = false;
|
||||
update();
|
||||
}
|
||||
|
||||
// ── الخط الحي: تحميل أولي + اشتراك سوكيت ────────────────────
|
||||
Future<void> openLiveRoute(int routeId) async {
|
||||
liveRouteId = routeId;
|
||||
liveTripData = null;
|
||||
liveBusPosition = null;
|
||||
liveError = '';
|
||||
isLoadingLiveTrip = true;
|
||||
update();
|
||||
|
||||
final res = await TransitService.getLiveTrip(routeId: routeId);
|
||||
if (res.success && res.data != null) {
|
||||
liveTripData = res.data;
|
||||
liveTripId = int.tryParse(liveTripData?['trip']?['id']?.toString() ?? '');
|
||||
final pos = liveTripData?['bus_position'];
|
||||
if (pos is Map) liveBusPosition = BusPosition.fromJson(pos);
|
||||
} else {
|
||||
liveError = res.message;
|
||||
}
|
||||
isLoadingLiveTrip = false;
|
||||
update();
|
||||
|
||||
if (Get.isRegistered<MapSocketController>()) {
|
||||
final ms = Get.find<MapSocketController>();
|
||||
ms.onBusLocationUpdate = _handleLiveBusUpdate;
|
||||
ms.subscribeToTransitRoute(routeId);
|
||||
}
|
||||
}
|
||||
|
||||
void _handleLiveBusUpdate(Map<String, dynamic> data) {
|
||||
final incomingRouteId = int.tryParse(data['route_id']?.toString() ?? '');
|
||||
if (incomingRouteId == null || incomingRouteId != liveRouteId) return;
|
||||
|
||||
liveBusPosition = BusPosition(
|
||||
lat: double.tryParse(data['latitude']?.toString() ?? '0') ?? 0,
|
||||
lng: double.tryParse(data['longitude']?.toString() ?? '0') ?? 0,
|
||||
heading: double.tryParse(data['heading']?.toString() ?? '0') ?? 0,
|
||||
speed: double.tryParse(data['speed']?.toString() ?? '0') ?? 0,
|
||||
currentStopSeq: data['current_stop_seq'] == null
|
||||
? null
|
||||
: int.tryParse(data['current_stop_seq'].toString()),
|
||||
);
|
||||
Log.print('🚌 Live bus update: ${liveBusPosition?.lat}, ${liveBusPosition?.lng}');
|
||||
update();
|
||||
}
|
||||
|
||||
void closeLiveRoute() {
|
||||
if (liveRouteId != null && Get.isRegistered<MapSocketController>()) {
|
||||
final ms = Get.find<MapSocketController>();
|
||||
ms.unsubscribeFromTransitRoute(liveRouteId!);
|
||||
ms.onBusLocationUpdate = null;
|
||||
}
|
||||
liveRouteId = null;
|
||||
liveTripId = null;
|
||||
liveTripData = null;
|
||||
liveBusPosition = null;
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
closeLiveRoute();
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
// transit_models.dart — نماذج بيانات مواصلاتي (جهة الراكب)
|
||||
|
||||
class TransitOrg {
|
||||
final int id;
|
||||
final String type;
|
||||
final String nameAr;
|
||||
final String nameEn;
|
||||
final String? logoUrl;
|
||||
final String city;
|
||||
|
||||
TransitOrg({
|
||||
required this.id,
|
||||
required this.type,
|
||||
required this.nameAr,
|
||||
required this.nameEn,
|
||||
required this.city,
|
||||
this.logoUrl,
|
||||
});
|
||||
|
||||
factory TransitOrg.fromJson(Map<String, dynamic> j) => TransitOrg(
|
||||
id: int.tryParse(j['id'].toString()) ?? 0,
|
||||
type: j['type']?.toString() ?? '',
|
||||
nameAr: j['name_ar']?.toString() ?? '',
|
||||
nameEn: j['name_en']?.toString() ?? '',
|
||||
city: j['city']?.toString() ?? '',
|
||||
logoUrl: j['logo_url']?.toString(),
|
||||
);
|
||||
}
|
||||
|
||||
class TransitEnrollment {
|
||||
final int id;
|
||||
final int orgId;
|
||||
final String orgName;
|
||||
final String status; // pending | active | suspended | expired
|
||||
final String verifyMethod;
|
||||
|
||||
TransitEnrollment({
|
||||
required this.id,
|
||||
required this.orgId,
|
||||
required this.orgName,
|
||||
required this.status,
|
||||
required this.verifyMethod,
|
||||
});
|
||||
|
||||
factory TransitEnrollment.fromActivateResponse(
|
||||
Map<String, dynamic> j, int orgId) =>
|
||||
TransitEnrollment(
|
||||
id: int.tryParse(j['enrollment_id'].toString()) ?? 0,
|
||||
orgId: orgId,
|
||||
orgName: j['org_name']?.toString() ?? '',
|
||||
status: j['status']?.toString() ?? 'pending',
|
||||
verifyMethod: j['verify_method']?.toString() ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
class TransitStop {
|
||||
final int id;
|
||||
final int sequence;
|
||||
final String nameAr;
|
||||
final double lat;
|
||||
final double lng;
|
||||
final int etaOffsetMin;
|
||||
final bool isMajor;
|
||||
|
||||
TransitStop({
|
||||
required this.id,
|
||||
required this.sequence,
|
||||
required this.nameAr,
|
||||
required this.lat,
|
||||
required this.lng,
|
||||
required this.etaOffsetMin,
|
||||
required this.isMajor,
|
||||
});
|
||||
|
||||
factory TransitStop.fromJson(Map<String, dynamic> j) => TransitStop(
|
||||
id: int.tryParse(j['id'].toString()) ?? 0,
|
||||
sequence: int.tryParse(j['sequence'].toString()) ?? 0,
|
||||
nameAr: j['name_ar']?.toString() ?? '',
|
||||
lat: double.tryParse(j['latitude']?.toString() ?? '0') ?? 0,
|
||||
lng: double.tryParse(j['longitude']?.toString() ?? '0') ?? 0,
|
||||
etaOffsetMin: int.tryParse(j['eta_offset_min']?.toString() ?? '0') ?? 0,
|
||||
isMajor: (j['is_major']?.toString() ?? '0') == '1',
|
||||
);
|
||||
}
|
||||
|
||||
class TransitRouteSummary {
|
||||
final int id;
|
||||
final String nameAr;
|
||||
final String status;
|
||||
final int stopCount;
|
||||
|
||||
TransitRouteSummary({
|
||||
required this.id,
|
||||
required this.nameAr,
|
||||
required this.status,
|
||||
required this.stopCount,
|
||||
});
|
||||
|
||||
factory TransitRouteSummary.fromJson(Map<String, dynamic> j) =>
|
||||
TransitRouteSummary(
|
||||
id: int.tryParse(j['id'].toString()) ?? 0,
|
||||
nameAr: j['name_ar']?.toString() ?? '',
|
||||
status: j['status']?.toString() ?? '',
|
||||
stopCount: int.tryParse(j['stop_count']?.toString() ?? '0') ?? 0,
|
||||
);
|
||||
}
|
||||
|
||||
class TransitLiveTrip {
|
||||
final int id;
|
||||
final String status;
|
||||
final int delayMinutes;
|
||||
final int? currentStopSeq;
|
||||
final String routeName;
|
||||
final String? departureTime;
|
||||
final String? driverName;
|
||||
|
||||
TransitLiveTrip({
|
||||
required this.id,
|
||||
required this.status,
|
||||
required this.delayMinutes,
|
||||
required this.routeName,
|
||||
this.currentStopSeq,
|
||||
this.departureTime,
|
||||
this.driverName,
|
||||
});
|
||||
|
||||
factory TransitLiveTrip.fromJson(Map<String, dynamic> j) => TransitLiveTrip(
|
||||
id: int.tryParse(j['id'].toString()) ?? 0,
|
||||
status: j['status']?.toString() ?? '',
|
||||
delayMinutes: int.tryParse(j['delay_minutes']?.toString() ?? '0') ?? 0,
|
||||
currentStopSeq: j['current_stop_seq'] == null
|
||||
? null
|
||||
: int.tryParse(j['current_stop_seq'].toString()),
|
||||
routeName: j['route_name']?.toString() ?? '',
|
||||
departureTime: j['departure_time']?.toString(),
|
||||
driverName: j['driver_name']?.toString(),
|
||||
);
|
||||
}
|
||||
|
||||
class BusPosition {
|
||||
final double lat;
|
||||
final double lng;
|
||||
final double heading;
|
||||
final double speed;
|
||||
final int? currentStopSeq;
|
||||
|
||||
BusPosition({
|
||||
required this.lat,
|
||||
required this.lng,
|
||||
this.heading = 0,
|
||||
this.speed = 0,
|
||||
this.currentStopSeq,
|
||||
});
|
||||
|
||||
factory BusPosition.fromJson(Map<dynamic, dynamic> j) => BusPosition(
|
||||
lat: double.tryParse(j['lat']?.toString() ?? '0') ?? 0,
|
||||
lng: double.tryParse(j['lng']?.toString() ?? '0') ?? 0,
|
||||
heading: double.tryParse(j['heading']?.toString() ?? '0') ?? 0,
|
||||
speed: double.tryParse(j['speed']?.toString() ?? '0') ?? 0,
|
||||
currentStopSeq: j['current_stop_seq'] == null
|
||||
? null
|
||||
: int.tryParse(j['current_stop_seq'].toString()),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
// transit_service.dart — طبقة الاتصال بـ backend/transit (جهة الراكب)
|
||||
import '../functions/crud.dart';
|
||||
import '../../constant/links.dart';
|
||||
import 'transit_models.dart';
|
||||
|
||||
class TransitApiResult<T> {
|
||||
final bool success;
|
||||
final T? data;
|
||||
final String message;
|
||||
TransitApiResult(this.success, this.data, this.message);
|
||||
}
|
||||
|
||||
class TransitService {
|
||||
static String get _base => '${AppLink.server}/transit';
|
||||
|
||||
/// تصفح المؤسسات المتاحة للتفعيل (قبل الانضمام)
|
||||
static Future<TransitApiResult<List<TransitOrg>>> browseOrgs({
|
||||
String? country,
|
||||
String? search,
|
||||
}) async {
|
||||
final payload = <String, dynamic>{};
|
||||
if (country != null) payload['country'] = country;
|
||||
if (search != null && search.isNotEmpty) payload['search'] = search;
|
||||
|
||||
final res = await CRUD().post(link: '$_base/org/browse.php', payload: payload);
|
||||
|
||||
if (res is Map && res['status'] == 'success') {
|
||||
final msg = res['message'];
|
||||
final list = (msg is Map && msg['orgs'] is List)
|
||||
? (msg['orgs'] as List)
|
||||
.map((o) => TransitOrg.fromJson(Map<String, dynamic>.from(o)))
|
||||
.toList()
|
||||
: <TransitOrg>[];
|
||||
return TransitApiResult(true, list, 'ok');
|
||||
}
|
||||
return TransitApiResult(false, null, _errMsg(res));
|
||||
}
|
||||
|
||||
/// تفعيل عضوية الراكب في مؤسسة بالرقم الجامعي/الوظيفي
|
||||
static Future<TransitApiResult<TransitEnrollment>> activateEnrollment({
|
||||
required int orgId,
|
||||
required String studentId,
|
||||
}) async {
|
||||
final res = await CRUD().post(
|
||||
link: '$_base/enrollment/activate.php',
|
||||
payload: {'org_id': orgId.toString(), 'student_id': studentId},
|
||||
);
|
||||
|
||||
if (res is Map && res['status'] == 'success') {
|
||||
final msg = res['message'];
|
||||
if (msg is Map<String, dynamic>) {
|
||||
return TransitApiResult(
|
||||
true,
|
||||
TransitEnrollment.fromActivateResponse(msg, orgId),
|
||||
msg['message']?.toString() ?? 'تم',
|
||||
);
|
||||
}
|
||||
}
|
||||
return TransitApiResult(false, null, _errMsg(res));
|
||||
}
|
||||
|
||||
/// عضوياتي في كل المؤسسات
|
||||
static Future<TransitApiResult<List<TransitEnrollment>>>
|
||||
getMyEnrollments() async {
|
||||
final res = await CRUD().post(link: '$_base/enrollment/my_enrollments.php');
|
||||
|
||||
if (res is Map && res['status'] == 'success') {
|
||||
final msg = res['message'];
|
||||
final list = (msg is Map && msg['enrollments'] is List)
|
||||
? (msg['enrollments'] as List)
|
||||
.map((e) => TransitEnrollment(
|
||||
id: int.tryParse(e['id'].toString()) ?? 0,
|
||||
orgId: int.tryParse(e['org_id'].toString()) ?? 0,
|
||||
orgName: e['org_name']?.toString() ?? '',
|
||||
status: e['status']?.toString() ?? '',
|
||||
verifyMethod: e['verify_method']?.toString() ?? '',
|
||||
))
|
||||
.toList()
|
||||
: <TransitEnrollment>[];
|
||||
return TransitApiResult(true, list, 'ok');
|
||||
}
|
||||
return TransitApiResult(false, null, _errMsg(res));
|
||||
}
|
||||
|
||||
/// خطوط مؤسسة معيّنة (يشترط عضوية نشطة)
|
||||
static Future<TransitApiResult<List<TransitRouteSummary>>> getRoutesForOrg(
|
||||
int orgId) async {
|
||||
final res = await CRUD().post(
|
||||
link: '$_base/route/for_org.php',
|
||||
payload: {'org_id': orgId.toString()},
|
||||
);
|
||||
|
||||
if (res is Map && res['status'] == 'success') {
|
||||
final msg = res['message'];
|
||||
final list = (msg is Map && msg['routes'] is List)
|
||||
? (msg['routes'] as List)
|
||||
.map((r) => TransitRouteSummary.fromJson(
|
||||
Map<String, dynamic>.from(r)))
|
||||
.toList()
|
||||
: <TransitRouteSummary>[];
|
||||
return TransitApiResult(true, list, 'ok');
|
||||
}
|
||||
return TransitApiResult(false, null, _errMsg(res));
|
||||
}
|
||||
|
||||
/// تفاصيل الرحلة الحية لخط (المحطات + آخر موقع معروف)
|
||||
static Future<TransitApiResult<Map<String, dynamic>>> getLiveTrip({
|
||||
int? tripId,
|
||||
int? routeId,
|
||||
}) async {
|
||||
final payload = <String, dynamic>{};
|
||||
if (tripId != null) payload['trip_id'] = tripId.toString();
|
||||
if (routeId != null) payload['route_id'] = routeId.toString();
|
||||
|
||||
final res = await CRUD().post(link: '$_base/trip/live.php', payload: payload);
|
||||
|
||||
if (res is Map && res['status'] == 'success') {
|
||||
final msg = res['message'];
|
||||
if (msg is Map) return TransitApiResult(true, Map<String, dynamic>.from(msg), 'ok');
|
||||
}
|
||||
return TransitApiResult(false, null, _errMsg(res));
|
||||
}
|
||||
|
||||
static String _errMsg(dynamic res) {
|
||||
if (res == 'no_internet') return 'تحقق من اتصالك بالإنترنت';
|
||||
if (res == 'token_expired') return 'انتهت الجلسة، حاول مجدداً';
|
||||
if (res is Map && res['message'] is String) return res['message'];
|
||||
return 'حدث خطأ، حاول مجدداً';
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import '../HomePage/contact_us.dart';
|
||||
import '../HomePage/share_app_page.dart';
|
||||
import '../setting_page.dart';
|
||||
import '../profile/passenger_profile_page.dart';
|
||||
import '../../transit/transit_home_page.dart';
|
||||
|
||||
// ─── ألوان النظام (Integrated with AppColor) ──────────────────────────────────
|
||||
Color get _kCyan => AppColor.cyanBlue;
|
||||
@@ -148,6 +149,11 @@ class MapMenuWidget extends StatelessWidget {
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12, vertical: 4),
|
||||
children: [
|
||||
MenuListItem(
|
||||
title: 'Mawasalati'.tr,
|
||||
icon: Icons.directions_bus_filled_rounded,
|
||||
onTap: () => Get.to(() => const TransitHomePage()),
|
||||
),
|
||||
MenuListItem(
|
||||
title: 'My Balance'.tr,
|
||||
icon: Icons.account_balance_wallet_outlined,
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
// transit_home_page.dart — الصفحة الرئيسية لتبويب "مواصلاتي"
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/style.dart';
|
||||
import '../../controller/transit/transit_controller.dart';
|
||||
import '../../controller/transit/transit_models.dart';
|
||||
import '../widgets/my_scafold.dart';
|
||||
import 'transit_org_browse_page.dart';
|
||||
import 'transit_routes_page.dart';
|
||||
|
||||
class TransitHomePage extends StatelessWidget {
|
||||
const TransitHomePage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(TransitController());
|
||||
|
||||
return GetBuilder<TransitController>(
|
||||
builder: (c) => MyScafolld(
|
||||
title: 'Mawasalati'.tr,
|
||||
isleading: true,
|
||||
body: [
|
||||
Expanded(
|
||||
child: RefreshIndicator(
|
||||
onRefresh: c.fetchMyEnrollments,
|
||||
child: c.isLoadingEnrollments
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: c.myEnrollments.isEmpty
|
||||
? _emptyState(c)
|
||||
: ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
Text('My Memberships'.tr,
|
||||
style: AppStyle.headTitle2.copyWith(fontSize: 18)),
|
||||
const SizedBox(height: 12),
|
||||
...c.myEnrollments.map((e) => _enrollmentCard(e, c)),
|
||||
const SizedBox(height: 20),
|
||||
_addOrgTile(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _emptyState(TransitController c) {
|
||||
return ListView(
|
||||
padding: const EdgeInsets.all(24),
|
||||
children: [
|
||||
const SizedBox(height: 60),
|
||||
Icon(Icons.directions_bus_filled_outlined,
|
||||
size: 72, color: AppColor.grayColor),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'Not enrolled in any institution yet'.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppStyle.title.copyWith(fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Activate your membership in your university or institution to track your bus live'.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppStyle.subtitle.copyWith(color: AppColor.grayColor),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_addOrgTile(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _addOrgTile() {
|
||||
return Card(
|
||||
color: AppColor.cardColor,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
side: BorderSide(color: AppColor.borderColor),
|
||||
),
|
||||
child: ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: AppColor.accentColor.withOpacity(0.15),
|
||||
child: Icon(Icons.add, color: AppColor.accentColor),
|
||||
),
|
||||
title: Text('Join a new institution'.tr, style: AppStyle.title),
|
||||
subtitle: Text('University, school, or hotel'.tr, style: AppStyle.subtitle),
|
||||
trailing: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||
onTap: () => Get.to(() => const TransitOrgBrowsePage()),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _enrollmentCard(TransitEnrollment e, TransitController c) {
|
||||
Color statusColor;
|
||||
String statusText;
|
||||
switch (e.status) {
|
||||
case 'active':
|
||||
statusColor = AppColor.greenColor;
|
||||
statusText = 'Active'.tr;
|
||||
break;
|
||||
case 'pending':
|
||||
statusColor = AppColor.yellowColor;
|
||||
statusText = 'Pending Review'.tr;
|
||||
break;
|
||||
default:
|
||||
statusColor = AppColor.redColor;
|
||||
statusText = 'Suspended'.tr;
|
||||
}
|
||||
|
||||
return Card(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
color: AppColor.cardColor,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
side: BorderSide(color: AppColor.borderColor),
|
||||
),
|
||||
child: ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: AppColor.primaryColor.withOpacity(0.1),
|
||||
child: Icon(Icons.school_outlined, color: AppColor.primaryColor),
|
||||
),
|
||||
title: Text(e.orgName, style: AppStyle.title.copyWith(fontWeight: FontWeight.bold)),
|
||||
subtitle: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: BoxDecoration(color: statusColor, shape: BoxShape.circle),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(statusText, style: AppStyle.subtitle.copyWith(color: statusColor)),
|
||||
],
|
||||
),
|
||||
trailing: e.status == 'active' ? const Icon(Icons.arrow_forward_ios, size: 16) : null,
|
||||
onTap: e.status == 'active'
|
||||
? () => Get.to(() => TransitRoutesPage(orgId: e.orgId, orgName: e.orgName))
|
||||
: null,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
// transit_live_map_page.dart — تتبع الباص الحي على الخريطة
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intaleq_maps/intaleq_maps.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/style.dart';
|
||||
import '../../env/env.dart';
|
||||
import '../../controller/transit/transit_controller.dart';
|
||||
import '../widgets/my_scafold.dart';
|
||||
|
||||
class TransitLiveMapPage extends StatefulWidget {
|
||||
final int routeId;
|
||||
final String routeName;
|
||||
const TransitLiveMapPage({super.key, required this.routeId, required this.routeName});
|
||||
|
||||
@override
|
||||
State<TransitLiveMapPage> createState() => _TransitLiveMapPageState();
|
||||
}
|
||||
|
||||
class _TransitLiveMapPageState extends State<TransitLiveMapPage> {
|
||||
IntaleqMapController? _mapController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
Get.find<TransitController>().openLiveRoute(widget.routeId);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
Get.find<TransitController>().closeLiveRoute();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<TransitController>(
|
||||
builder: (c) {
|
||||
final stops = (c.liveTripData?['stops'] is List)
|
||||
? List<Map>.from(c.liveTripData!['stops'])
|
||||
: <Map>[];
|
||||
|
||||
final markers = <Marker>{};
|
||||
|
||||
for (final s in stops) {
|
||||
final lat = double.tryParse(s['latitude']?.toString() ?? '') ?? 0;
|
||||
final lng = double.tryParse(s['longitude']?.toString() ?? '') ?? 0;
|
||||
if (lat == 0 && lng == 0) continue;
|
||||
markers.add(Marker(
|
||||
markerId: MarkerId('stop_${s['id']}'),
|
||||
position: LatLng(lat, lng),
|
||||
infoWindow: InfoWindow(title: s['name_ar']?.toString() ?? ''),
|
||||
icon: InlqBitmap.defaultMarkerWithHue(
|
||||
(s['is_major']?.toString() ?? '0') == '1' ? 30 : 200),
|
||||
));
|
||||
}
|
||||
|
||||
LatLng? busLatLng;
|
||||
if (c.liveBusPosition != null) {
|
||||
busLatLng = LatLng(c.liveBusPosition!.lat, c.liveBusPosition!.lng);
|
||||
markers.add(Marker(
|
||||
markerId: const MarkerId('bus'),
|
||||
position: busLatLng,
|
||||
rotation: c.liveBusPosition!.heading,
|
||||
anchor: const Offset(0.5, 0.5),
|
||||
icon: InlqBitmap.defaultMarkerWithHue(120),
|
||||
));
|
||||
if (_mapController != null) {
|
||||
_mapController!.animateCamera(CameraUpdate.newLatLng(busLatLng));
|
||||
}
|
||||
}
|
||||
|
||||
final initialTarget = busLatLng ??
|
||||
(markers.isNotEmpty ? markers.first.position : const LatLng(31.95, 35.93));
|
||||
|
||||
return MyScafolld(
|
||||
title: widget.routeName,
|
||||
isleading: true,
|
||||
body: [
|
||||
Expanded(
|
||||
child: Stack(
|
||||
children: [
|
||||
IntaleqMap(
|
||||
apiKey: Env.mapSaasKey,
|
||||
initialCameraPosition: CameraPosition(target: initialTarget, zoom: 14),
|
||||
markers: markers,
|
||||
onMapCreated: (ctrl) => _mapController = ctrl,
|
||||
),
|
||||
if (c.isLoadingLiveTrip)
|
||||
const Positioned.fill(
|
||||
child: ColoredBox(
|
||||
color: Colors.black12,
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
),
|
||||
),
|
||||
if (!c.isLoadingLiveTrip && c.liveError.isNotEmpty)
|
||||
Positioned(
|
||||
top: 16,
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: _statusBanner(c.liveError, AppColor.redColor),
|
||||
),
|
||||
if (!c.isLoadingLiveTrip &&
|
||||
c.liveError.isEmpty &&
|
||||
c.liveBusPosition == null)
|
||||
Positioned(
|
||||
top: 16,
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: _statusBanner(
|
||||
'No bus running on this route right now'.tr, AppColor.yellowColor),
|
||||
),
|
||||
if (c.liveTripData?['trip']?['delay_minutes'] != null &&
|
||||
(int.tryParse(c.liveTripData!['trip']['delay_minutes'].toString()) ?? 0) > 0)
|
||||
Positioned(
|
||||
bottom: 24,
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: _statusBanner(
|
||||
'${'Bus is delayed'.tr} ${c.liveTripData!['trip']['delay_minutes']} ${'min'.tr}',
|
||||
AppColor.yellowColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _statusBanner(String text, Color color) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.cardColor,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border(right: BorderSide(color: color, width: 4)),
|
||||
boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 6)],
|
||||
),
|
||||
child: Text(text, style: AppStyle.title.copyWith(color: color, fontWeight: FontWeight.bold)),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
// transit_org_browse_page.dart — تصفح المؤسسات + تفعيل عضوية بالرقم الجامعي
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/style.dart';
|
||||
import '../../controller/transit/transit_controller.dart';
|
||||
import '../../controller/transit/transit_models.dart';
|
||||
import '../widgets/elevated_btn.dart';
|
||||
import '../widgets/my_scafold.dart';
|
||||
|
||||
class TransitOrgBrowsePage extends StatefulWidget {
|
||||
const TransitOrgBrowsePage({super.key});
|
||||
|
||||
@override
|
||||
State<TransitOrgBrowsePage> createState() => _TransitOrgBrowsePageState();
|
||||
}
|
||||
|
||||
class _TransitOrgBrowsePageState extends State<TransitOrgBrowsePage> {
|
||||
final _searchCtrl = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
Get.find<TransitController>().browseOrgs();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<TransitController>(
|
||||
builder: (c) => MyScafolld(
|
||||
title: 'Choose your institution'.tr,
|
||||
isleading: true,
|
||||
body: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: TextField(
|
||||
controller: _searchCtrl,
|
||||
onSubmitted: (v) => c.browseOrgs(search: v),
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Search for a university or institution...'.tr,
|
||||
prefixIcon: const Icon(Icons.search),
|
||||
filled: true,
|
||||
fillColor: AppColor.cardColor,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: AppColor.borderColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: c.isLoadingOrgs
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: c.browsableOrgs.isEmpty
|
||||
? Center(
|
||||
child: Text('No results'.tr, style: AppStyle.title),
|
||||
)
|
||||
: ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
itemCount: c.browsableOrgs.length,
|
||||
itemBuilder: (_, i) {
|
||||
final org = c.browsableOrgs[i];
|
||||
return Card(
|
||||
margin: const EdgeInsets.only(bottom: 10),
|
||||
color: AppColor.cardColor,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
side: BorderSide(color: AppColor.borderColor),
|
||||
),
|
||||
child: ListTile(
|
||||
title: Text(org.nameAr, style: AppStyle.title),
|
||||
subtitle: Text(org.city, style: AppStyle.subtitle),
|
||||
trailing: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||
onTap: () => _showActivateSheet(context, c, org),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showActivateSheet(BuildContext context, TransitController c, TransitOrg org) {
|
||||
final idCtrl = TextEditingController();
|
||||
bool loading = false;
|
||||
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: AppColor.cardColor,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
||||
),
|
||||
builder: (ctx) => StatefulBuilder(
|
||||
builder: (ctx, setState) => Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 20,
|
||||
right: 20,
|
||||
top: 20,
|
||||
bottom: MediaQuery.of(ctx).viewInsets.bottom + 20,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(org.nameAr, style: AppStyle.headTitle2.copyWith(fontSize: 18)),
|
||||
const SizedBox(height: 6),
|
||||
Text('Enter your student/employee ID to activate membership'.tr,
|
||||
style: AppStyle.subtitle),
|
||||
const SizedBox(height: 16),
|
||||
TextField(
|
||||
controller: idCtrl,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Student ID'.tr,
|
||||
filled: true,
|
||||
fillColor: AppColor.secondaryColor,
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
MyElevatedButton(
|
||||
title: 'Activate'.tr,
|
||||
isLoading: loading,
|
||||
onPressed: () async {
|
||||
if (idCtrl.text.trim().isEmpty) return;
|
||||
setState(() => loading = true);
|
||||
final ok = await c.activateEnrollment(org.id, idCtrl.text.trim());
|
||||
setState(() => loading = false);
|
||||
if (ok && ctx.mounted) {
|
||||
Navigator.pop(ctx);
|
||||
Get.back(); // العودة للصفحة الرئيسية لمواصلاتي
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
// transit_routes_page.dart — خطوط مؤسسة الراكب
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/style.dart';
|
||||
import '../../controller/transit/transit_controller.dart';
|
||||
import '../widgets/my_scafold.dart';
|
||||
import 'transit_live_map_page.dart';
|
||||
|
||||
class TransitRoutesPage extends StatefulWidget {
|
||||
final int orgId;
|
||||
final String orgName;
|
||||
const TransitRoutesPage({super.key, required this.orgId, required this.orgName});
|
||||
|
||||
@override
|
||||
State<TransitRoutesPage> createState() => _TransitRoutesPageState();
|
||||
}
|
||||
|
||||
class _TransitRoutesPageState extends State<TransitRoutesPage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
Get.find<TransitController>().openOrgRoutes(widget.orgId);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<TransitController>(
|
||||
builder: (c) => MyScafolld(
|
||||
title: widget.orgName,
|
||||
isleading: true,
|
||||
body: [
|
||||
Expanded(
|
||||
child: c.isLoadingRoutes
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: c.currentOrgRoutes.isEmpty
|
||||
? Center(
|
||||
child: Text('No active routes currently'.tr, style: AppStyle.title),
|
||||
)
|
||||
: ListView.builder(
|
||||
padding: const EdgeInsets.all(16),
|
||||
itemCount: c.currentOrgRoutes.length,
|
||||
itemBuilder: (_, i) {
|
||||
final r = c.currentOrgRoutes[i];
|
||||
return Card(
|
||||
margin: const EdgeInsets.only(bottom: 10),
|
||||
color: AppColor.cardColor,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
side: BorderSide(color: AppColor.borderColor),
|
||||
),
|
||||
child: ListTile(
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: AppColor.accentColor.withOpacity(0.15),
|
||||
child: Icon(Icons.directions_bus, color: AppColor.accentColor),
|
||||
),
|
||||
title: Text(r.nameAr, style: AppStyle.title),
|
||||
subtitle: Text('${r.stopCount} ${'Stops'.tr}', style: AppStyle.subtitle),
|
||||
trailing: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||
onTap: () => Get.to(
|
||||
() => TransitLiveMapPage(routeId: r.id, routeName: r.nameAr),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user