Update: 2026-06-26 17:36:57
This commit is contained in:
@@ -7,7 +7,7 @@ import '../functions/crud.dart';
|
||||
class KazanController extends GetxController {
|
||||
var kazanData = {}.obs;
|
||||
var isLoading = false.obs;
|
||||
var selectedCountry = 'Syria'.obs;
|
||||
var selectedCountry = 'سوريا'.obs;
|
||||
final CRUD _crud = CRUD();
|
||||
|
||||
final List<Map<String, String>> countries = [
|
||||
@@ -16,6 +16,12 @@ class KazanController extends GetxController {
|
||||
{'code': 'egypt', 'name': 'مصر', 'flag': '🇪🇬'},
|
||||
];
|
||||
|
||||
String get selectedCountryCode =>
|
||||
countries.firstWhere(
|
||||
(c) => c['name'] == selectedCountry.value,
|
||||
orElse: () => countries.first,
|
||||
)['code']!;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
@@ -30,7 +36,7 @@ class KazanController extends GetxController {
|
||||
Future<void> getKazan() async {
|
||||
isLoading.value = true;
|
||||
try {
|
||||
final countryParam = selectedCountry.value.toLowerCase();
|
||||
final countryParam = selectedCountryCode;
|
||||
var response = await _crud.get(link: "${AppLink.getKazanPercent}?country=$countryParam");
|
||||
if (response != null && response != 'failure' && response != 'token_expired') {
|
||||
var decoded = response is String ? jsonDecode(response) : response;
|
||||
|
||||
Reference in New Issue
Block a user