refactor : inspection
fix : module list remove injection
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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),
|
||||
),
|
||||
),
|
||||
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.bottomSheet(BaseBottomSheet(
|
||||
child: Container(
|
||||
color: AppColor.blueDark,
|
||||
),
|
||||
));
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'جزئیات',
|
||||
style: AppFonts.yekan10.copyWith(color: AppColor.iconColor),
|
||||
),
|
||||
SizedBox(width: 4.w),
|
||||
Assets.vec.arrowLeftSvg.svg(
|
||||
width: 10.w,
|
||||
height: 10.h,
|
||||
colorFilter: ColorFilter.mode(AppColor.iconColor, BlendMode.srcIn),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
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),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: [
|
||||
labelItem(label: 'تعاونی', value: item.cityOperator ?? 'ندارد'),
|
||||
labelItem(label: 'تعداد سالن ', value: item.numberOfHalls?.toString() ?? 'ندارد'),
|
||||
|
||||
labelItem(
|
||||
label: 'مالک/ تلفن',
|
||||
value: '${item.user?.fullname} (${item.user?.mobile})',
|
||||
),
|
||||
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 ?? '-'})',
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'تعاونی : ${item.cityOperator ?? 'ندارد'}',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
|
||||
Text(
|
||||
' تعداد سالن : ${item.numberOfHalls}',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
labelItem(
|
||||
label: 'ظرفیت فارم',
|
||||
value: item.totalCapacity.separatedByCommaFa,
|
||||
unit: 'قطعه',
|
||||
),
|
||||
labelItem(
|
||||
label: 'جوجه ریزی فعال (تعداد دوره)',
|
||||
value:
|
||||
'${(item.hatchingInfo?.activeHatching ?? false) ? 'دارد' : 'ندارد'} (${item.hatchingInfo?.period ?? 0})',
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
buildRow(
|
||||
title: 'مالک/ تلفن',
|
||||
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: 'دامپزشک فارم',
|
||||
value: '${item.vetFarm?.fullName} (${item.vetFarm?.mobile ?? '-'})',
|
||||
),
|
||||
buildUnitRow(
|
||||
title: 'ظرفیت فارم',
|
||||
value: item.totalCapacity.separatedByCommaFa,
|
||||
unit: '(قطعه)',
|
||||
),
|
||||
buildRow(
|
||||
title: 'جوجه ریزی فعال (تعداد دوره) ',
|
||||
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(),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user