second commit
This commit is contained in:
43
lib/Controller/Customers/Customercontroller.dart
Normal file
43
lib/Controller/Customers/Customercontroller.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../Data/Repository/Customers/getCustomerbytenantidrepository.dart';
|
||||
import '../../Model/Response/Customers/GetCustomerById/GetCustomerByTenantId.dart';
|
||||
|
||||
class CustomerController extends GetxController{
|
||||
|
||||
RxBool progress = true.obs;
|
||||
|
||||
|
||||
List <GetCustomerByTenantIdDetails> getCustomerBytenantId =[];
|
||||
|
||||
GetCustomersByTenantIdRepository getCustomersByNumberTenantIdRepository = GetCustomersByTenantIdRepository();
|
||||
|
||||
TextEditingController searchController = TextEditingController();
|
||||
|
||||
getCustomerByTenantId()async {
|
||||
GetCustomerByTenantId? result = await getCustomersByNumberTenantIdRepository.getCustomerByTenantId();
|
||||
getCustomerByTenantIdResult(result!);
|
||||
}
|
||||
|
||||
RxBool hasLoadedCustomerOnce = false.obs;
|
||||
|
||||
getCustomerByTenantIdResult(GetCustomerByTenantId data) {
|
||||
if (!hasLoadedCustomerOnce.value) {
|
||||
progress.value = true;
|
||||
update();
|
||||
}
|
||||
|
||||
getCustomerBytenantId = data.details ?? [];
|
||||
progress.value = false;
|
||||
hasLoadedCustomerOnce.value = true;
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user