refactor : inspection

fix : module list remove injection
This commit is contained in:
2025-09-27 12:39:25 +03:30
parent d9a18c968b
commit 0a98c57d75
12 changed files with 210 additions and 131 deletions

View File

@@ -6,6 +6,7 @@ import 'package:rasadyar_core/core.dart';
class GenocideLogic extends GetxController {
List<String> routesName = ['اقدام', 'درخواست کشتارها'];
var tokenService = Get.find<TokenStorageService>();
BaseLogic baseLogic = Get.find<BaseLogic>();
var gService = Get.find<GService>();
var rootLogic = Get.find<PoultryScienceRootLogic>();
var killRegistration = Get.find<KillingRegistrationLogic>();
@@ -37,6 +38,9 @@ class GenocideLogic extends GetxController {
void onClose() {
// TODO: implement onClose
super.onClose();
baseLogic.searchValue.value = null;
baseLogic.isSearchSelected.value = false;
baseLogic.textEditingController.clear();
}
Future<void> getPoultryOrderList([bool loadingMore = false]) async {
@@ -70,23 +74,26 @@ class GenocideLogic extends GetxController {
if ((res?.count ?? 0) == 0) {
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.empty();
} else {
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.success(
PaginationModel<PoultryOrder>(
count: res?.count ?? 0,
next: res?.next,
previous: res?.previous,
results: [...(poultryOrderList.value.data?.results ?? []), ...(res?.results ?? [])],
),
);
if (loadingMore) {
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.success(
PaginationModel<PoultryOrder>(
count: res?.count ?? 0,
next: res?.next,
previous: res?.previous,
results: [...(poultryOrderList.value.data?.results ?? []), ...(res?.results ?? [])],
),
);
} else {
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.success(res!);
}
}
},
);
}
Future<void> deletePoultryOrder(int id) async {
toggleExpanded(-1);
toggleExpanded(-1);
await safeCall(
call: () async => await rootLogic.poultryRepository.deletePoultryOder(
token: rootLogic.tokenService.accessToken.value!,
@@ -98,12 +105,10 @@ class GenocideLogic extends GetxController {
);
}
void toggleExpanded(int index) {
expandedIndex.value = expandedIndex.value == index ? -1 : index;
}
String getRequestType(PoultryOrder item) {
if (item.market ?? false) {
return 'پنل معاملات';

View File

@@ -4,7 +4,6 @@ import 'package:rasadyar_chicken/presentation/pages/poultry_science/killing_regi
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_chicken/presentation/widget/filter_bottom_sheet.dart';
import 'package:rasadyar_chicken/presentation/widget/page_route.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
@@ -15,7 +14,7 @@ class GenocidePage extends GetView<GenocideLogic> {
@override
Widget build(BuildContext context) {
return ChickenBasePage(
routes:controller.routesName,
routes: controller.routesName,
hasSearch: true,
hasFilter: true,
onSearchChanged: (data) {
@@ -23,7 +22,13 @@ class GenocidePage extends GetView<GenocideLogic> {
controller.getPoultryOrderList();
},
backId: poultryFirstKey,
filteringWidget: filterBottomSheet(),
onFilterTap: () {
Get.bottomSheet(
isScrollControlled: true,
backgroundColor: Colors.transparent,
filterBottomSheet(),
);
},
child: Stack(
fit: StackFit.expand,
children: [
@@ -67,7 +72,7 @@ class GenocidePage extends GetView<GenocideLogic> {
child: itemListWidget(item),
secondChild: itemListExpandedWidget(item),
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.cubeScanSvg.path,
labelIcon: Assets.vec.timerSvg.path,
);
}, controller.expandedIndex);
},