Update: 2026-07-02 15:35:12
This commit is contained in:
@@ -249,6 +249,12 @@ class AppLink {
|
||||
"$endPoint/ride/gamification/getGamificationDashboard.php";
|
||||
static String get getLeaderboard =>
|
||||
"$endPoint/ride/gamification/getLeaderboard.php";
|
||||
static String get getSubAdminForDriver =>
|
||||
"$serverName/Admin/gamification/getSubAdminForDriver.php";
|
||||
|
||||
// 🆕 مسار جلب حالة تتابع الرحلات (Gamification Streak)
|
||||
static String get getDriverStreak =>
|
||||
"$serverName/ride/gamification/get_streak.php";
|
||||
static String get claimChallengeReward =>
|
||||
"$endPoint/ride/gamification/claimChallengeReward.php";
|
||||
static String get getReferralStats =>
|
||||
|
||||
@@ -802,6 +802,9 @@ class HomeCaptainController extends GetxController {
|
||||
calculateConsumptionFuel() {
|
||||
mpg = fuelPrice / 12; //todo in register car add mpg in box
|
||||
}
|
||||
// 🆕 Gamification Streak State
|
||||
int streakCount = 0;
|
||||
bool isZeroCommissionActive = false;
|
||||
|
||||
getCountRideToday() async {
|
||||
var res = await CRUD().get(
|
||||
@@ -811,6 +814,24 @@ class HomeCaptainController extends GetxController {
|
||||
|
||||
countRideToday = data['message'][0]['count'].toString();
|
||||
update();
|
||||
|
||||
// Fetch Gamification Streak as well
|
||||
getDriverStreak();
|
||||
}
|
||||
|
||||
// 🆕 Fetch Driver Streak
|
||||
getDriverStreak() async {
|
||||
var res = await CRUD().get(
|
||||
link: AppLink.getDriverStreak,
|
||||
payload: {'driver_id': box.read(BoxName.driverID).toString()});
|
||||
if (res != 'failure') {
|
||||
var decode = jsonDecode(res);
|
||||
if (decode['status'] == 'success') {
|
||||
streakCount = decode['message']['streak_count'] ?? 0;
|
||||
isZeroCommissionActive = decode['message']['is_zero_commission_active'] ?? false;
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getDriverRate() async {
|
||||
|
||||
@@ -222,6 +222,15 @@ class _HomeAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
// ── Gamification Streak Badge ────────
|
||||
GetBuilder<HomeCaptainController>(
|
||||
builder: (c) => _PillBadge(
|
||||
icon: Icons.local_fire_department_rounded,
|
||||
label: c.isZeroCommissionActive ? 'Free!' : '${c.streakCount}/5',
|
||||
color: c.isZeroCommissionActive ? _Token.success : Colors.orange,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
// ── Refuse Counter ───────────────────
|
||||
GetBuilder<HomeCaptainController>(
|
||||
builder: (c) => _PillBadge(
|
||||
@@ -310,7 +319,7 @@ class _AppBarControls extends StatelessWidget {
|
||||
// Heatmap
|
||||
GetBuilder<HomeCaptainController>(
|
||||
builder: (c) => _IconBtn(
|
||||
icon: Icons.local_fire_department_rounded,
|
||||
icon: Icons.layers_rounded,
|
||||
color:
|
||||
c.isHeatmapVisible ? Colors.orange : Colors.grey.shade600,
|
||||
tooltip: 'Heatmap'.tr,
|
||||
|
||||
Reference in New Issue
Block a user