This commit is contained in:
Hamza-Ayed
2023-08-28 19:13:50 +03:00
parent 63770619d6
commit 069ab52a83
63 changed files with 621 additions and 104 deletions

View File

@@ -0,0 +1,59 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../constant/box_name.dart';
import '../../constant/links.dart';
import '../../main.dart';
import '../functions/crud.dart';
class PaymentController extends GetxController {
bool isloading = false;
bool isWalletCheced = false;
bool isCashCheced = false;
final formKey = GlobalKey<FormState>();
final promo = TextEditingController();
getPassengerWallet() async {
isloading = true;
update();
if (box.read(BoxName.passengerWalletDetails) == null) {
await CRUD().get(link: AppLink.getWalletByPassenger, payload: {
'passenger_id': box.read(BoxName.pasengerID)
}).then((value) {
final total = jsonDecode(value)['message'];
box.write(BoxName.passengerWalletDetails, total);
});
isloading = false;
update();
print('from empty');
print(box.read(BoxName.passengerWalletDetails));
} else {
box.read(BoxName.passengerWalletDetails);
update();
print('from full');
print(box.read(BoxName.passengerWalletDetails));
}
}
void onChangedPymentethodWallet(bool? value) {
isWalletCheced = !isWalletCheced;
isWalletCheced ? isCashCheced = false : isCashCheced = true;
update();
}
void onChangedPymentethodCash(bool? value) {
isCashCheced = !isCashCheced;
isCashCheced ? isWalletCheced = false : isWalletCheced = true;
update();
}
@override
void onInit() {
getPassengerWallet();
super.onInit();
}
}