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

@@ -66,6 +66,18 @@ class ModulesLogic extends GetxController {
getSliders();
}
@override
void onClose() {
eLog("ModulesLogic closed");
super.onClose();
}
@override
void dispose() {
eLog("ModulesLogic disposed");
super.dispose();
}
void saveModule(Module module) {
tokenService.saveModule(module);
tokenService.appModule.value = module;
@@ -102,9 +114,9 @@ class ModulesLogic extends GetxController {
isLoading.value = !isLoading.value;
}
var args = await Get.toNamed(target.key, arguments: module);
await Get.toNamed(target.key, arguments: module);
if (target.value?[1] != null && args == -1) {
if (target.value?[1] != null) {
await target.value?[1]?.call();
}
}

View File

@@ -54,6 +54,7 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
void onInit() {
super.onInit();
fLog(Get.arguments.toString());
_textAnimationController =
AnimationController(vsync: this, duration: const Duration(milliseconds: 1200))
..repeat(reverse: true, count: 2).whenComplete(() {

View File

@@ -26,7 +26,7 @@ class AuthPage extends GetView<AuthLogic> {
),
vecPath: Assets.vec.chickenPatternSvg.path,
),
onPopScopTaped: () => Get.back(result: -1),
onPopScopTaped: () => Get.back(result: "HHHHHHHHEloo"),
child: Stack(
children: [
Center(

View File

@@ -4,7 +4,7 @@ import 'package:rasadyar_core/core.dart';
class ActiveHatchingLogic extends GetxController {
PoultryScienceRootLogic rootLogic = Get.find<PoultryScienceRootLogic>();
BaseLogic baseLogic = Get.find<BaseLogic>();
Rx<Resource<PaginationModel<HatchingModel>>> activeHatchingList =
Resource<PaginationModel<HatchingModel>>.loading().obs;
@@ -13,17 +13,22 @@ class ActiveHatchingLogic extends GetxController {
RxInt expandedIndex = RxInt(-1);
List<String> routesName = ['اقدام', 'جوجه ریزی فعال'];
Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rx<Jalali> toDateFilter = Jalali.now().obs;
RxnString searchedValue = RxnString();
@override
void onReady() {
super.onReady();
getHatchingList();
}
@override
void onClose() {
// TODO: implement onClose
super.onClose();
baseLogic.searchValue.value = null;
baseLogic.isSearchSelected.value = false;
baseLogic.textEditingController.clear();
}
Future<void> getHatchingList([bool isLoadingMore = false]) async {
@@ -32,12 +37,12 @@ class ActiveHatchingLogic extends GetxController {
} else {
activeHatchingList.value = Resource<PaginationModel<HatchingModel>>.loading();
}
/*
if (searchedValue.value != null &&
searchedValue.value!.trim().isNotEmpty &&
currentPage.value > 1) {
currentPage.value = 1;
}*/
}
safeCall(
call: () async => await rootLogic.poultryRepository.getHatchingPoultry(

View File

@@ -3,7 +3,6 @@ import 'package:rasadyar_chicken/data/models/response/hatching/hatching_models.d
import 'package:rasadyar_chicken/presentation/pages/poultry_science/active_hatching/logic.dart';
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/page_route.dart';
import 'package:rasadyar_core/core.dart';
class ActiveHatchingPage extends GetView<ActiveHatchingLogic> {
@@ -12,23 +11,15 @@ class ActiveHatchingPage extends GetView<ActiveHatchingLogic> {
@override
Widget build(BuildContext context) {
return ChickenBasePage(
hasSearch: false,
hasSearch: true,
hasFilter: false,
backId: poultryFirstKey,
//routesWidget: buildContainerPageRoute(controller.routesName),
child: Stack(
children: [
Positioned.fill(
child: Assets.vec.chickenPatternSvg.svg(
fit: BoxFit.cover,
colorFilter: ColorFilter.mode(Colors.grey.shade400, BlendMode.srcIn),
),
),
Positioned.fill(child: Column(children: [hatchingWidget()])),
],
),
routes: controller.routesName,
onSearchChanged: (data) {
controller.searchedValue.value = data;
controller.getHatchingList();
},
child: hatchingWidget(),
/*widgets: [
hatchingWidget()
],*/

View File

@@ -5,8 +5,9 @@ import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/logic.d
import 'package:rasadyar_core/core.dart';
class FarmLogic extends GetxController {
List<String> routesName = ['اقدام', 'فارم ها'];
List<String> routes = ['اقدام', 'فارم ها'];
PoultryScienceRootLogic rootLogic = Get.find<PoultryScienceRootLogic>();
BaseLogic baseLogic = Get.find<BaseLogic>();
final PoultryScienceHomeLogic _homeLogic = Get.find<PoultryScienceHomeLogic>();
RxList<InformationTagData> tagInfo = <InformationTagData>[
InformationTagData(
@@ -42,6 +43,10 @@ class FarmLogic extends GetxController {
final RxBool isLoadingMoreList = false.obs;
RxInt expandedIndex = RxInt(-1);
Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rx<Jalali> toDateFilter = Jalali.now().obs;
RxnString searchedValue = RxnString();
@override
void onReady() {
super.onReady();
@@ -60,6 +65,9 @@ class FarmLogic extends GetxController {
@override
void onClose() {
super.onClose();
baseLogic.searchValue.value = null;
baseLogic.isSearchSelected.value = false;
baseLogic.textEditingController.clear();
}
Future<void> getFarmList([bool isLoadingMore = false]) async {

View File

@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_farm/poultry_farm.dart';
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/label_item.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
@@ -13,10 +15,19 @@ class FarmPage extends GetView<FarmLogic> {
Widget build(BuildContext context) {
return ChickenBasePage(
hasFilter: false,
hasSearch: false,
isBase: true,
routes: [],
hasSearch: true,
onFilterTap: () {
Get.bottomSheet(
isScrollControlled: true,
backgroundColor: Colors.transparent,
filterBottomSheet(),
);
},
onSearchChanged: (data) {
controller.searchedValue.value = data;
controller.getFarmList();
},
routes: controller.routes,
backId: poultryFirstKey,
widgets: [firstTagInformation(), farmListWidget()],
);
@@ -56,7 +67,7 @@ class FarmPage extends GetView<FarmLogic> {
onTap: () => controller.toggleExpanded(index),
index: index,
child: itemListWidget(item),
secondChild: itemListExpandedWidget(item),
secondChild: itemListExpandedWidget2(item),
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.cubeScanSvg.path,
);
@@ -74,25 +85,21 @@ class FarmPage extends GetView<FarmLogic> {
);
}
Container itemListExpandedWidget(PoultryFarm item) {
Container itemListExpandedWidget2(PoultryFarm item) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
child: Column(
spacing: 8,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
item.unitName ?? 'N/A',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
),
Spacer(),
Visibility(
child: Text(
@@ -101,86 +108,63 @@ class FarmPage extends GetView<FarmLogic> {
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
),
],
),
Container(
height: 32,
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: ShapeDecoration(
color: AppColor.blueLight,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1, color: AppColor.blueLightHover),
borderRadius: BorderRadius.circular(8),
),
GestureDetector(
onTap: () {
Get.bottomSheet(BaseBottomSheet(
child: Container(
color: AppColor.blueDark,
),
));
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'تعاونی : ${item.cityOperator ?? 'ندارد'}',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
'جزئیات',
style: AppFonts.yekan10.copyWith(color: AppColor.iconColor),
),
Text(
' تعداد سالن : ${item.numberOfHalls}',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
SizedBox(width: 4.w),
Assets.vec.arrowLeftSvg.svg(
width: 10.w,
height: 10.h,
colorFilter: ColorFilter.mode(AppColor.iconColor, BlendMode.srcIn),
),
],
),
),
],
),
Wrap(
spacing: 8,
runSpacing: 8,
children: [
labelItem(label: 'تعاونی', value: item.cityOperator ?? 'ندارد'),
labelItem(label: 'تعداد سالن ', value: item.numberOfHalls?.toString() ?? 'ندارد'),
buildRow(
title: 'مالک/ تلفن',
labelItem(
label: 'مالک/ تلفن',
value: '${item.user?.fullname} (${item.user?.mobile})',
),
buildRow(title: 'شناسه یکتا', value: item.breedingUniqueId ?? 'N/A'),
buildRow(
title: 'کد اپیدمیولوژیک',
value: item.epidemiologicalCode ?? 'N/A',
),
buildRow(
title: 'کد بهداشتی',
value: item.healthCertificateNumber ?? 'N/A',
),
buildRow(
title: 'دامپزشک فارم',
labelItem(label: 'شناسه یکتا', value: item.breedingUniqueId ?? 'N/A'),
labelItem(label: 'کد اپیدمیولوژیک', value: item.epidemiologicalCode ?? 'N/A'),
labelItem(label: 'کد بهداشتی', value: item.healthCertificateNumber ?? 'N/A'),
labelItem(
label: 'دامپزشک فارم',
value: '${item.vetFarm?.fullName} (${item.vetFarm?.mobile ?? '-'})',
),
buildUnitRow(
title: 'ظرفیت فارم',
labelItem(
label: 'ظرفیت فارم',
value: item.totalCapacity.separatedByCommaFa,
unit: '(قطعه)',
unit: 'قطعه',
),
buildRow(
title: 'جوجه ریزی فعال (تعداد دوره) ',
labelItem(
label: 'جوجه ریزی فعال (تعداد دوره)',
value:
'${(item.hatchingInfo?.activeHatching ?? false) ? 'دارد' : 'ندارد'} (${item.hatchingInfo?.period ?? 0})',
),
/* buildRow(
title: 'شرح بازرسی',
value: item.reportInfo?.image == false ? 'ارسال تصویر جوجه ریزی فارم ' : 'تکمیل شده',
titleStyle: AppFonts.yekan14.copyWith(
color: (item.reportInfo?.image ?? false) ? AppColor.greenNormal : AppColor.redDark,
],
),
valueStyle: AppFonts.yekan14.copyWith(
color: (item.reportInfo?.image ?? false) ? AppColor.greenNormal : AppColor.redDark,
),
),*/
/* Visibility(
visible: (item.reportInfo?.image == false),
child: RElevated(
text: 'ثبت بازرسی',
isFullWidth: true,
width: 150.w,
height: 40.h,
onPressed: () {
cameraBottomSheet(item.id!);
},
textStyle: AppFonts.yekan20.copyWith(color: Colors.white),
backgroundColor: AppColor.greenNormal,
),
),*/
],
),
);
@@ -243,4 +227,12 @@ class FarmPage extends GetView<FarmLogic> {
],
);
}
Widget filterBottomSheet() => filterBottomSheetWidget(
fromDate: controller.fromDateFilter,
onChangedFromDate: (jalali) => controller.fromDateFilter.value = jalali,
toDate: controller.toDateFilter,
onChangedToDate: (jalali) => controller.toDateFilter.value = jalali,
onSubmit: () => controller.getFarmList(),
);
}

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,6 +74,7 @@ class GenocideLogic extends GetxController {
if ((res?.count ?? 0) == 0) {
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.empty();
} else {
if (loadingMore) {
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.success(
PaginationModel<PoultryOrder>(
count: res?.count ?? 0,
@@ -78,13 +83,15 @@ class GenocideLogic extends GetxController {
results: [...(poultryOrderList.value.data?.results ?? []), ...(res?.results ?? [])],
),
);
} else {
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.success(res!);
}
}
},
);
}
Future<void> deletePoultryOrder(int id) async {
toggleExpanded(-1);
await safeCall(
@@ -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);
},

View File

@@ -7,6 +7,7 @@ import 'package:rasadyar_chicken/data/models/response/kill_house_poultry/kill_ho
import 'package:rasadyar_chicken/data/models/response/kill_request_poultry/kill_request_poultry.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_hatching/poultry_hatching.dart';
import 'package:rasadyar_chicken/data/models/response/sell_for_freezing/sell_for_freezing.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/genocide/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/logic.dart';
import 'package:rasadyar_core/core.dart';
@@ -320,6 +321,8 @@ class KillingRegistrationLogic extends GetxController {
if (!formKey.currentState!.validate()) {
return;
}
dLog(double.parse(averageWeightKillsController.text));
KillRegistrationRequest registrationRequest = KillRegistrationRequest(
indexWeight: double.parse(averageWeightKillsController.text),
amount: generatedApprovedPrice.value,
@@ -343,7 +346,7 @@ class KillingRegistrationLogic extends GetxController {
operatorKey: "",
poultryHatchingKey: selectedPoultryHatching.value?.key,
poultryKey: selectedPoultry.value?.key,
quantity: int.parse(quantityKillsController.text),
quantity: int.parse(quantityKillsController.text.clearComma),
role: gService.getRole(Module.chicken),
sendDate: killsDate.value.toDateTime().formattedDashedGregorian,
);
@@ -358,9 +361,11 @@ class KillingRegistrationLogic extends GetxController {
'ثبت با موفقیت انجام شد',
durationInSeconds: 2,
onDismissed: () async {
Get.find<GenocideLogic>().getPoultryOrderList();
Future.delayed(Duration(milliseconds: 300), () {
Get.back();
});
Get.find<GenocideLogic>().getPoultryOrderList();
},
);
},

View File

@@ -0,0 +1,55 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
Widget labelItem({required String label, String? value, String? unit}) {
String getLabelText(String? value, String? unit) {
if (value != null && unit != null) {
return '$value ($unit)';
} else if (value != null) {
return value;
} else {
return 'بدون مقدار';
}
}
return Container(
height: 49.h,
clipBehavior: Clip.antiAlias,
padding: EdgeInsets.fromLTRB(8.w, 7.h, 8.w, 7.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1, color: const Color(0xFFB9B9B9)),
),
child: Column(
spacing: 6,
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisSize: MainAxisSize.min,
spacing: 4,
children: [
Text(
label,
textAlign: TextAlign.right,
style: AppFonts.yekan10.copyWith(color: AppColor.unselectTextColor),
),
Assets.vec.arrowLeftSvg.svg(
width: 10.w,
height: 10.h,
colorFilter: ColorFilter.mode(AppColor.unselectTextColor, BlendMode.srcIn),
),
],
),
Text(
getLabelText(value, unit),
textAlign: TextAlign.right,
style: AppFonts.yekan10.copyWith(color: AppColor.iconColor),
),
],
),
);
}

View File

@@ -1,7 +1,7 @@
name: rasadyar_app
description: "A new Flutter project."
publish_to: 'none'
version: 1.3.8+6
version: 1.3.10+7
environment:
sdk: ^3.9.2