Update: 2026-06-25 02:28:33
This commit is contained in:
@@ -158,10 +158,7 @@ class ShareAppPage extends StatelessWidget {
|
||||
_showContactsDialog(Get
|
||||
.context!); // Show contacts dialog after loading contacts
|
||||
} else {
|
||||
Get.snackbar(
|
||||
'No contacts available'.tr,
|
||||
'Please add contacts to your phone.'.tr,
|
||||
);
|
||||
mySnackbarInfo('Please add contacts to your phone.'.tr);
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
@@ -16,6 +16,7 @@ import 'package:url_launcher/url_launcher.dart';
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/links.dart';
|
||||
import '../../../controller/home/map/map_engine_controller.dart';
|
||||
import '../../widgets/error_snakbar.dart';
|
||||
import '../../notification/notification_page.dart';
|
||||
import '../HomePage/contact_us.dart';
|
||||
import '../HomePage/share_app_page.dart';
|
||||
@@ -386,10 +387,10 @@ class MapMenuWidget extends StatelessWidget {
|
||||
if (await canLaunchUrl(url)) {
|
||||
await launchUrl(url);
|
||||
} else {
|
||||
Get.snackbar('Error', 'Could not launch driver app store.');
|
||||
mySnackeBarError('Could not launch driver app store.');
|
||||
}
|
||||
} catch (e) {
|
||||
Get.snackbar('Error', 'Could not open the link.');
|
||||
mySnackeBarError('Could not open the link.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import '../../../controller/home/map/location_search_controller.dart';
|
||||
import '../../../controller/home/map/map_engine_controller.dart';
|
||||
import '../../../controller/home/map/ride_lifecycle_controller.dart';
|
||||
import '../../../main.dart';
|
||||
import '../../widgets/error_snakbar.dart';
|
||||
import '../../widgets/elevated_btn.dart';
|
||||
import 'form_search_places_destenation.dart';
|
||||
|
||||
@@ -165,12 +166,7 @@ class PickerAnimtionContainerFormPlaces extends StatelessWidget {
|
||||
index]
|
||||
['id']);
|
||||
Get.back();
|
||||
Get.snackbar(
|
||||
'Deleted ',
|
||||
'${'You are Delete'.tr} ${favoritePlaces[index]['name']} from your list',
|
||||
backgroundColor:
|
||||
AppColor
|
||||
.accentColor);
|
||||
mySnackbarInfo('${'You are Delete'.tr} ${favoritePlaces[index]['name']} from your list');
|
||||
},
|
||||
icon: const Icon(Icons
|
||||
.favorite_outlined),
|
||||
|
||||
@@ -15,6 +15,7 @@ import '../../../controller/home/map/ui_interactions_controller.dart';
|
||||
import '../../../controller/home/map/ride_state.dart';
|
||||
import '../../../controller/profile/profile_controller.dart';
|
||||
import '../../../main.dart';
|
||||
import '../../widgets/error_snakbar.dart';
|
||||
|
||||
class RideFromStartApp extends StatelessWidget {
|
||||
const RideFromStartApp({super.key});
|
||||
@@ -319,8 +320,7 @@ class RideFromStartApp extends StatelessWidget {
|
||||
if (sosPhone != null && sosPhone != 'sos') {
|
||||
action(sosPhone);
|
||||
} else {
|
||||
Get.snackbar('Warning'.tr, 'Please set a valid SOS phone number.'.tr,
|
||||
backgroundColor: AppColor.redColor, colorText: Colors.white);
|
||||
mySnackbarWarning('Please set a valid SOS phone number.'.tr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
173
siro_rider/lib/views/home/my_wallet/cliq_payment_sheet.dart
Normal file
173
siro_rider/lib/views/home/my_wallet/cliq_payment_sheet.dart
Normal file
@@ -0,0 +1,173 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:siro_rider/constant/box_name.dart';
|
||||
import 'package:siro_rider/constant/colors.dart';
|
||||
import 'package:siro_rider/constant/currency.dart';
|
||||
import 'package:siro_rider/constant/payment_tiers.dart';
|
||||
import 'package:siro_rider/constant/style.dart';
|
||||
import 'package:siro_rider/controller/functions/country_logic.dart';
|
||||
import 'package:siro_rider/controller/payment/payment_controller.dart';
|
||||
import 'package:siro_rider/main.dart';
|
||||
|
||||
class CliqPaymentSheet extends StatefulWidget {
|
||||
final double amount;
|
||||
const CliqPaymentSheet({super.key, required this.amount});
|
||||
|
||||
@override
|
||||
State<CliqPaymentSheet> createState() => _CliqPaymentSheetState();
|
||||
}
|
||||
|
||||
class _CliqPaymentSheetState extends State<CliqPaymentSheet> {
|
||||
late final TextEditingController _phoneCtrl;
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
bool _saving = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_phoneCtrl = TextEditingController(
|
||||
text: box.read(BoxName.phoneWallet) ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_phoneCtrl.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _submit() {
|
||||
if (!_formKey.currentState!.validate()) return;
|
||||
setState(() => _saving = true);
|
||||
box.write(BoxName.phoneWallet, _phoneCtrl.text.trim());
|
||||
final ctrl = Get.find<PaymentController>();
|
||||
Get.back();
|
||||
ctrl.payWithClickWallet(
|
||||
Get.context!,
|
||||
widget.amount.toString(),
|
||||
CurrencyHelper.currency,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final accent = AppColor.secondaryColorStatic;
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 24, right: 24, top: 20,
|
||||
bottom: MediaQuery.of(context).viewInsets.bottom + 32,
|
||||
),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
// Handle
|
||||
Center(
|
||||
child: Container(
|
||||
width: 36, height: 4,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Title
|
||||
Text('Pay by Cliq'.tr, style: AppStyle.headTitle2),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Enter your Cliq wallet details'.tr,
|
||||
style: TextStyle(
|
||||
color: Colors.white.withOpacity(0.5),
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Phone field
|
||||
TextFormField(
|
||||
controller: _phoneCtrl,
|
||||
keyboardType: TextInputType.phone,
|
||||
style: const TextStyle(color: Colors.white, fontSize: 16, letterSpacing: 1.2),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Wallet Phone Number'.tr,
|
||||
hintText: CountryLogic.getPhoneHint(box.read(BoxName.countryCode) ?? 'Jordan'),
|
||||
hintStyle: TextStyle(color: Colors.white.withOpacity(0.3)),
|
||||
labelStyle: TextStyle(color: accent.withOpacity(0.7)),
|
||||
filled: true,
|
||||
fillColor: Colors.white.withOpacity(0.06),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: accent, width: 1.5),
|
||||
),
|
||||
prefixIcon: Icon(Icons.phone_android, color: accent.withOpacity(0.6)),
|
||||
suffixIcon: _phoneCtrl.text.isNotEmpty
|
||||
? IconButton(
|
||||
icon: Icon(Icons.clear, color: Colors.white.withOpacity(0.4)),
|
||||
onPressed: () => setState(() => _phoneCtrl.clear()),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
validator: (v) => (v == null || v.trim().isEmpty)
|
||||
? 'Please enter a phone number'.tr
|
||||
: null,
|
||||
onChanged: (_) => setState(() {}),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Amount summary
|
||||
Container(
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
color: accent.withOpacity(0.08),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: accent.withOpacity(0.15)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.receipt_long, color: accent, size: 22),
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Invoice Amount'.tr,
|
||||
style: TextStyle(fontSize: 11, color: Colors.white.withOpacity(0.5))),
|
||||
const SizedBox(height: 2),
|
||||
Text('${PaymentTierConfig.formatAmount(widget.amount)} ${CurrencyHelper.currency}',
|
||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w700, color: Colors.white)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Submit
|
||||
SizedBox(
|
||||
height: 50,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: accent,
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
elevation: 0,
|
||||
),
|
||||
onPressed: _saving ? null : _submit,
|
||||
child: _saving
|
||||
? const SizedBox(width: 22, height: 22, child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white))
|
||||
: Text('Create Invoice'.tr, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:siro_rider/constant/currency.dart';
|
||||
import 'package:siro_rider/constant/payment_tiers.dart';
|
||||
import 'package:siro_rider/print.dart';
|
||||
import 'package:siro_rider/constant/style.dart';
|
||||
// import 'package:siro_rider/controller/functions/encrypt_decrypt.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -14,6 +14,7 @@ import 'package:local_auth/local_auth.dart';
|
||||
import '../../../main.dart';
|
||||
import '../../widgets/elevated_btn.dart';
|
||||
import '../../widgets/my_textField.dart';
|
||||
import 'cliq_payment_sheet.dart';
|
||||
import 'payment_screen_sham.dart';
|
||||
|
||||
class PassengerWalletDialog extends StatelessWidget {
|
||||
@@ -33,58 +34,16 @@ class PassengerWalletDialog extends StatelessWidget {
|
||||
? CupertinoActionSheet(
|
||||
title: Text('Select Payment Amount'.tr),
|
||||
actions: [
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
controller.updateSelectedAmount(
|
||||
box.read(BoxName.countryCode) == 'Syria' ? 10000 : 10,
|
||||
);
|
||||
showPaymentOptions(context, controller);
|
||||
},
|
||||
child: Text(
|
||||
box.read(BoxName.countryCode) == 'Syria'
|
||||
? '10000 ${'LE'.tr}'
|
||||
: '10 ${CurrencyHelper.currency}',
|
||||
for (int i = 0; i < PaymentTierConfig.currentTiers.length; i++)
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
controller.updateSelectedAmount(
|
||||
PaymentTierConfig.currentTiers[i].amount,
|
||||
);
|
||||
showPaymentOptions(context, controller);
|
||||
},
|
||||
child: Text(PaymentTierConfig.tierLabel(i)),
|
||||
),
|
||||
),
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
controller.updateSelectedAmount(
|
||||
box.read(BoxName.countryCode) == 'Syria' ? 20000 : 20,
|
||||
);
|
||||
showPaymentOptions(context, controller);
|
||||
},
|
||||
child: Text(
|
||||
box.read(BoxName.countryCode) == 'Syria'
|
||||
? '20000 ${'LE'.tr} = 2050 ${'LE'.tr}'
|
||||
: '20 ${CurrencyHelper.currency}',
|
||||
),
|
||||
),
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
controller.updateSelectedAmount(
|
||||
box.read(BoxName.countryCode) == 'Syria' ? 40000 : 40,
|
||||
);
|
||||
showPaymentOptions(context, controller);
|
||||
},
|
||||
child: Text(
|
||||
box.read(BoxName.countryCode) == 'Syria'
|
||||
? '40000 ${'LE'.tr} = 4150 ${'LE'.tr}'
|
||||
: '40 ${CurrencyHelper.currency}',
|
||||
),
|
||||
),
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
controller.updateSelectedAmount(
|
||||
box.read(BoxName.countryCode) == 'Syria' ? 100000 : 50,
|
||||
);
|
||||
showPaymentOptions(context, controller);
|
||||
},
|
||||
child: Text(
|
||||
box.read(BoxName.countryCode) == 'Syria'
|
||||
? '100000 ${'LE'.tr} = 11000 ${'LE'.tr}'
|
||||
: '50 ${CurrencyHelper.currency}',
|
||||
),
|
||||
),
|
||||
],
|
||||
cancelButton: CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
@@ -145,40 +104,7 @@ void showPaymentBottomSheet(BuildContext context) {
|
||||
const SizedBox(height: 16.0),
|
||||
|
||||
// Payment Options List
|
||||
_buildPaymentOption(
|
||||
context: context,
|
||||
controller: controller,
|
||||
amount: 500,
|
||||
bonusAmount: 30,
|
||||
currency: CurrencyHelper.currency,
|
||||
),
|
||||
|
||||
const SizedBox(height: 8.0),
|
||||
_buildPaymentOption(
|
||||
context: context,
|
||||
controller: controller,
|
||||
amount: 1000,
|
||||
bonusAmount: 70,
|
||||
currency: CurrencyHelper.currency,
|
||||
),
|
||||
|
||||
const SizedBox(height: 8.0),
|
||||
_buildPaymentOption(
|
||||
context: context,
|
||||
controller: controller,
|
||||
amount: 2000,
|
||||
bonusAmount: 180,
|
||||
currency: CurrencyHelper.currency,
|
||||
),
|
||||
|
||||
const SizedBox(height: 8.0),
|
||||
_buildPaymentOption(
|
||||
context: context,
|
||||
controller: controller,
|
||||
amount: 5000,
|
||||
bonusAmount: 700,
|
||||
currency: CurrencyHelper.currency,
|
||||
),
|
||||
..._buildPaymentTiers(context, controller),
|
||||
|
||||
const SizedBox(height: 16.0),
|
||||
TextButton(
|
||||
@@ -192,18 +118,43 @@ void showPaymentBottomSheet(BuildContext context) {
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> _buildPaymentTiers(BuildContext context, PaymentController controller) {
|
||||
final tiers = PaymentTierConfig.currentTiers;
|
||||
final currency = PaymentTierConfig.currentCurrency;
|
||||
|
||||
return List.generate(tiers.length, (i) {
|
||||
final t = tiers[i];
|
||||
final separator = i < tiers.length - 1
|
||||
? const SizedBox(height: 8)
|
||||
: const SizedBox.shrink();
|
||||
return Column(
|
||||
children: [
|
||||
_buildPaymentOption(
|
||||
context: context,
|
||||
controller: controller,
|
||||
tier: t,
|
||||
currency: currency,
|
||||
),
|
||||
separator,
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildPaymentOption({
|
||||
required BuildContext context,
|
||||
required PaymentController controller,
|
||||
required int amount,
|
||||
required double bonusAmount,
|
||||
required PaymentTier tier,
|
||||
required String currency,
|
||||
}) {
|
||||
final label = PaymentTierConfig.tierLabel(
|
||||
PaymentTierConfig.currentTiers.indexOf(tier),
|
||||
);
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
controller.updateSelectedAmount(amount);
|
||||
controller.updateSelectedAmount(tier.amount);
|
||||
Get.back();
|
||||
showPaymentOptions(context, controller);
|
||||
},
|
||||
@@ -213,13 +164,7 @@ Widget _buildPaymentOption({
|
||||
border: Border.all(color: Colors.grey[300]!),
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
),
|
||||
child: Text(
|
||||
bonusAmount > 0
|
||||
? '${'Pay'.tr} $amount $currency, ${'Get'.tr} ${amount + bonusAmount} $currency'
|
||||
: '$amount $currency',
|
||||
style: AppStyle.title,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
child: Text(label, style: AppStyle.title, textAlign: TextAlign.center),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -394,44 +339,19 @@ void showPaymentOptions(BuildContext context, PaymentController controller) {
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
Get.back();
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title: 'Insert Wallet phone number'.tr,
|
||||
content: Form(
|
||||
key: controller.formKey,
|
||||
child: MyTextForm(
|
||||
controller: controller.walletphoneController,
|
||||
label: 'Insert Wallet phone number'.tr,
|
||||
hint: '962791234567',
|
||||
type: TextInputType.phone)),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'OK'.tr,
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
if (controller.formKey.currentState!.validate()) {
|
||||
if (controller.selectedAmount != 0) {
|
||||
controller.isLoading = true;
|
||||
controller.update();
|
||||
box.write(BoxName.phoneWallet,
|
||||
(controller.walletphoneController.text));
|
||||
await controller.payWithClickWallet(
|
||||
context,
|
||||
controller.selectedAmount.toString(),
|
||||
CurrencyHelper.currency,
|
||||
);
|
||||
await controller.getPassengerWallet();
|
||||
|
||||
controller.isLoading = false;
|
||||
controller.update();
|
||||
} else {
|
||||
Toast.show(
|
||||
context,
|
||||
'⚠️ You need to choose an amount!'.tr,
|
||||
AppColor.redColor,
|
||||
);
|
||||
}
|
||||
}
|
||||
}));
|
||||
if (controller.selectedAmount == 0) {
|
||||
Toast.show(context, '⚠️ You need to choose an amount!'.tr, AppColor.redColor);
|
||||
return;
|
||||
}
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: AppColor.primaryColor,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
||||
),
|
||||
builder: (_) => CliqPaymentSheet(amount: controller.selectedAmount!),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(top: 10),
|
||||
|
||||
@@ -3,8 +3,11 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/links.dart';
|
||||
import '../../../constant/style.dart';
|
||||
import '../../../controller/functions/crud.dart';
|
||||
import '../../widgets/error_snakbar.dart';
|
||||
|
||||
class PaymentScreenCliq extends StatefulWidget {
|
||||
final double amount;
|
||||
@@ -24,20 +27,17 @@ class PaymentScreenCliq extends StatefulWidget {
|
||||
|
||||
class _PaymentScreenCliqState extends State<PaymentScreenCliq> with SingleTickerProviderStateMixin {
|
||||
Timer? _pollingTimer;
|
||||
String _status = 'waiting'; // waiting, uploading, verifying, success, error
|
||||
String _status = 'waiting';
|
||||
final TextEditingController _proofController = TextEditingController();
|
||||
|
||||
|
||||
late AnimationController _blinkController;
|
||||
late Animation<Color?> _colorAnimation;
|
||||
late Animation<double> _shadowAnimation;
|
||||
late Animation<double> _pulseAnimation;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_blinkController = AnimationController(duration: const Duration(milliseconds: 800), vsync: this)..repeat(reverse: true);
|
||||
_colorAnimation = ColorTween(begin: Colors.red.shade700, end: Colors.red.shade100).animate(_blinkController);
|
||||
_shadowAnimation = Tween<double>(begin: 2.0, end: 15.0).animate(CurvedAnimation(parent: _blinkController, curve: Curves.easeInOut));
|
||||
|
||||
_blinkController = AnimationController(duration: const Duration(milliseconds: 1000), vsync: this)..repeat(reverse: true);
|
||||
_pulseAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(CurvedAnimation(parent: _blinkController, curve: Curves.easeInOut));
|
||||
_startPolling();
|
||||
}
|
||||
|
||||
@@ -64,17 +64,15 @@ class _PaymentScreenCliqState extends State<PaymentScreenCliq> with SingleTicker
|
||||
|
||||
Future<void> _submitProof() async {
|
||||
if (_proofController.text.trim().isEmpty) {
|
||||
Get.snackbar('Error'.tr, 'Please paste the transfer message'.tr, backgroundColor: Colors.red);
|
||||
mySnackeBarError('Please paste the transfer message'.tr);
|
||||
return;
|
||||
}
|
||||
setState(() => _status = 'verifying');
|
||||
|
||||
try {
|
||||
final res = await CRUD().postWallet(link: AppLink.uploadCliqProof, payload: {
|
||||
'invoice_number': widget.invoiceNumber,
|
||||
'proof_text': _proofController.text.trim(),
|
||||
});
|
||||
|
||||
if (res != 'failure' && res['status'] == 'success') {
|
||||
if (mounted) setState(() => _status = 'success');
|
||||
} else {
|
||||
@@ -89,9 +87,16 @@ class _PaymentScreenCliqState extends State<PaymentScreenCliq> with SingleTicker
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final accent = AppColor.secondaryColorStatic;
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey[50],
|
||||
appBar: AppBar(title: const Text("Cliq Payment"), centerTitle: true, backgroundColor: Colors.white, foregroundColor: Colors.black),
|
||||
backgroundColor: AppColor.primaryColor,
|
||||
appBar: AppBar(
|
||||
title: const Text('Cliq Payment'),
|
||||
centerTitle: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
foregroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
),
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
@@ -102,48 +107,71 @@ class _PaymentScreenCliqState extends State<PaymentScreenCliq> with SingleTicker
|
||||
}
|
||||
|
||||
Widget _buildWaitingUI() {
|
||||
final currencyFormat = NumberFormat.decimalPattern('ar_SY');
|
||||
|
||||
final accent = AppColor.secondaryColorStatic;
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
// Amount card
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 15),
|
||||
decoration: BoxDecoration(gradient: LinearGradient(colors: [Colors.blue.shade800, Colors.blue.shade600]), borderRadius: BorderRadius.circular(16)),
|
||||
padding: const EdgeInsets.symmetric(vertical: 24, horizontal: 20),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(colors: [accent.withOpacity(0.2), accent.withOpacity(0.05)]),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: accent.withOpacity(0.15)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const Text("المبلغ المطلوب", style: TextStyle(color: Colors.white70, fontSize: 14)),
|
||||
const SizedBox(height: 5),
|
||||
Text("${currencyFormat.format(widget.amount)} ل.س", style: const TextStyle(color: Colors.white, fontSize: 28, fontWeight: FontWeight.bold)),
|
||||
Text('Invoice Amount'.tr, style: TextStyle(color: Colors.white.withOpacity(0.6), fontSize: 13)),
|
||||
const SizedBox(height: 6),
|
||||
Text('${widget.amount.toStringAsFixed(widget.amount == widget.amount.roundToDouble() ? 0 : 1)} ${'SYP'}',
|
||||
style: const TextStyle(color: Colors.white, fontSize: 32, fontWeight: FontWeight.w700, letterSpacing: 1)),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
|
||||
const SizedBox(height: 28),
|
||||
|
||||
// Cliq Alias
|
||||
AnimatedBuilder(
|
||||
animation: _blinkController,
|
||||
builder: (context, child) {
|
||||
builder: (_, child) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(16), border: Border.all(color: _colorAnimation.value ?? Colors.red, width: 3.0), boxShadow: [BoxShadow(color: (_colorAnimation.value ?? Colors.red).withOpacity(0.4), blurRadius: _shadowAnimation.value, spreadRadius: 2)]),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.05),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: accent.withOpacity(0.3 + _pulseAnimation.value * 0.3), width: 2),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: accent.withOpacity(0.1 + _pulseAnimation.value * 0.15),
|
||||
blurRadius: 12 + _pulseAnimation.value * 10,
|
||||
spreadRadius: 1,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const Text("يرجى تحويل المبلغ إلى الاسم المستعار التالي (Alias):", textAlign: TextAlign.center, style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 15),
|
||||
Text('Send payment to this Cliq alias'.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 15, fontWeight: FontWeight.w600, color: Colors.white.withOpacity(0.85))),
|
||||
const SizedBox(height: 16),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(text: widget.cliqAlias));
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: const Text("تم نسخ الاسم ✅", textAlign: TextAlign.center), backgroundColor: Colors.green.shade600));
|
||||
mySnackbarSuccess('Alias copied'.tr);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(15),
|
||||
decoration: BoxDecoration(color: Colors.blue.shade50, borderRadius: BorderRadius.circular(12), border: Border.all(color: Colors.blue.shade200)),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 14),
|
||||
decoration: BoxDecoration(
|
||||
color: accent.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: accent.withOpacity(0.3)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(widget.cliqAlias, style: const TextStyle(fontSize: 24, fontWeight: FontWeight.bold, letterSpacing: 2.0)),
|
||||
const Icon(Icons.copy, color: Colors.blue),
|
||||
Text(widget.cliqAlias, style: const TextStyle(fontSize: 22, fontWeight: FontWeight.bold, letterSpacing: 2.0, color: Colors.white)),
|
||||
Icon(Icons.copy_rounded, color: accent, size: 22),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -153,34 +181,49 @@ class _PaymentScreenCliqState extends State<PaymentScreenCliq> with SingleTicker
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
const SizedBox(height: 30),
|
||||
const Text("بعد إتمام التحويل، يرجى نسخ رسالة البنك النصية ولصقها هنا للتحقق التلقائي:", textAlign: TextAlign.center, style: TextStyle(fontSize: 14)),
|
||||
const SizedBox(height: 10),
|
||||
const SizedBox(height: 28),
|
||||
|
||||
// Proof input
|
||||
Text('After payment, paste the bank SMS here for auto-verification:'.tr,
|
||||
textAlign: TextAlign.center, style: TextStyle(color: Colors.white.withOpacity(0.5), fontSize: 13)),
|
||||
const SizedBox(height: 12),
|
||||
TextField(
|
||||
controller: _proofController,
|
||||
maxLines: 4,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
decoration: InputDecoration(
|
||||
hintText: "قم بلصق نص رسالة التحويل هنا...",
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
|
||||
hintText: 'Paste transfer message...'.tr,
|
||||
hintStyle: TextStyle(color: Colors.white.withOpacity(0.3)),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12), borderSide: BorderSide.none),
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Colors.white.withOpacity(0.06),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: accent, width: 1.5),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
height: 50,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(backgroundColor: Colors.blue.shade800, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12))),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: accent,
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
elevation: 0,
|
||||
),
|
||||
onPressed: _status == 'verifying' ? null : _submitProof,
|
||||
child: _status == 'verifying'
|
||||
? const CircularProgressIndicator(color: Colors.white)
|
||||
: const Text("تحقق من الدفع", style: TextStyle(fontSize: 18, color: Colors.white, fontWeight: FontWeight.bold)),
|
||||
child: _status == 'verifying'
|
||||
? const SizedBox(width: 22, height: 22, child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white))
|
||||
: Text('Verify Payment'.tr, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const Text("جاري فحص الفاتورة تلقائياً كل 5 ثوانٍ...", style: TextStyle(color: Colors.grey, fontSize: 12)),
|
||||
const SizedBox(height: 16),
|
||||
Text('Auto-checking invoice every 5s...'.tr,
|
||||
style: TextStyle(color: Colors.white.withOpacity(0.3), fontSize: 11)),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -190,16 +233,29 @@ class _PaymentScreenCliqState extends State<PaymentScreenCliq> with SingleTicker
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.verified_rounded, color: Colors.green, size: 100),
|
||||
Container(
|
||||
width: 90, height: 90,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.green.withOpacity(0.1),
|
||||
),
|
||||
child: const Icon(Icons.verified_rounded, color: Colors.green, size: 56),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const Text("تم الدفع بنجاح!", style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 40),
|
||||
Text('Payment Successful!'.tr, style: const TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Colors.white)),
|
||||
const SizedBox(height: 32),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(backgroundColor: Colors.green, foregroundColor: Colors.white, padding: const EdgeInsets.symmetric(vertical: 16)),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.green,
|
||||
foregroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
elevation: 0,
|
||||
),
|
||||
onPressed: () { Get.back(); Get.back(); },
|
||||
child: const Text("متابعة", style: TextStyle(fontSize: 18)),
|
||||
child: Text('Continue'.tr, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import '../../../constant/links.dart';
|
||||
import '../../../controller/functions/crud.dart';
|
||||
import '../../widgets/error_snakbar.dart';
|
||||
|
||||
class PaymentScreenMtn extends StatefulWidget {
|
||||
final double amount;
|
||||
@@ -64,7 +65,7 @@ class _PaymentScreenMtnState extends State<PaymentScreenMtn> with SingleTickerPr
|
||||
|
||||
Future<void> _submitProof() async {
|
||||
if (_proofController.text.trim().isEmpty) {
|
||||
Get.snackbar('Error'.tr, 'Please paste the transfer message'.tr, backgroundColor: Colors.red);
|
||||
mySnackeBarError('Please paste the transfer message'.tr);
|
||||
return;
|
||||
}
|
||||
setState(() => _status = 'verifying');
|
||||
|
||||
@@ -11,6 +11,7 @@ import 'package:siro_rider/constant/colors.dart';
|
||||
import 'package:siro_rider/controller/profile/profile_controller.dart';
|
||||
import 'package:siro_rider/main.dart';
|
||||
import 'package:siro_rider/views/widgets/mycircular.dart';
|
||||
import 'package:siro_rider/views/widgets/error_snakbar.dart';
|
||||
|
||||
import '../../../constant/style.dart';
|
||||
import '../../../controller/functions/country_logic.dart';
|
||||
@@ -87,15 +88,7 @@ class _PassengerProfilePageState extends State<PassengerProfilePage> {
|
||||
|
||||
final response = await request.send();
|
||||
if (response.statusCode == 200) {
|
||||
Get.snackbar(
|
||||
'Success'.tr,
|
||||
'Profile photo updated'.tr,
|
||||
backgroundColor: Colors.green.withOpacity(0.9),
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
margin: const EdgeInsets.all(16),
|
||||
borderRadius: 12,
|
||||
);
|
||||
mySnackbarSuccess('Profile photo updated'.tr);
|
||||
} else {
|
||||
_showUploadError();
|
||||
}
|
||||
@@ -107,15 +100,7 @@ class _PassengerProfilePageState extends State<PassengerProfilePage> {
|
||||
}
|
||||
|
||||
void _showUploadError() {
|
||||
Get.snackbar(
|
||||
'Error'.tr,
|
||||
'Failed to upload photo'.tr,
|
||||
backgroundColor: Colors.red.withOpacity(0.9),
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
margin: const EdgeInsets.all(16),
|
||||
borderRadius: 12,
|
||||
);
|
||||
mySnackeBarError('Failed to upload photo'.tr);
|
||||
}
|
||||
|
||||
Future<ImageSource?> _showImageSourceSheet() async {
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:siro_rider/controller/home/profile/promos_controller.dart';
|
||||
import 'package:siro_rider/views/widgets/my_scafold.dart';
|
||||
import 'package:siro_rider/views/widgets/error_snakbar.dart';
|
||||
import 'dart:ui'; // لاستخدامه في الفاصل
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
@@ -132,13 +133,7 @@ class PromosPassengerPage extends StatelessWidget {
|
||||
// --- نفس منطقك القديم للنسخ ---
|
||||
Clipboard.setData(
|
||||
ClipboardData(text: promo['promo_code']));
|
||||
Get.snackbar(
|
||||
'Promo Copied!'.tr,
|
||||
'${'Code'.tr} ${promo['promo_code']} ${'copied to clipboard'.tr}',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
backgroundColor: AppColor.greenColor,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
mySnackbarSuccess('${'Code'.tr} ${promo['promo_code']} ${'copied to clipboard'.tr}');
|
||||
},
|
||||
child: Container(
|
||||
color: AppColor.primaryColor.withOpacity(0.1),
|
||||
|
||||
Reference in New Issue
Block a user