fix : some di remove in module page

This commit is contained in:
2025-09-01 10:50:05 +03:30
parent d8eedd106a
commit 5af5d63a1e
12 changed files with 275 additions and 48 deletions

View File

@@ -72,7 +72,7 @@ class ModulesLogic extends GetxController {
void onTapCard(Module? module, int index) async {
if (module == null) {
if(Get.isSnackbarOpen) return;
if (Get.isSnackbarOpen) return;
Get.snackbar(
"در حال توسعه",
"این ماژول به زودی اضافه می‌شود",
@@ -94,12 +94,18 @@ class ModulesLogic extends GetxController {
Future<void> navigateToModule(Module module) async {
var target = getAuthTargetPage(module).entries.first;
if (target.value != null) {
await target.value;
fLog('gooo');
if (target.value?[0] != null) {
isLoading.value = !isLoading.value;
await target.value?[0];
isLoading.value = !isLoading.value;
}
await Get.toNamed(target.key, arguments: module);
fLog('return');
if (target.value?[1] != null) {
await target.value?[1];
}
isLoading.value = !isLoading.value;
Get.toNamed(target.key, arguments: module);
}
Future<void> getSliders() async {

View File

@@ -26,7 +26,6 @@ sealed class AppPages {
name: AppPaths.moduleList,
page: () => ModulesPage(),
binding: BindingsBuilder(() {
Get.lazyPut(() => SliderLogic(), tag: "up");
Get.lazyPut(() => SliderLogic(), tag: "down");
Get.put(ModulesLogic());
@@ -58,14 +57,20 @@ Map<String, Future<void>?> getTargetModule(Module? value) {
}
}
Map<String, Future<void>?> getAuthTargetPage(Module? value) {
Map<String, List<Future<void>?>?> getAuthTargetPage(Module? value) {
switch (value) {
case Module.inspection:
return {InspectionRoutes.auth: setupInspectionDI()};
return {
InspectionRoutes.auth: [setupInspectionDI(), removeInspectionDI()],
};
case Module.liveStocks:
return {LiveStockRoutes.auth: setupLiveStockDI()};
return {
LiveStockRoutes.auth: [setupLiveStockDI(), removeLiveStockDI()],
};
case Module.chicken:
return {ChickenRoutes.auth: setupChickenDI()};
return {
ChickenRoutes.auth: [setupChickenDI(), removeChickenDI()],
};
default:
return {AppPaths.moduleList: null};
}