This commit is contained in:
Hamza-Ayed
2023-11-13 17:34:00 +03:00
parent 8d405c5381
commit 8aab58d4aa
26 changed files with 349 additions and 88 deletions

View File

@@ -2,12 +2,15 @@ import 'dart:convert';
import 'package:get/get.dart';
import 'package:ride/constant/links.dart';
import 'package:ride/constant/style.dart';
import 'package:ride/controller/functions/crud.dart';
import 'package:ride/views/home/map_page_passenger.dart';
import 'package:ride/views/widgets/elevated_btn.dart';
class PromosController extends GetxController {
List<dynamic> promoList = [];
bool isloading = true;
bool isLoading = true;
late String promos;
@override
void onInit() {
getPromoBytody();
@@ -17,16 +20,25 @@ class PromosController extends GetxController {
Future getPromoBytody() async {
var res = await CRUD().get(link: AppLink.getPromoBytody, payload: {});
if (res.toString() == 'failure') {
Get.snackbar('failure', 'message');
isloading = false;
Get.defaultDialog(
title: 'No Promo for tody .'.tr,
middleText: '',
titleStyle: AppStyle.title,
confirm: MyElevatedButton(
title: 'Back'.tr,
onPressed: () {
Get.back();
Get.back();
}));
isLoading = false;
update();
} else {
var jsonDecoded = jsonDecode(res);
promoList = jsonDecoded['message'];
print(promoList);
isloading = false;
isLoading = false;
update();
print(promoList);
}
}
}