Update: 2026-07-12 06:04:42
This commit is contained in:
@@ -32,7 +32,8 @@ class HomeCaptainController extends GetxController {
|
|||||||
Timer? activeTimer;
|
Timer? activeTimer;
|
||||||
Map data = {};
|
Map data = {};
|
||||||
bool isHomeMapActive = true;
|
bool isHomeMapActive = true;
|
||||||
InlqBitmap carIcon = InlqBitmap.fromAsset('assets/images/car.png', size: 2.3);
|
InlqBitmap carIcon =
|
||||||
|
InlqBitmap.fromStyleImage('car_icon', size: 2.3);
|
||||||
bool isMapReadyForCommands = false;
|
bool isMapReadyForCommands = false;
|
||||||
bool isLoading = true;
|
bool isLoading = true;
|
||||||
late double kazan = 0;
|
late double kazan = 0;
|
||||||
@@ -262,13 +263,13 @@ class HomeCaptainController extends GetxController {
|
|||||||
final Set<Polygon> temp = {};
|
final Set<Polygon> temp = {};
|
||||||
|
|
||||||
for (final zone in zones) {
|
for (final zone in zones) {
|
||||||
final double lat = (zone['lat'] as num).toDouble();
|
final double lat = (zone['lat'] as num).toDouble();
|
||||||
final double lng = (zone['lng'] as num).toDouble();
|
final double lng = (zone['lng'] as num).toDouble();
|
||||||
final int score = (zone['demand_score'] as num).toInt();
|
final int score = (zone['demand_score'] as num).toInt();
|
||||||
|
|
||||||
// ألوان التنبؤ: أزرق/سماوي (مختلف تماماً عن الهيتماب)
|
// ألوان التنبؤ: أزرق/سماوي (مختلف تماماً عن الهيتماب)
|
||||||
final Color fill = score >= 8
|
final Color fill = score >= 8
|
||||||
? const Color(0xFF0EA5E9).withOpacity(0.35) // أزرق قوي
|
? const Color(0xFF0EA5E9).withOpacity(0.35) // أزرق قوي
|
||||||
: score >= 4
|
: score >= 4
|
||||||
? const Color(0xFF38BDF8).withOpacity(0.30) // أزرق فاتح
|
? const Color(0xFF38BDF8).withOpacity(0.30) // أزرق فاتح
|
||||||
: const Color(0xFF7DD3FC).withOpacity(0.25); // سماوي خفيف
|
: const Color(0xFF7DD3FC).withOpacity(0.25); // سماوي خفيف
|
||||||
@@ -285,7 +286,7 @@ class HomeCaptainController extends GetxController {
|
|||||||
LatLng(lat + offset, lng + offset),
|
LatLng(lat + offset, lng + offset),
|
||||||
LatLng(lat - offset, lng + offset),
|
LatLng(lat - offset, lng + offset),
|
||||||
],
|
],
|
||||||
fillColor: fill,
|
fillColor: fill,
|
||||||
strokeColor: stroke,
|
strokeColor: stroke,
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
));
|
));
|
||||||
@@ -641,6 +642,19 @@ class HomeCaptainController extends GetxController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> onStyleLoaded() async {
|
||||||
|
print("🎨 [HomeCaptain] onStyleLoaded");
|
||||||
|
try {
|
||||||
|
final ByteData bytes = await rootBundle.load('assets/images/car.png');
|
||||||
|
await mapHomeCaptainController?.addImage(
|
||||||
|
'car_icon', bytes.buffer.asUint8List());
|
||||||
|
carIcon = InlqBitmap.fromStyleImage('car_icon', size: 2.3);
|
||||||
|
update();
|
||||||
|
} catch (e) {
|
||||||
|
print("❌ [HomeCaptain] Map icon load error: $e");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void savePeriod(Duration period) {
|
void savePeriod(Duration period) {
|
||||||
final periods = box.read<List<dynamic>>(BoxName.periods) ?? [];
|
final periods = box.read<List<dynamic>>(BoxName.periods) ?? [];
|
||||||
periods.add(period.inSeconds);
|
periods.add(period.inSeconds);
|
||||||
@@ -737,11 +751,13 @@ class HomeCaptainController extends GetxController {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
const Icon(Icons.location_off, size: 60, color: Colors.redAccent),
|
const Icon(Icons.location_off,
|
||||||
|
size: 60, color: Colors.redAccent),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
Text(
|
Text(
|
||||||
'service_unavailable_area'.tr,
|
'service_unavailable_area'.tr,
|
||||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
style: const TextStyle(
|
||||||
|
fontSize: 18, fontWeight: FontWeight.bold),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
@@ -752,7 +768,6 @@ class HomeCaptainController extends GetxController {
|
|||||||
enableDrag: false,
|
enableDrag: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
print(
|
print(
|
||||||
"⚠️ [HomeCaptain] Could not get current location, using default.");
|
"⚠️ [HomeCaptain] Could not get current location, using default.");
|
||||||
@@ -899,20 +914,22 @@ class HomeCaptainController extends GetxController {
|
|||||||
var json = jsonDecode(res);
|
var json = jsonDecode(res);
|
||||||
if (json['message'] is List && json['message'].isNotEmpty) {
|
if (json['message'] is List && json['message'].isNotEmpty) {
|
||||||
final item = json['message'][0];
|
final item = json['message'][0];
|
||||||
|
|
||||||
double parseDouble(dynamic val) {
|
double parseDouble(dynamic val) {
|
||||||
if (val == null) return 0.0;
|
if (val == null) return 0.0;
|
||||||
return double.tryParse(val.toString()) ?? 0.0;
|
return double.tryParse(val.toString()) ?? 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
kazan = parseDouble(item['kazanPercent'] ?? item['kazan']);
|
kazan = parseDouble(item['kazanPercent'] ?? item['kazan']);
|
||||||
naturePrice = parseDouble(item['normalMinPrice'] ?? item['naturePrice']);
|
naturePrice =
|
||||||
|
parseDouble(item['normalMinPrice'] ?? item['naturePrice']);
|
||||||
heavyPrice = parseDouble(item['peakMinPrice'] ?? item['heavyPrice']);
|
heavyPrice = parseDouble(item['peakMinPrice'] ?? item['heavyPrice']);
|
||||||
latePrice = parseDouble(item['lateMinPrice'] ?? item['latePrice']);
|
latePrice = parseDouble(item['lateMinPrice'] ?? item['latePrice']);
|
||||||
comfortPrice = parseDouble(item['comfortPrice']);
|
comfortPrice = parseDouble(item['comfortPrice']);
|
||||||
speedPrice = parseDouble(item['speedPrice']);
|
speedPrice = parseDouble(item['speedPrice']);
|
||||||
deliveryPrice = parseDouble(item['deliveryPrice']);
|
deliveryPrice = parseDouble(item['deliveryPrice']);
|
||||||
mashwariPrice = parseDouble(item['freePrice'] ?? item['mishwarVipPrice']);
|
mashwariPrice =
|
||||||
|
parseDouble(item['freePrice'] ?? item['mishwarVipPrice']);
|
||||||
familyPrice = parseDouble(item['familyPrice'] ?? item['ladyPrice']);
|
familyPrice = parseDouble(item['familyPrice'] ?? item['ladyPrice']);
|
||||||
fuelPrice = parseDouble(item['fuelPrice']);
|
fuelPrice = parseDouble(item['fuelPrice']);
|
||||||
}
|
}
|
||||||
@@ -927,6 +944,7 @@ class HomeCaptainController extends GetxController {
|
|||||||
calculateConsumptionFuel() {
|
calculateConsumptionFuel() {
|
||||||
mpg = fuelPrice / 12; //todo in register car add mpg in box
|
mpg = fuelPrice / 12; //todo in register car add mpg in box
|
||||||
}
|
}
|
||||||
|
|
||||||
// 🆕 Gamification Streak State
|
// 🆕 Gamification Streak State
|
||||||
int streakCount = 0;
|
int streakCount = 0;
|
||||||
bool isZeroCommissionActive = false;
|
bool isZeroCommissionActive = false;
|
||||||
@@ -939,7 +957,7 @@ class HomeCaptainController extends GetxController {
|
|||||||
|
|
||||||
countRideToday = data['message'][0]['count'].toString();
|
countRideToday = data['message'][0]['count'].toString();
|
||||||
update();
|
update();
|
||||||
|
|
||||||
// Fetch Gamification Streak as well
|
// Fetch Gamification Streak as well
|
||||||
getDriverStreak();
|
getDriverStreak();
|
||||||
}
|
}
|
||||||
@@ -953,7 +971,8 @@ class HomeCaptainController extends GetxController {
|
|||||||
var decode = jsonDecode(res);
|
var decode = jsonDecode(res);
|
||||||
if (decode['status'] == 'success') {
|
if (decode['status'] == 'success') {
|
||||||
streakCount = decode['message']['streak_count'] ?? 0;
|
streakCount = decode['message']['streak_count'] ?? 0;
|
||||||
isZeroCommissionActive = decode['message']['is_zero_commission_active'] ?? false;
|
isZeroCommissionActive =
|
||||||
|
decode['message']['is_zero_commission_active'] ?? false;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ class NavigationView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
|
|
||||||
// ── 11. Navigation Icon (Fixed Center) ────────────────────────
|
// ── 11. Navigation Icon (Fixed Center) ────────────────────────
|
||||||
if (c.isNavigating) const _NavigationCenterIcon(),
|
// Removed _NavigationCenterIcon as per user request
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -134,43 +134,7 @@ class NavigationView extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _NavigationCenterIcon extends StatelessWidget {
|
// _NavigationCenterIcon removed
|
||||||
const _NavigationCenterIcon({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return IgnorePointer(
|
|
||||||
child: Center(
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: _kPrimary,
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: Colors.black.withOpacity(0.3),
|
|
||||||
blurRadius: 12,
|
|
||||||
offset: const Offset(0, 4),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
border: Border.all(color: Colors.white, width: 3),
|
|
||||||
),
|
|
||||||
padding: const EdgeInsets.all(12),
|
|
||||||
child: const Icon(
|
|
||||||
Icons.navigation_rounded,
|
|
||||||
color: Colors.white,
|
|
||||||
size: 32,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 40),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ExploreTopUI extends StatelessWidget {
|
class _ExploreTopUI extends StatelessWidget {
|
||||||
final NavigationController controller;
|
final NavigationController controller;
|
||||||
|
|||||||
@@ -209,13 +209,16 @@ class _HomeAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
children: [
|
children: [
|
||||||
_LogoBadge(),
|
_LogoBadge(),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Text(
|
Expanded(
|
||||||
AppInformation.appName.split(' ')[0].tr,
|
child: Text(
|
||||||
style: const TextStyle(
|
AppInformation.appName.split(' ')[0].tr,
|
||||||
color: _Token.accent,
|
style: const TextStyle(
|
||||||
fontSize: 20,
|
color: _Token.accent,
|
||||||
fontWeight: FontWeight.w800,
|
fontSize: 20,
|
||||||
letterSpacing: 0.8,
|
fontWeight: FontWeight.w800,
|
||||||
|
letterSpacing: 0.8,
|
||||||
|
),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -423,6 +426,7 @@ class _MapView extends StatelessWidget {
|
|||||||
builder: (loc) => IntaleqMap(
|
builder: (loc) => IntaleqMap(
|
||||||
apiKey: Env.mapSaasKey,
|
apiKey: Env.mapSaasKey,
|
||||||
onMapCreated: ctrl.onMapCreated,
|
onMapCreated: ctrl.onMapCreated,
|
||||||
|
onStyleLoaded: ctrl.onStyleLoaded,
|
||||||
minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
|
minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
|
||||||
initialCameraPosition: CameraPosition(
|
initialCameraPosition: CameraPosition(
|
||||||
target: (loc.myLocation.latitude == 0 ||
|
target: (loc.myLocation.latitude == 0 ||
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class TransitDriverHomePage extends StatelessWidget {
|
|||||||
return MyScafolld(
|
return MyScafolld(
|
||||||
title: 'Mawasalati'.tr,
|
title: 'Mawasalati'.tr,
|
||||||
isleading: true,
|
isleading: true,
|
||||||
body: const [Expanded(child: Center(child: CircularProgressIndicator()))],
|
body: const [Column(children: [Expanded(child: Center(child: CircularProgressIndicator()))])],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,17 +31,21 @@ class TransitDriverHomePage extends StatelessWidget {
|
|||||||
title: 'Mawasalati'.tr,
|
title: 'Mawasalati'.tr,
|
||||||
isleading: true,
|
isleading: true,
|
||||||
body: [
|
body: [
|
||||||
Expanded(
|
Column(
|
||||||
child: Center(
|
children: [
|
||||||
child: Padding(
|
Expanded(
|
||||||
padding: const EdgeInsets.all(24),
|
child: Center(
|
||||||
child: Text(
|
child: Padding(
|
||||||
'This account is not registered as a bus driver in any institution'.tr,
|
padding: const EdgeInsets.all(24),
|
||||||
textAlign: TextAlign.center,
|
child: Text(
|
||||||
style: AppStyle.title,
|
'This account is not registered as a bus driver in any institution'.tr,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -51,26 +55,30 @@ class TransitDriverHomePage extends StatelessWidget {
|
|||||||
title: c.orgName,
|
title: c.orgName,
|
||||||
isleading: true,
|
isleading: true,
|
||||||
body: [
|
body: [
|
||||||
Expanded(
|
Column(
|
||||||
child: RefreshIndicator(
|
children: [
|
||||||
onRefresh: c.fetchTodayTrips,
|
Expanded(
|
||||||
child: c.isLoadingTrips
|
child: RefreshIndicator(
|
||||||
? const Center(child: CircularProgressIndicator())
|
onRefresh: c.fetchTodayTrips,
|
||||||
: c.todayTrips.isEmpty
|
child: c.isLoadingTrips
|
||||||
? ListView(
|
? const Center(child: CircularProgressIndicator())
|
||||||
children: [
|
: c.todayTrips.isEmpty
|
||||||
const SizedBox(height: 80),
|
? ListView(
|
||||||
Center(
|
children: [
|
||||||
child: Text('No trips today'.tr, style: AppStyle.title),
|
const SizedBox(height: 80),
|
||||||
|
Center(
|
||||||
|
child: Text('No trips today'.tr, style: AppStyle.title),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: ListView.builder(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
itemCount: c.todayTrips.length,
|
||||||
|
itemBuilder: (_, i) => _tripCard(c, c.todayTrips[i]),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
)
|
),
|
||||||
: ListView.builder(
|
],
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
itemCount: c.todayTrips.length,
|
|
||||||
itemBuilder: (_, i) => _tripCard(c, c.todayTrips[i]),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user