Update: 2026-06-10 02:44:54
This commit is contained in:
@@ -51,6 +51,7 @@ class BoxName {
|
||||
static const String package = "package";
|
||||
static const String isInstall = "isInstall";
|
||||
static const String isGiftToken = "isGiftToken";
|
||||
static const String isClaim = "isClaim";
|
||||
static const String inviteCode = "inviteCode";
|
||||
static const String phoneWallet = "phoneWallet";
|
||||
static const String phoneDriver = "phoneDriver";
|
||||
|
||||
@@ -4,63 +4,31 @@ import 'package:get/get.dart';
|
||||
/// The palette is professionally designed to be modern, cohesive, and culturally
|
||||
/// relevant, inspired by the Syrian flag and the app's brand identity.
|
||||
class AppColor {
|
||||
// --- Core Brand Colors (Inspired by the Syrian Flag) ---
|
||||
// --- Core Brand Colors ---
|
||||
static const Color primaryColor = Color(0xFF1A2340); // Navy Blue
|
||||
static const Color secondaryColorStatic = Color(0xFF8C9CF8); // Periwinkle Blue
|
||||
static const Color accentColor = Color(0xFF8C9CF8);
|
||||
|
||||
/// **Primary Color:** The brand's signature Twitter Blue representing trust and modern communication.
|
||||
/// Ideal for app bars, primary buttons, and major UI elements.
|
||||
static const Color primaryColor = Color(0xFF1DA1F2);
|
||||
|
||||
/// **Text/Write Color:** A very dark, near-black color for main text.
|
||||
/// It's softer on the eyes than pure black, improving readability.
|
||||
/// The variable name `writeColor` is kept as requested.
|
||||
static Color get writeColor => Get.isDarkMode ? Colors.white : const Color(0xFF1A1A1A);
|
||||
|
||||
/// **Secondary Color:** Pure white, used for backgrounds to create a clean
|
||||
/// and spacious look, ensuring content stands out.
|
||||
static Color get secondaryColor => Get.isDarkMode ? const Color(0xFF1E1E1E) : Colors.white;
|
||||
|
||||
/// **Accent Color:** A vibrant, energetic red from the Syrian flag.
|
||||
/// Perfect for calls-to-action, highlights, icons, and notifications.
|
||||
static const Color accentColor = Color.fromARGB(255, 148, 140, 141);
|
||||
// --- Dynamic Colors (Light / Dark Mode Support) ---
|
||||
static Color get writeColor => Get.isDarkMode ? Colors.white : const Color(0xFF0F172A); // Primary Text
|
||||
static Color get secondaryColor => Get.isDarkMode ? const Color(0xFF1E1E1E) : const Color(0xFFF8FAFC); // Background
|
||||
static Color get cardColor => Get.isDarkMode ? const Color(0xFF2C2C2E) : const Color(0xFFFFFFFF); // Card Background
|
||||
|
||||
// --- Neutral & Status Colors ---
|
||||
static Color get grayColor => Get.isDarkMode ? Colors.grey[400]! : const Color(0xFF64748B); // Secondary Text
|
||||
static Color get borderColor => Get.isDarkMode ? const Color(0xFF3A3A3C) : const Color(0xFFE2E8F0); // Border
|
||||
|
||||
/// **Grey Color:** A neutral grey for secondary text, borders, dividers,
|
||||
/// and disabled states.
|
||||
static Color get grayColor => Get.isDarkMode ? Colors.grey[400]! : const Color(0xFF8E8E93);
|
||||
static const Color redColor = Color(0xFFEF4444); // Error
|
||||
static const Color greenColor = Color(0xFF22C55E); // Success
|
||||
static const Color yellowColor = Color(0xFFF59E0B); // Warning
|
||||
|
||||
/// **Red Color (Error):** A clear, attention-grabbing red for error messages and alerts.
|
||||
static const Color redColor = Color(0xFFD32F2F);
|
||||
|
||||
/// **Green Color (Success):** A positive green for success messages and confirmations.
|
||||
static const Color greenColor = Color(0xFF388E3C);
|
||||
|
||||
/// **Blue Color (Info):** A standard blue for informational text, links, or icons.
|
||||
static const Color blueColor = Color(0xFF108942);
|
||||
|
||||
/// **Yellow Color (Warning):** A warm yellow for warning messages or important highlights.
|
||||
static const Color yellowColor = Color(0xFFFFA000);
|
||||
|
||||
// --- Tier & Social Colors ---
|
||||
|
||||
/// **Gold Tier:** A bright gold for premium features, user ranks, or rewards.
|
||||
// --- Legacy / Maps Colors (Kept for compatibility) ---
|
||||
static const Color blueColor = Color(0xFF1A2340);
|
||||
static const Color gold = Color(0xFFFFD700);
|
||||
|
||||
/// **Bronze Tiers:** Classic bronze colors for other user tiers or levels.
|
||||
static const Color bronze = Color(0xFFCD7F32);
|
||||
static const Color goldenBronze = Color(0xFFB87333); // Kept from original
|
||||
|
||||
/// **Twitter/X Color:** The official brand color for social login buttons.
|
||||
|
||||
/// **Twitter Blue:** The brand's signature blue color used for the drawer,
|
||||
/// menu icons, and secondary actions (formerly Cyan Blue).
|
||||
static Color get cyanBlue => const Color(0xFF1DA1F2);
|
||||
|
||||
/// **Blue Accent:** A softer, translucent version of the brand blue.
|
||||
static Color get cyanAccent => const Color(0xFF1DA1F2).withOpacity(0.12);
|
||||
|
||||
// --- Utility Colors ---
|
||||
|
||||
/// **Accent Tint:** A transparent version of the red accent color.
|
||||
static Color get deepPurpleAccent => const Color(0xFFCE1126).withOpacity(0.1);
|
||||
static const Color goldenBronze = Color(0xFFB87333);
|
||||
|
||||
static Color get cyanBlue => const Color(0xFF1A2340);
|
||||
static Color get cyanAccent => const Color(0xFF1A2340).withOpacity(0.12);
|
||||
static Color get deepPurpleAccent => const Color(0xFF8C9CF8).withOpacity(0.1);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:siro_rider/constant/box_name.dart';
|
||||
import 'package:siro_rider/main.dart';
|
||||
|
||||
class AppLink {
|
||||
static const String appDomain = 'siromove.com';
|
||||
///https://walletintaleq.intaleq.xyz/v1/main
|
||||
static String paymentServer = 'https://walletintaleq.intaleq.xyz/v2/main';
|
||||
|
||||
@@ -177,7 +178,9 @@ class AppLink {
|
||||
static String deleteNotificationCaptain =
|
||||
"$server/ride/notificationCaptain/delete.php";
|
||||
//-----------------invitor------------------
|
||||
|
||||
static String getUnifiedCode = "$server/ride/invitor/get_unified_code.php";
|
||||
static String addUnifiedInvite = "$server/ride/invitor/add_unified_invite.php";
|
||||
static String getPassengerReferrals = "$server/ride/invitor/get_passenger_referrals.php";
|
||||
static String addInviteDriver = "$server/ride/invitor/add.php";
|
||||
static String addInvitationPassenger =
|
||||
"$server/ride/invitor/addInvitationPassenger.php";
|
||||
|
||||
@@ -308,6 +308,7 @@ class LoginController extends GetxController {
|
||||
box.write(BoxName.validity, data['validity']);
|
||||
box.write(BoxName.isInstall, data['isInstall'] ?? 'none');
|
||||
box.write(BoxName.isGiftToken, data['isGiftToken'] ?? 'none');
|
||||
box.write(BoxName.isClaim, data['isClaim'] ?? '0');
|
||||
if (data['inviteCode'] != null) {
|
||||
box.write(BoxName.inviteCode, data['inviteCode'].toString());
|
||||
}
|
||||
@@ -384,6 +385,15 @@ class LoginController extends GetxController {
|
||||
"inviteCode": invite,
|
||||
"passengerID": passengerID,
|
||||
});
|
||||
|
||||
// سجل الدعوة أيضاً في النظام الموحد الجديد
|
||||
await CRUD().post(link: AppLink.addUnifiedInvite, payload: {
|
||||
"inviter_code": invite,
|
||||
});
|
||||
|
||||
// تحديث الحالة محلياً لضمان عدم إرسال الطلب مرة أخرى
|
||||
box.write(BoxName.isInstall, '1');
|
||||
|
||||
await Get.defaultDialog(
|
||||
title: 'Invitation Used'.tr,
|
||||
middleText: "Your invite code was successfully applied!".tr,
|
||||
|
||||
@@ -2,6 +2,8 @@ import 'package:siro_rider/print.dart';
|
||||
import 'dart:async';
|
||||
import 'package:app_links/app_links.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../main.dart';
|
||||
import 'profile/invites_rewards_controller.dart';
|
||||
|
||||
class DeepLinkController extends GetxController {
|
||||
final _appLinks = AppLinks();
|
||||
@@ -21,6 +23,7 @@ class DeepLinkController extends GetxController {
|
||||
_linkSubscription = _appLinks.uriLinkStream.listen((uri) {
|
||||
Log.print('🔗 Received deep link (Stream): $uri');
|
||||
rawDeepLink.value = uri.toString();
|
||||
_processInviteCode(uri);
|
||||
});
|
||||
|
||||
// الاستماع للروابط إذا كان التطبيق مغلقاً تماماً (Cold Start)
|
||||
@@ -29,15 +32,37 @@ class DeepLinkController extends GetxController {
|
||||
if (initialUri != null) {
|
||||
Log.print('🔗 Received initial deep link (Cold Start): $initialUri');
|
||||
rawDeepLink.value = initialUri.toString();
|
||||
_processInviteCode(initialUri);
|
||||
}
|
||||
} catch (e) {
|
||||
Log.print('Error getting initial link: $e');
|
||||
}
|
||||
}
|
||||
|
||||
void _processInviteCode(Uri uri) {
|
||||
if (uri.queryParameters.containsKey('inviteCode')) {
|
||||
String? inviteCode = uri.queryParameters['inviteCode'];
|
||||
if (inviteCode != null && inviteCode.isNotEmpty) {
|
||||
// دائماً نخزن الكود حتى لو لم يكن مسجلاً، ليتم استخدامه بعد التسجيل
|
||||
box.write('inviteCode', inviteCode);
|
||||
|
||||
// إذا كان المستخدم مسجل دخول (يمتلك JWT)، نربط الدعوة فوراً
|
||||
if (box.read('jwt') != null) {
|
||||
try {
|
||||
var rewardsController = Get.find<InvitesRewardsController>();
|
||||
rewardsController.linkInviteCode(inviteCode);
|
||||
} catch (e) {
|
||||
var rewardsController = Get.put(InvitesRewardsController());
|
||||
rewardsController.linkInviteCode(inviteCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
_linkSubscription?.cancel();
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:siro_rider/constant/links.dart';
|
||||
import 'package:siro_rider/controller/functions/crud.dart';
|
||||
|
||||
class InvitesRewardsController extends GetxController {
|
||||
bool isLoading = false;
|
||||
String? referralCode;
|
||||
int totalInvitedDrivers = 0;
|
||||
int totalInvitedPassengers = 0;
|
||||
List<dynamic> referrals = [];
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
fetchPassengerReferrals();
|
||||
}
|
||||
|
||||
Future<void> fetchPassengerReferrals() async {
|
||||
isLoading = true;
|
||||
update();
|
||||
|
||||
try {
|
||||
var response = await CRUD().post(
|
||||
link: AppLink.getPassengerReferrals,
|
||||
payload: {} // Token is automatically handled by CRUD()
|
||||
);
|
||||
|
||||
if (response != 'failure') {
|
||||
var data = jsonDecode(response);
|
||||
if (data['status'] == 'success') {
|
||||
referralCode = data['message']['referral_code'];
|
||||
totalInvitedDrivers = data['message']['total_invited_drivers'] ?? 0;
|
||||
totalInvitedPassengers = data['message']['total_invited_passengers'] ?? 0;
|
||||
referrals = data['message']['referrals'] ?? [];
|
||||
} else {
|
||||
referrals = [];
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
print("Error fetching passenger referrals: $e");
|
||||
}
|
||||
|
||||
isLoading = false;
|
||||
update();
|
||||
}
|
||||
|
||||
Future<void> processScannedQRCode(String code) async {
|
||||
if (code.contains('inviteCode=')) {
|
||||
Uri uri = Uri.parse(code);
|
||||
String? inviteCode = uri.queryParameters['inviteCode'];
|
||||
|
||||
if (inviteCode != null && inviteCode.isNotEmpty) {
|
||||
await linkInviteCode(inviteCode);
|
||||
} else {
|
||||
Get.snackbar("Error".tr, "Invalid QR Code".tr);
|
||||
}
|
||||
} else if (code.length >= 4 && code.length <= 15) {
|
||||
await linkInviteCode(code);
|
||||
} else {
|
||||
Get.snackbar("Error".tr, "Invalid QR Code format".tr);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> linkInviteCode(String inviteCode) async {
|
||||
Get.dialog(const Center(child: CircularProgressIndicator()), barrierDismissible: false);
|
||||
|
||||
try {
|
||||
var response = await CRUD().post(
|
||||
link: AppLink.addUnifiedInvite,
|
||||
payload: {
|
||||
"inviter_code": inviteCode,
|
||||
}
|
||||
);
|
||||
|
||||
Get.back(); // close loading
|
||||
|
||||
if (response != 'failure') {
|
||||
var data = jsonDecode(response);
|
||||
if (data['status'] == 'success') {
|
||||
Get.snackbar("Success".tr, "You have been successfully referred!".tr, backgroundColor: Colors.green, colorText: Colors.white);
|
||||
} else {
|
||||
Get.snackbar("Notice".tr, data['message'] ?? "Could not add invite".tr);
|
||||
}
|
||||
} else {
|
||||
Get.snackbar("Error".tr, "Network error occurred".tr);
|
||||
}
|
||||
} catch (e) {
|
||||
Get.back(); // close loading
|
||||
Get.snackbar("Error".tr, "Network error occurred".tr);
|
||||
}
|
||||
}
|
||||
}
|
||||
67
siro_rider/lib/views/home/HomePage/qr_scanner_page.dart
Normal file
67
siro_rider/lib/views/home/HomePage/qr_scanner_page.dart
Normal file
@@ -0,0 +1,67 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:mobile_scanner/mobile_scanner.dart';
|
||||
import 'package:siro_rider/constant/colors.dart';
|
||||
import 'package:siro_rider/controller/home/profile/invites_rewards_controller.dart';
|
||||
|
||||
class QRScannerPage extends StatefulWidget {
|
||||
@override
|
||||
_QRScannerPageState createState() => _QRScannerPageState();
|
||||
}
|
||||
|
||||
class _QRScannerPageState extends State<QRScannerPage> {
|
||||
final InvitesRewardsController controller = Get.find<InvitesRewardsController>();
|
||||
bool _isScanned = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.black,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.black,
|
||||
iconTheme: const IconThemeData(color: Colors.white),
|
||||
title: Text("Scan QR Code".tr, style: const TextStyle(color: Colors.white)),
|
||||
),
|
||||
body: Stack(
|
||||
children: [
|
||||
MobileScanner(
|
||||
onDetect: (capture) {
|
||||
if (_isScanned) return;
|
||||
final List<Barcode> barcodes = capture.barcodes;
|
||||
for (final barcode in barcodes) {
|
||||
if (barcode.rawValue != null) {
|
||||
setState(() => _isScanned = true);
|
||||
Get.back(); // close scanner page
|
||||
controller.processScannedQRCode(barcode.rawValue!);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
height: 250,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: AppColor.primaryColor, width: 3),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 50,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Center(
|
||||
child: Text(
|
||||
"Align QR Code within the frame".tr,
|
||||
style: const TextStyle(color: Colors.white, fontSize: 16),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,18 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/links.dart';
|
||||
import '../../../constant/style.dart';
|
||||
import '../../../controller/home/profile/invit_controller.dart';
|
||||
import '../../../controller/home/profile/invites_rewards_controller.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart';
|
||||
import 'qr_scanner_page.dart';
|
||||
import '../../../print.dart';
|
||||
|
||||
class ShareAppPage extends StatelessWidget {
|
||||
final InviteController controller = Get.put(InviteController());
|
||||
final InvitesRewardsController rewardsController =
|
||||
Get.put(InvitesRewardsController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -42,6 +48,12 @@ class ShareAppPage extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
backgroundColor: AppColor.primaryColor,
|
||||
onPressed: () => Get.to(() => QRScannerPage()),
|
||||
icon: const Icon(CupertinoIcons.qrcode_viewfinder, color: Colors.white),
|
||||
label: Text("Scan QR".tr, style: const TextStyle(color: Colors.white)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -49,6 +61,8 @@ class ShareAppPage extends StatelessWidget {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildQRCodeSection(),
|
||||
const SizedBox(height: 20),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
@@ -74,8 +88,11 @@ class ShareAppPage extends StatelessWidget {
|
||||
const SizedBox(height: 20),
|
||||
_buildActionButtonsPassengers(),
|
||||
const SizedBox(height: 20),
|
||||
const SizedBox(height: 20),
|
||||
_buildInvitationsListPassengers(context),
|
||||
const SizedBox(height: 20),
|
||||
_buildUnifiedRewardsList(),
|
||||
const SizedBox(
|
||||
height: 60), // Add padding for the floating action button
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -226,24 +243,35 @@ class ShareAppPage extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _buildInvitationsListPassengers(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: Get.height * .4,
|
||||
child: controller.driverInvitationDataToPassengers.isEmpty
|
||||
? Center(
|
||||
child: Text(
|
||||
"No invitation found yet!".tr,
|
||||
style: TextStyle(
|
||||
color: AppColor.grayColor,
|
||||
fontSize: 17,
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Invitations Sent".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.writeColor,
|
||||
)),
|
||||
const SizedBox(height: 10),
|
||||
controller.driverInvitationDataToPassengers.isEmpty
|
||||
? Center(
|
||||
child: Text(
|
||||
"No invitation found yet!".tr,
|
||||
style: TextStyle(
|
||||
color: AppColor.grayColor,
|
||||
fontSize: 17,
|
||||
),
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: controller.driverInvitationDataToPassengers.length,
|
||||
itemBuilder: (context, index) {
|
||||
return _buildInvitationItemPassengers(context, index);
|
||||
},
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
itemCount: controller.driverInvitationDataToPassengers.length,
|
||||
itemBuilder: (context, index) {
|
||||
return _buildInvitationItemPassengers(context, index);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -574,4 +602,136 @@ class ShareAppPage extends StatelessWidget {
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
|
||||
Widget _buildQRCodeSection() {
|
||||
return GetBuilder<InvitesRewardsController>(
|
||||
builder: (rewardsController) {
|
||||
if (rewardsController.isLoading) {
|
||||
return const Center(child: CupertinoActivityIndicator());
|
||||
}
|
||||
String qrData =
|
||||
'https://${AppLink.appDomain}/?inviteCode=${rewardsController.referralCode ?? ''}';
|
||||
|
||||
return Center(
|
||||
child: Column(
|
||||
children: [
|
||||
Text("Your QR Code".tr,
|
||||
style: const TextStyle(
|
||||
fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 10),
|
||||
if (rewardsController.referralCode != null)
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: QrImageView(
|
||||
data: qrData,
|
||||
version: QrVersions.auto,
|
||||
size: 200.0,
|
||||
backgroundColor: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
if (rewardsController.referralCode != null)
|
||||
Text(
|
||||
rewardsController.referralCode!,
|
||||
style: const TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
letterSpacing: 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildUnifiedRewardsList() {
|
||||
return GetBuilder<InvitesRewardsController>(
|
||||
builder: (rewardsController) {
|
||||
if (rewardsController.isLoading) {
|
||||
return const Center(child: CupertinoActivityIndicator());
|
||||
}
|
||||
|
||||
var filteredList = rewardsController.referrals;
|
||||
|
||||
if (filteredList.isEmpty) {
|
||||
return const SizedBox(); // Hide if no valid rewards
|
||||
}
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Reward Status".tr,
|
||||
style:
|
||||
const TextStyle(fontSize: 17, fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 10),
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: filteredList.length,
|
||||
itemBuilder: (context, index) {
|
||||
var ref = filteredList[index];
|
||||
int trips = ref['trip_count'] ?? 0;
|
||||
int target = ref['target_trips'] ?? 1;
|
||||
bool canClaim = ref['can_claim'] ?? false;
|
||||
bool isClaimed = ref['is_reward_claimed'] == 1;
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: CupertinoColors.systemGrey6,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
ref['invited_user_type'] == 'driver'
|
||||
? "Driver Referral".tr
|
||||
: "Passenger Referral".tr,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 4),
|
||||
Text("Trips: $trips / $target".tr,
|
||||
style: const TextStyle(
|
||||
color: CupertinoColors.secondaryLabel,
|
||||
fontSize: 13)),
|
||||
if (isClaimed)
|
||||
Text("Reward Claimed".tr,
|
||||
style: const TextStyle(
|
||||
color: CupertinoColors.activeGreen,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold))
|
||||
else if (!canClaim)
|
||||
Text("Waiting for trips".tr,
|
||||
style: const TextStyle(
|
||||
color: CupertinoColors.systemOrange,
|
||||
fontSize: 12))
|
||||
else
|
||||
Text("Reward Earned".tr,
|
||||
style: const TextStyle(
|
||||
color: CupertinoColors.activeGreen,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold))
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user