Update codebase

This commit is contained in:
Hamza-Ayed
2026-08-09 16:56:13 +03:00
parent 95e2e4f35d
commit b64debaa88
1058 changed files with 164327 additions and 113928 deletions
@@ -4,7 +4,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import 'package:tripz_driver/views/home/my_wallet/pay_out_screen.dart';
import 'package:siro_driver/views/home/my_wallet/pay_out_screen.dart';
import '../../../constant/box_name.dart';
import '../../../constant/colors.dart';
@@ -96,7 +96,7 @@ class CardSeferWalletDriver extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'رصيد تريبز',
'رصيد سيرو',
style: AppStyle.headTitle.copyWith(
fontFamily: 'Amiri', // خط يوحي بالفخامة
color: Colors.white,
@@ -8,6 +8,7 @@ import '../../../constant/links.dart';
import '../../../constant/style.dart';
import '../../../controller/functions/crud.dart';
import '../../../main.dart';
import '../../widgets/ui/siro_ui.dart';
// --- ملاحظات هامة ---
// 1. تأكد من إضافة الرابط الجديد إلى ملف AppLink الخاص بك:
@@ -162,8 +163,8 @@ class _EcashDriverPaymentScreenState extends State<EcashDriverPaymentScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Complete Payment'.tr)),
return SiroPage(
title: 'Complete Payment'.tr,
body: WebViewWidget(controller: _controller),
);
}
@@ -1,9 +1,10 @@
import 'package:flutter/material.dart';
import 'package:local_auth/local_auth.dart';
import 'package:tripz_driver/constant/box_name.dart';
import 'package:tripz_driver/main.dart';
import 'package:siro_driver/constant/box_name.dart';
import 'package:siro_driver/main.dart';
import '../../../controller/payment/smsPaymnet/pay_out_syria_controller.dart';
import '../../widgets/ui/siro_ui.dart';
class PayoutScreen extends StatefulWidget {
// استقبال كل البيانات المطلوبة جاهزة
@@ -128,10 +129,10 @@ class _PayoutScreenState extends State<PayoutScreen> {
// حساب المبلغ الإجمالي المخصوم
final totalDeducted = widget.amountToWithdraw + PayoutService.payoutFee;
return Scaffold(
appBar: AppBar(title: const Text("تأكيد سحب الأموال")),
return SiroPage(
title: "تأكيد سحب الأموال",
body: SingleChildScrollView(
padding: const EdgeInsets.all(16.0),
padding: SiroUi.pageInsets,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
@@ -164,13 +165,10 @@ class _PayoutScreenState extends State<PayoutScreen> {
}
Widget _buildSummaryCard(double totalDeducted) {
return Card(
elevation: 2,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
return SiroCard(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
_summaryRow("المبلغ المسحوب:",
"${widget.amountToWithdraw.toStringAsFixed(2)} ل.س"),
const Divider(),
@@ -187,7 +185,6 @@ class _PayoutScreenState extends State<PayoutScreen> {
_summaryRow("عبر محفظة:", widget.walletType),
],
),
),
);
}
@@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:tripz_driver/constant/finance_design_system.dart';
import 'package:tripz_driver/views/widgets/mycircular.dart';
import 'package:siro_driver/constant/finance_design_system.dart';
import '../../../controller/payment/driver_payment_controller.dart';
import 'widgets/transaction_preview_item.dart';
import '../../widgets/ui/siro_ui.dart';
class PaymentHistoryDriverPage extends StatelessWidget {
const PaymentHistoryDriverPage({super.key});
@@ -13,23 +13,12 @@ class PaymentHistoryDriverPage extends StatelessWidget {
Widget build(BuildContext context) {
Get.put(DriverWalletHistoryController());
return Scaffold(
backgroundColor: FinanceDesignSystem.backgroundColor,
appBar: AppBar(
title: Text('Payment History'.tr,
style: TextStyle(fontWeight: FontWeight.bold, color: FinanceDesignSystem.primaryDark)),
backgroundColor: Colors.transparent,
elevation: 0,
centerTitle: true,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios_new_rounded, color: FinanceDesignSystem.primaryDark, size: 20),
onPressed: () => Get.back(),
),
),
return SiroPage(
title: 'Payment History'.tr,
body: GetBuilder<DriverWalletHistoryController>(
builder: (controller) {
if (controller.isLoading) {
return const Center(child: MyCircularProgressIndicator());
return const SiroLoading();
}
if (controller.archive.isEmpty) {
@@ -37,10 +26,13 @@ class PaymentHistoryDriverPage extends StatelessWidget {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.history_rounded, size: 80, color: Colors.grey.shade300),
Icon(Icons.history_rounded,
size: 80, color: Colors.grey.shade300),
const SizedBox(height: 16),
Text('No transactions yet'.tr,
style: TextStyle(color: Colors.grey.shade400, fontWeight: FontWeight.bold)),
style: TextStyle(
color: Colors.grey.shade400,
fontWeight: FontWeight.bold)),
],
),
);
@@ -52,8 +44,9 @@ class PaymentHistoryDriverPage extends StatelessWidget {
itemCount: controller.archive.length,
itemBuilder: (BuildContext context, int index) {
final tx = controller.archive[index];
final double amount = double.tryParse(tx['amount']?.toString() ?? '0') ?? 0;
final double amount =
double.tryParse(tx['amount']?.toString() ?? '0') ?? 0;
return AnimationConfiguration.staggeredList(
position: index,
duration: const Duration(milliseconds: 375),
@@ -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/ui/siro_ui.dart';
class PaymentScreenCliq extends StatefulWidget {
final double amount;
@@ -22,11 +23,12 @@ class PaymentScreenCliq extends StatefulWidget {
State<PaymentScreenCliq> createState() => _PaymentScreenCliqState();
}
class _PaymentScreenCliqState extends State<PaymentScreenCliq> with SingleTickerProviderStateMixin {
class _PaymentScreenCliqState extends State<PaymentScreenCliq>
with SingleTickerProviderStateMixin {
Timer? _pollingTimer;
String _status = 'waiting'; // waiting, uploading, verifying, success, error
final TextEditingController _proofController = TextEditingController();
late AnimationController _blinkController;
late Animation<Color?> _colorAnimation;
late Animation<double> _shadowAnimation;
@@ -34,10 +36,15 @@ class _PaymentScreenCliqState extends State<PaymentScreenCliq> with SingleTicker
@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: 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));
_startPolling();
}
@@ -53,8 +60,12 @@ class _PaymentScreenCliqState extends State<PaymentScreenCliq> with SingleTicker
_pollingTimer = Timer.periodic(const Duration(seconds: 5), (timer) async {
if (_status == 'success' || _status == 'verifying') return;
try {
final res = await CRUD().postWallet(link: AppLink.checkCliqStatus, payload: {'invoice_number': widget.invoiceNumber});
if (res != 'failure' && res['status'] == 'success' && res['invoice_status'] == 'completed') {
final res = await CRUD().postWallet(
link: AppLink.checkCliqStatus,
payload: {'invoice_number': widget.invoiceNumber});
if (res != 'failure' &&
res['status'] == 'success' &&
res['invoice_status'] == 'completed') {
timer.cancel();
if (mounted) setState(() => _status = 'success');
}
@@ -64,34 +75,38 @@ 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);
Get.snackbar('Error'.tr, 'Please paste the transfer message'.tr,
backgroundColor: Colors.red);
return;
}
setState(() => _status = 'verifying');
try {
final res = await CRUD().postWallet(link: AppLink.uploadCliqProof, payload: {
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 {
if (mounted) setState(() => _status = 'error');
Get.defaultDialog(title: 'Failed'.tr, content: Text(res['message']?.toString() ?? 'Verification failed'));
Get.defaultDialog(
title: 'Failed'.tr,
content: Text(res['message']?.toString() ?? 'Verification failed'));
}
} catch (e) {
if (mounted) setState(() => _status = 'error');
Get.defaultDialog(title: 'Error'.tr, content: Text('Error uploading proof'.tr));
Get.defaultDialog(
title: 'Error'.tr, content: Text('Error uploading proof'.tr));
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[50],
appBar: AppBar(title: const Text("Cliq Payment"), centerTitle: true, backgroundColor: Colors.white, foregroundColor: Colors.black),
return SiroPage(
title: "Cliq Payment",
body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(20.0),
@@ -103,46 +118,124 @@ class _PaymentScreenCliqState extends State<PaymentScreenCliq> with SingleTicker
Widget _buildWaitingUI() {
final currencyFormat = NumberFormat.decimalPattern('ar_SY');
return SingleChildScrollView(
child: Column(
children: [
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)),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue.shade800, Colors.blue.shade600]),
borderRadius: BorderRadius.circular(16)),
child: Column(
children: [
const Text("المبلغ المطلوب", style: TextStyle(color: Colors.white70, fontSize: 14)),
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(
'${widget.amount.toStringAsFixed(widget.amount == widget.amount.roundToDouble() ? 0 : 1)} JOD',
style: const TextStyle(
color: Colors.white,
fontSize: 32,
fontWeight: FontWeight.w700,
letterSpacing: 1)),
],
),
),
const SizedBox(height: 25),
AnimatedBuilder(
animation: _blinkController,
builder: (context, 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,
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)
]),
child: Column(
children: [
const Text("يرجى تحويل المبلغ إلى الاسم المستعار التالي (Alias):", textAlign: TextAlign.center, style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
const Text(
"يرجى تحويل المبلغ إلى الاسم المستعار التالي (Alias):",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16, fontWeight: FontWeight.bold)),
const SizedBox(height: 15),
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.amber.shade50,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.amber.shade200)),
child: Column(
children: [
const Text(
"⚠️ هام جداً: يجب إدخال رقم الفاتورة التالي في (ملاحظات التحويل) عند الدفع:",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
color: Colors.brown,
fontWeight: FontWeight.bold)),
const SizedBox(height: 8),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(widget.invoiceNumber,
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
color: Colors.black)),
IconButton(
icon: const Icon(Icons.copy,
color: Colors.brown, size: 20),
onPressed: () {
Clipboard.setData(ClipboardData(
text: widget.invoiceNumber));
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text("تم نسخ رقم الفاتورة ✅",
textAlign: TextAlign.center),
backgroundColor: Colors.amber));
},
),
],
),
],
),
),
const SizedBox(height: 15),
InkWell(
onTap: () {
Clipboard.setData(ClipboardData(text: widget.cliqAlias));
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: const Text("تم نسخ الاسم ✅", textAlign: TextAlign.center), backgroundColor: Colors.green.shade600));
Clipboard.setData(
ClipboardData(text: widget.cliqAlias));
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: const Text("تم نسخ الاسم ✅",
textAlign: TextAlign.center),
backgroundColor: Colors.green.shade600));
},
child: Container(
padding: const EdgeInsets.all(15),
decoration: BoxDecoration(color: Colors.blue.shade50, borderRadius: BorderRadius.circular(12), border: Border.all(color: Colors.blue.shade200)),
decoration: BoxDecoration(
color: Colors.blue.shade50,
borderRadius: BorderRadius.circular(12),
border: Border.all(color: Colors.blue.shade200)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(widget.cliqAlias, style: const TextStyle(fontSize: 24, fontWeight: FontWeight.bold, letterSpacing: 2.0)),
Text(widget.cliqAlias,
style: const TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
letterSpacing: 2.0)),
const Icon(Icons.copy, color: Colors.blue),
],
),
@@ -153,16 +246,19 @@ class _PaymentScreenCliqState extends State<PaymentScreenCliq> with SingleTicker
);
},
),
const SizedBox(height: 30),
const Text("بعد إتمام التحويل، يرجى نسخ رسالة البنك النصية ولصقها هنا للتحقق التلقائي:", textAlign: TextAlign.center, style: TextStyle(fontSize: 14)),
const Text(
"بعد إتمام التحويل، يرجى نسخ رسالة البنك النصية ولصقها هنا للتحقق التلقائي:",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 14)),
const SizedBox(height: 10),
TextField(
controller: _proofController,
maxLines: 4,
decoration: InputDecoration(
hintText: "قم بلصق نص رسالة التحويل هنا...",
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
border:
OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
filled: true,
fillColor: Colors.white,
),
@@ -172,15 +268,23 @@ class _PaymentScreenCliqState extends State<PaymentScreenCliq> with SingleTicker
width: double.infinity,
height: 50,
child: ElevatedButton(
style: ElevatedButton.styleFrom(backgroundColor: Colors.blue.shade800, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12))),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue.shade800,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12))),
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 CircularProgressIndicator(color: Colors.white)
: const Text("تحقق من الدفع",
style: TextStyle(
fontSize: 18,
color: Colors.white,
fontWeight: FontWeight.bold)),
),
),
const SizedBox(height: 20),
const Text("جاري فحص الفاتورة تلقائياً كل 5 ثوانٍ...", style: TextStyle(color: Colors.grey, fontSize: 12)),
const Text("جاري فحص الفاتورة تلقائياً كل 5 ثوانٍ...",
style: TextStyle(color: Colors.grey, fontSize: 12)),
],
),
);
@@ -192,13 +296,20 @@ class _PaymentScreenCliqState extends State<PaymentScreenCliq> with SingleTicker
children: [
const Icon(Icons.verified_rounded, color: Colors.green, size: 100),
const SizedBox(height: 20),
const Text("تم الدفع بنجاح!", style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold)),
const Text("تم الدفع بنجاح!",
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold)),
const SizedBox(height: 40),
SizedBox(
width: double.infinity,
child: ElevatedButton(
style: ElevatedButton.styleFrom(backgroundColor: Colors.green, foregroundColor: Colors.white, padding: const EdgeInsets.symmetric(vertical: 16)),
onPressed: () { Get.back(); Get.back(); },
style: ElevatedButton.styleFrom(
backgroundColor: Colors.green,
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 16)),
onPressed: () {
Get.back();
Get.back();
},
child: const Text("متابعة", style: TextStyle(fontSize: 18)),
),
),
@@ -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/ui/siro_ui.dart';
class PaymentScreenMtn extends StatefulWidget {
final double amount;
@@ -89,9 +90,8 @@ class _PaymentScreenMtnState extends State<PaymentScreenMtn> with SingleTickerPr
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[50],
appBar: AppBar(title: const Text("MTN Payment"), centerTitle: true, backgroundColor: Colors.white, foregroundColor: Colors.black),
return SiroPage(
title: "MTN Payment",
body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(20.0),
@@ -131,6 +131,30 @@ class _PaymentScreenMtnState extends State<PaymentScreenMtn> with SingleTickerPr
children: [
const Text("يرجى تحويل المبلغ إلى الرقم التالي:", textAlign: TextAlign.center, style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
const SizedBox(height: 15),
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(color: Colors.amber.shade50, borderRadius: BorderRadius.circular(8), border: Border.all(color: Colors.amber.shade200)),
child: Column(
children: [
const Text("⚠️ هام جداً: يجب إدخال رقم الفاتورة التالي في (ملاحظات التحويل) عند الدفع:", textAlign: TextAlign.center, style: TextStyle(fontSize: 14, color: Colors.brown, fontWeight: FontWeight.bold)),
const SizedBox(height: 8),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(widget.invoiceNumber, style: const TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Colors.black)),
IconButton(
icon: const Icon(Icons.copy, color: Colors.brown, size: 20),
onPressed: () {
Clipboard.setData(ClipboardData(text: widget.invoiceNumber));
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text("تم نسخ رقم الفاتورة ✅", textAlign: TextAlign.center), backgroundColor: Colors.amber));
},
),
],
),
],
),
),
const SizedBox(height: 15),
InkWell(
onTap: () {
Clipboard.setData(ClipboardData(text: widget.mtnNumber));
@@ -1,12 +1,12 @@
import 'package:tripz_driver/constant/currency.dart';
import 'package:siro_driver/constant/currency.dart';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:local_auth/local_auth.dart';
import 'package:tripz_driver/controller/home/payment/captain_wallet_controller.dart';
import 'package:tripz_driver/controller/payment/payment_controller.dart';
import 'package:tripz_driver/controller/payment/smsPaymnet/payment_services.dart';
import 'package:siro_driver/controller/home/payment/captain_wallet_controller.dart';
import 'package:siro_driver/controller/payment/payment_controller.dart';
import 'package:siro_driver/controller/payment/smsPaymnet/payment_services.dart';
import 'package:webview_flutter/webview_flutter.dart';
import '../../../constant/box_name.dart';
@@ -188,15 +188,9 @@ class PointsCaptain extends StatelessWidget {
_buildPaymentMethodTile(
icon: Icons.qr_code_scanner_rounded,
title: 'CliQ'.tr,
subtitle: 'Pay via CliQ (Alias: tripzapp)'.tr,
subtitle: 'Pay via CliQ (Alias: siroapp)'.tr,
color: Colors.purple,
onTap: () {
Get.back();
MyDialog().getDialog(
'CliQ Payment'.tr,
'Please transfer the amount to alias: tripzapp'.tr,
() => Get.back());
},
onTap: () => _showPhoneInputDialog(context, 'CliQ'),
),
],
if (box.read(BoxName.countryCode) == 'Egypt') ...[
@@ -302,7 +296,7 @@ class PointsCaptain extends StatelessWidget {
child: MyTextForm(
controller: paymentController.walletphoneController,
label: 'Phone Number'.tr,
hint: provider == 'Syriatel' ? '963991234567' : '963941234567',
hint: provider == 'Syriatel' ? '963991234567' : provider == 'CliQ' ? '0791234567' : '963941234567',
type: TextInputType.phone,
),
),
@@ -316,6 +310,9 @@ class PointsCaptain extends StatelessWidget {
if (provider == 'Syriatel') {
await payWithSyriaTelWallet(
context, pricePoint.toString(), CurrencyHelper.currency);
} else if (provider == 'CliQ') {
captainWalletController.phoneWallet.text = paymentController.walletphoneController.text;
await captainWalletController.payWithClickWallet(context, pricePoint.toString(), CurrencyHelper.currency);
} else {
await payWithMTNWallet(
context, pricePoint.toString(), CurrencyHelper.currency);
@@ -1,12 +1,12 @@
import 'package:tripz_driver/constant/style.dart';
import 'package:tripz_driver/views/widgets/elevated_btn.dart';
import 'package:tripz_driver/views/widgets/my_scafold.dart';
import 'package:tripz_driver/views/widgets/my_textField.dart';
import 'package:tripz_driver/views/widgets/mycircular.dart';
import 'package:tripz_driver/views/widgets/mydialoug.dart';
import 'package:siro_driver/constant/style.dart';
import 'package:siro_driver/views/widgets/elevated_btn.dart';
import 'package:siro_driver/views/widgets/my_scafold.dart';
import 'package:siro_driver/views/widgets/my_textField.dart';
import 'package:siro_driver/views/widgets/mycircular.dart';
import 'package:siro_driver/views/widgets/mydialoug.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:tripz_driver/constant/currency.dart';
import 'package:siro_driver/constant/currency.dart';
import '../../../controller/home/payment/captain_wallet_controller.dart';
@@ -1,21 +1,20 @@
import 'package:tripz_driver/constant/currency.dart';
import 'package:tripz_driver/constant/recharge_tiers.dart';
import 'package:siro_driver/constant/currency.dart';
import 'package:siro_driver/constant/recharge_tiers.dart';
import 'package:local_auth/local_auth.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:tripz_driver/constant/finance_design_system.dart';
import 'package:tripz_driver/controller/home/payment/captain_wallet_controller.dart';
import 'package:tripz_driver/views/widgets/mycircular.dart';
import 'package:tripz_driver/views/widgets/elevated_btn.dart';
import 'package:tripz_driver/views/widgets/my_textField.dart';
import 'package:tripz_driver/views/widgets/mydialoug.dart';
import 'package:tripz_driver/views/widgets/error_snakbar.dart';
import 'package:tripz_driver/constant/box_name.dart';
import 'package:tripz_driver/constant/links.dart';
import 'package:tripz_driver/controller/functions/crud.dart';
import 'package:tripz_driver/main.dart';
import 'package:tripz_driver/views/home/my_wallet/payment_history_driver_page.dart';
import 'package:tripz_driver/controller/payment/driver_payment_controller.dart';
import 'package:siro_driver/constant/finance_design_system.dart';
import 'package:siro_driver/controller/home/payment/captain_wallet_controller.dart';
import 'package:siro_driver/views/widgets/elevated_btn.dart';
import 'package:siro_driver/views/widgets/my_textField.dart';
import 'package:siro_driver/views/widgets/mydialoug.dart';
import 'package:siro_driver/views/widgets/error_snakbar.dart';
import 'package:siro_driver/constant/box_name.dart';
import 'package:siro_driver/constant/links.dart';
import 'package:siro_driver/controller/functions/crud.dart';
import 'package:siro_driver/main.dart';
import 'package:siro_driver/views/home/my_wallet/payment_history_driver_page.dart';
import 'package:siro_driver/controller/payment/driver_payment_controller.dart';
// Import new widgets
import 'points_captain.dart';
@@ -25,43 +24,45 @@ import 'widgets/quick_actions.dart';
import 'widgets/financial_summary_card.dart';
import 'widgets/promo_gamification_card.dart';
import 'widgets/transaction_preview_item.dart';
import '../../widgets/ui/siro_ui.dart';
class WalletCaptainRefactored extends StatelessWidget {
WalletCaptainRefactored({super.key});
class WalletCaptainRefactored extends StatefulWidget {
const WalletCaptainRefactored({super.key});
@override
State<WalletCaptainRefactored> createState() =>
_WalletCaptainRefactoredState();
}
class _WalletCaptainRefactoredState extends State<WalletCaptainRefactored> {
final CaptainWalletController controller = Get.put(CaptainWalletController());
@override
Widget build(BuildContext context) {
void initState() {
super.initState();
// ‏كان التحديث يُنادى داخل build. وbuild يعمل عشرات المرات — عند كل
// ‏إعادة رسم، وكل تغيّر حالة، وكل دوران للشاشة — فكان كل واحدة منها
// ‏تُطلق نداءات شبكية. مكانه هنا: مرة واحدة عند فتح الشاشة، والباقي
// ‏بالسحب للتحديث أو بزر التحديث.
controller.refreshCaptainWallet();
return Scaffold(
backgroundColor: FinanceDesignSystem.backgroundColor,
appBar: AppBar(
title: Text('Driver Balance'.tr,
style: TextStyle(
fontWeight: FontWeight.bold,
color: FinanceDesignSystem.primaryDark)),
backgroundColor: Colors.transparent,
elevation: 0,
centerTitle: true,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios_new_rounded,
color: FinanceDesignSystem.primaryDark, size: 20),
onPressed: () => Get.back(),
}
@override
Widget build(BuildContext context) {
// شريط العنوان من الثيم — لا ألوان مبنيّة يدوياً هنا.
return SiroPage(
title: 'Driver Balance'.tr,
actions: [
IconButton(
icon: const Icon(Icons.refresh_rounded),
onPressed: () => controller.refreshCaptainWallet(),
tooltip: 'Refresh'.tr,
),
actions: [
IconButton(
icon: Icon(Icons.refresh_rounded,
color: FinanceDesignSystem.primaryDark),
onPressed: () => controller.refreshCaptainWallet(),
tooltip: 'Refresh'.tr,
),
],
),
],
body: GetBuilder<CaptainWalletController>(
builder: (controller) {
if (controller.isLoading) {
return const Center(child: MyCircularProgressIndicator());
return const SiroLoading();
}
return SingleChildScrollView(
padding: const EdgeInsets.symmetric(
@@ -130,7 +131,7 @@ class WalletCaptainRefactored extends StatelessWidget {
Text('Recharge Balance'.tr,
style: FinanceDesignSystem.headingStyle),
Icon(Icons.info_outline_rounded,
size: 18, color: Colors.grey.shade400),
size: 18, color: FinanceDesignSystem.textMuted),
],
),
const SizedBox(height: 12),
@@ -218,7 +219,7 @@ class WalletCaptainRefactored extends StatelessWidget {
padding: const EdgeInsets.symmetric(vertical: 20),
child: Center(
child: Text("No transactions yet".tr,
style: TextStyle(color: Colors.grey.shade400))),
style: TextStyle(color: FinanceDesignSystem.textMuted))),
);
}
// Show only last 3
@@ -255,8 +256,9 @@ class WalletCaptainRefactored extends StatelessWidget {
Get.bottomSheet(
Container(
padding: const EdgeInsets.all(24),
// كان `Colors.white` ثابتاً ⇒ ورقة بيضاء بنص فاتح في الوضع الليلي.
decoration: BoxDecoration(
color: Colors.white,
color: FinanceDesignSystem.cardColor,
borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),
),
child: Column(
@@ -1,11 +1,11 @@
import 'package:tripz_driver/constant/currency.dart';
import 'package:siro_driver/constant/currency.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:get/get.dart';
import 'package:tripz_driver/constant/finance_design_system.dart';
import 'package:tripz_driver/views/widgets/mycircular.dart';
import 'package:siro_driver/constant/finance_design_system.dart';
import '../../../controller/payment/driver_payment_controller.dart';
import 'widgets/transaction_preview_item.dart';
import '../../widgets/ui/siro_ui.dart';
class WeeklyPaymentPage extends StatelessWidget {
const WeeklyPaymentPage({super.key});
@@ -14,26 +14,12 @@ class WeeklyPaymentPage extends StatelessWidget {
Widget build(BuildContext context) {
Get.put(DriverWalletHistoryController());
return Scaffold(
backgroundColor: FinanceDesignSystem.backgroundColor,
appBar: AppBar(
title: Text('Weekly Summary'.tr,
style: TextStyle(
fontWeight: FontWeight.bold,
color: FinanceDesignSystem.primaryDark)),
backgroundColor: Colors.transparent,
elevation: 0,
centerTitle: true,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios_new_rounded,
color: FinanceDesignSystem.primaryDark, size: 20),
onPressed: () => Get.back(),
),
),
return SiroPage(
title: 'Weekly Summary'.tr,
body: GetBuilder<DriverWalletHistoryController>(
builder: (controller) {
if (controller.isLoading) {
return const Center(child: MyCircularProgressIndicator());
return const SiroLoading();
}
return Column(
@@ -1,4 +1,4 @@
import 'package:tripz_driver/constant/currency.dart';
import 'package:siro_driver/constant/currency.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../../constant/finance_design_system.dart';
@@ -1,4 +1,4 @@
import 'package:tripz_driver/constant/currency.dart';
import 'package:siro_driver/constant/currency.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../../constant/finance_design_system.dart';
@@ -1,4 +1,4 @@
import 'package:tripz_driver/constant/currency.dart';
import 'package:siro_driver/constant/currency.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../../constant/finance_design_system.dart';