25-09-22/1
This commit is contained in:
@@ -337,72 +337,111 @@ void showPaymentOptions(BuildContext context, PaymentController controller) {
|
||||
// },
|
||||
// ),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
Get.back();
|
||||
// final formKey = GlobalKey<FormState>();
|
||||
// final phoneController = TextEditingController();
|
||||
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: '963941234567',
|
||||
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));
|
||||
Get.back();
|
||||
await controller.payWithMTNWallet(
|
||||
context,
|
||||
controller.selectedAmount.toString(),
|
||||
'SYP',
|
||||
);
|
||||
await controller.getPassengerWallet();
|
||||
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title: 'Insert Wallet phone number'.tr,
|
||||
content: Form(
|
||||
key: controller.formKey,
|
||||
child: TextFormField(
|
||||
controller: controller.walletphoneController,
|
||||
keyboardType: TextInputType.phone,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Insert Wallet phone number'.tr,
|
||||
hintText: '963941234567',
|
||||
border: OutlineInputBorder(),
|
||||
controller.isLoading = false;
|
||||
controller.update();
|
||||
} else {
|
||||
Toast.show(
|
||||
context,
|
||||
'⚠️ You need to choose an amount!'.tr,
|
||||
AppColor.redColor,
|
||||
);
|
||||
}
|
||||
}
|
||||
}));
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Pay by MTN Wallet'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return '⚠️ Please enter phone number'.tr;
|
||||
} else if (value.length != 12) {
|
||||
return '⚠️ Phone number must be 12 digits'.tr;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Image.asset(
|
||||
'assets/images/cashMTN.png',
|
||||
width: 70,
|
||||
height: 70,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
],
|
||||
),
|
||||
confirm: ElevatedButton(
|
||||
child: Text('OK'.tr),
|
||||
onPressed: () async {
|
||||
if (controller.formKey.currentState!.validate()) {
|
||||
if (controller.selectedAmount != 0) {
|
||||
controller.isLoading = true;
|
||||
controller.update();
|
||||
box.write(BoxName.phoneWallet,
|
||||
(controller.walletphoneController.text));
|
||||
Get.back();
|
||||
await controller.payWithMTNWallet(
|
||||
context,
|
||||
controller.selectedAmount.toString(),
|
||||
'SYP',
|
||||
);
|
||||
await controller.getPassengerWallet();
|
||||
|
||||
controller.isLoading = false;
|
||||
controller.update();
|
||||
} else {
|
||||
Toast.show(
|
||||
context,
|
||||
'⚠️ You need to choose an amount!'.tr,
|
||||
AppColor.redColor,
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
)),
|
||||
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: '963941234567',
|
||||
type: TextInputType.phone)),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'OK'.tr,
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
if (controller.formKey.currentState!.validate()) {
|
||||
box.write(BoxName.phoneWallet,
|
||||
controller.walletphoneController.text);
|
||||
await controller.payWithSyriaTelWallet(context,
|
||||
controller.selectedAmount.toString(), 'SYP');
|
||||
}
|
||||
}));
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Pay by Syriatel Wallet'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Image.asset(
|
||||
'assets/images/syriatel.png',
|
||||
width: 70,
|
||||
height: 70,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Image.asset(
|
||||
'assets/images/mtn.png',
|
||||
width: 70,
|
||||
height: 70,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
)
|
||||
)),
|
||||
],
|
||||
cancelButton: CupertinoActionSheetAction(
|
||||
child: Text('Cancel'.tr),
|
||||
|
||||
Reference in New Issue
Block a user