Update: 2026-06-13 15:43:50
This commit is contained in:
@@ -3,6 +3,14 @@ import 'package:siro_rider/main.dart';
|
||||
|
||||
class AppLink {
|
||||
static const String appDomain = 'siromove.com';
|
||||
|
||||
static String get inviteRedirectUrl {
|
||||
if (currentCountry == 'Syria') {
|
||||
return "https://siromove.com/inviteSyria.php";
|
||||
}
|
||||
return "https://siromove.com/invite.php";
|
||||
}
|
||||
|
||||
static String get currentCountry => box.read(BoxName.countryCode) ?? 'Jordan';
|
||||
|
||||
static String get paymentServer {
|
||||
|
||||
@@ -51,7 +51,8 @@ class InviteController extends GetxController {
|
||||
final String shareText = '''
|
||||
${'Join Siro as a driver using my referral code!'.tr}
|
||||
${'Use code:'.tr} $driverCouponCode
|
||||
${'Download the Siro Driver app now and earn rewards!'.tr}
|
||||
${'Download the Siro Driver app now and earn rewards:'.tr}
|
||||
${AppLink.inviteRedirectUrl}?code=$driverCouponCode&app=driver
|
||||
''';
|
||||
await Share.share(shareText);
|
||||
}
|
||||
@@ -62,7 +63,8 @@ ${'Download the Siro Driver app now and earn rewards!'.tr}
|
||||
final String shareText = '''
|
||||
${'Get a discount on your first Siro ride!'.tr}
|
||||
${'Use my referral code:'.tr} $couponCode
|
||||
${'Download the Siro app now and enjoy your ride!'.tr}
|
||||
${'Download the Siro app now and enjoy your ride:'.tr}
|
||||
${AppLink.inviteRedirectUrl}?code=$couponCode&app=rider
|
||||
''';
|
||||
await Share.share(shareText);
|
||||
}
|
||||
@@ -248,9 +250,8 @@ ${'Download the Siro app now and enjoy your ride!'.tr}
|
||||
"${'Your personal invitation code is:'.tr}\n"
|
||||
"*$inviteCode*\n\n"
|
||||
"⏳ ${'Be sure to use it quickly! This code expires at'.tr} *$expirationTime*.\n\n"
|
||||
"📲 ${'Download the app now:'.tr}\n"
|
||||
"• *Android:* https://play.google.com/store/apps/details?id=com.Siro.siro\n"
|
||||
"• *iOS:* https://apps.apple.com/st/app/siro-rider/id6748075179\n\n"
|
||||
"🔗 ${'Quick Invite Link:'.tr}\n"
|
||||
"${AppLink.inviteRedirectUrl}?code=$inviteCode&app=rider\n\n"
|
||||
"${'See you on the road!'.tr} 🚗";
|
||||
|
||||
launchCommunication('whatsapp', formattedPhoneNumber, message);
|
||||
|
||||
@@ -46,22 +46,6 @@ class InvitesRewardsController extends GetxController {
|
||||
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);
|
||||
|
||||
@@ -28,10 +28,7 @@ class DefaultFirebaseOptions {
|
||||
case TargetPlatform.iOS:
|
||||
return ios;
|
||||
case TargetPlatform.macOS:
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions have not been configured for macos - '
|
||||
'you can reconfigure this by running the FlutterFire CLI again.',
|
||||
);
|
||||
return macos;
|
||||
case TargetPlatform.windows:
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions have not been configured for windows - '
|
||||
@@ -51,17 +48,25 @@ class DefaultFirebaseOptions {
|
||||
|
||||
static const FirebaseOptions android = FirebaseOptions(
|
||||
apiKey: 'AIzaSyAEoply_UcEP6KaCu_ziCy_ZDIjAKvi7b8',
|
||||
appId: '1:825988584191:android:06782b540c7681ad1632ca',
|
||||
appId: '1:825988584191:android:7e9088b719dcb7061632ca',
|
||||
messagingSenderId: '825988584191',
|
||||
projectId: 'siro-a6957',
|
||||
storageBucket: 'siro-a6957.firebasestorage.app',
|
||||
);
|
||||
static const FirebaseOptions ios = FirebaseOptions(
|
||||
apiKey: 'AIzaSyDk6x6KZUY0IQtxoCMXX0F7N_yik8O19eA',
|
||||
appId: '1:825988584191:ios:1d880fc7fc98b7671632ca',
|
||||
appId: '1:825988584191:ios:4f60966dd0a69b3f1632ca',
|
||||
messagingSenderId: '825988584191',
|
||||
projectId: 'siro-a6957',
|
||||
storageBucket: 'siro-a6957.firebasestorage.app',
|
||||
iosBundleId: 'com.siro.rider',
|
||||
iosBundleId: 'com.siroapp.rider',
|
||||
);
|
||||
static const FirebaseOptions macos = FirebaseOptions(
|
||||
apiKey: 'AIzaSyDk6x6KZUY0IQtxoCMXX0F7N_yik8O19eA',
|
||||
appId: '1:825988584191:ios:7b48f585862d5cfc1632ca',
|
||||
messagingSenderId: '825988584191',
|
||||
projectId: 'siro-a6957',
|
||||
storageBucket: 'siro-a6957.firebasestorage.app',
|
||||
iosBundleId: 'com.siro.siroRider',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
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),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,6 @@ 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 {
|
||||
@@ -48,12 +46,6 @@ 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)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -61,8 +53,6 @@ class ShareAppPage extends StatelessWidget {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildQRCodeSection(),
|
||||
const SizedBox(height: 20),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
@@ -603,51 +593,7 @@ 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>(
|
||||
|
||||
@@ -240,53 +240,65 @@ class _SnackContentState extends State<_SnackContent>
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
// Internal dispatcher — single source of truth
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
SnackbarController _show(_SnackVariant variant, String message) {
|
||||
// Dismiss any existing snackbar first (no stacking)
|
||||
if (Get.isSnackbarOpen) Get.closeCurrentSnackbar();
|
||||
|
||||
switch (variant.haptic) {
|
||||
case HapticFeedbackType.light:
|
||||
HapticFeedback.lightImpact();
|
||||
case HapticFeedbackType.medium:
|
||||
HapticFeedback.mediumImpact();
|
||||
case HapticFeedbackType.selection:
|
||||
HapticFeedback.selectionClick();
|
||||
SnackbarController? _show(_SnackVariant variant, String message) {
|
||||
// Prevent crash if Navigator or Overlay context is not yet initialized at early startup
|
||||
if (Get.context == null || Get.overlayContext == null) {
|
||||
debugPrint("⚠️ Cannot show snackbar: Overlay/Navigator is not ready yet. Message: $message");
|
||||
return null;
|
||||
}
|
||||
|
||||
return Get.snackbar(
|
||||
'',
|
||||
'',
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.transparent,
|
||||
margin: EdgeInsets.zero,
|
||||
padding: EdgeInsets.zero,
|
||||
duration: const Duration(seconds: 4),
|
||||
animationDuration: const Duration(milliseconds: 380),
|
||||
barBlur: 0,
|
||||
overlayBlur: 0,
|
||||
overlayColor: Colors.transparent,
|
||||
isDismissible: true,
|
||||
dismissDirection: DismissDirection.up,
|
||||
forwardAnimationCurve: Curves.easeOutCubic,
|
||||
reverseAnimationCurve: Curves.easeInCubic,
|
||||
snackStyle: SnackStyle.FLOATING,
|
||||
userInputForm: Form(
|
||||
child: _SnackContent(message: message, variant: variant),
|
||||
),
|
||||
);
|
||||
try {
|
||||
// Dismiss any existing snackbar first (no stacking)
|
||||
if (Get.isSnackbarOpen) Get.closeCurrentSnackbar();
|
||||
|
||||
switch (variant.haptic) {
|
||||
case HapticFeedbackType.light:
|
||||
HapticFeedback.lightImpact();
|
||||
case HapticFeedbackType.medium:
|
||||
HapticFeedback.mediumImpact();
|
||||
case HapticFeedbackType.selection:
|
||||
HapticFeedback.selectionClick();
|
||||
}
|
||||
|
||||
return Get.snackbar(
|
||||
'',
|
||||
'',
|
||||
snackPosition: SnackPosition.TOP,
|
||||
backgroundColor: Colors.transparent,
|
||||
margin: EdgeInsets.zero,
|
||||
padding: EdgeInsets.zero,
|
||||
duration: const Duration(seconds: 4),
|
||||
animationDuration: const Duration(milliseconds: 380),
|
||||
barBlur: 0,
|
||||
overlayBlur: 0,
|
||||
overlayColor: Colors.transparent,
|
||||
isDismissible: true,
|
||||
dismissDirection: DismissDirection.up,
|
||||
forwardAnimationCurve: Curves.easeOutCubic,
|
||||
reverseAnimationCurve: Curves.easeInCubic,
|
||||
snackStyle: SnackStyle.FLOATING,
|
||||
userInputForm: Form(
|
||||
child: _SnackContent(message: message, variant: variant),
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
debugPrint("⚠️ Exception caught showing snackbar: $e");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
// Public API — drop-in replacements for the old functions
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
SnackbarController mySnackbarSuccess(String message) =>
|
||||
SnackbarController? mySnackbarSuccess(String message) =>
|
||||
_show(_SnackVariant.success, message);
|
||||
|
||||
SnackbarController mySnackeBarError(String message) =>
|
||||
SnackbarController? mySnackeBarError(String message) =>
|
||||
_show(_SnackVariant.error, message);
|
||||
|
||||
SnackbarController mySnackbarInfo(String message) =>
|
||||
SnackbarController? mySnackbarInfo(String message) =>
|
||||
_show(_SnackVariant.info, message);
|
||||
|
||||
SnackbarController mySnackbarWarning(String message) =>
|
||||
SnackbarController? mySnackbarWarning(String message) =>
|
||||
_show(_SnackVariant.warning, message);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user