11/13/1
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user