refactor: update data source and repository structure by removing unused files, enhancing model integration, and adjusting import paths for better organization
This commit is contained in:
@@ -0,0 +1,151 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
|
||||
class PoultryFarmInspectionHomeLogic extends GetxController
|
||||
with GetTickerProviderStateMixin {
|
||||
RxInt selectedSegmentIndex = 0.obs;
|
||||
RxList<Resource<PaginationModel<String>>> inspectionList = RxList([
|
||||
Resource<PaginationModel<String>>.success(
|
||||
PaginationModel(results: ["s", "b", "c", "d"]),
|
||||
),
|
||||
]);
|
||||
RxList<Resource<PaginationModel<String>>> inactiveInspectionList = RxList([
|
||||
Resource<PaginationModel<String>>.success(
|
||||
PaginationModel(results: ["s", "b", "c", "d"]),
|
||||
),
|
||||
]);
|
||||
|
||||
RxInt expandedIndex = RxInt(-1);
|
||||
|
||||
late TabController tabController;
|
||||
|
||||
RxInt selectedTabIndex = 0.obs;
|
||||
|
||||
RxInt activeStepperIndex = 0.obs;
|
||||
|
||||
PageController pageController = PageController(initialPage: 0);
|
||||
|
||||
//step1
|
||||
|
||||
TextEditingController nameOfThePoultryFarmUnit = TextEditingController();
|
||||
|
||||
//step2
|
||||
RxInt sanitaryConditionOfTheHallIndex = (-1).obs;
|
||||
RxInt ventilationStatusIndex = (-1).obs;
|
||||
RxInt beddingStatusIndex = (-1).obs;
|
||||
RxInt waterQualityIndex = (-1).obs;
|
||||
RxInt fuelTypeIndex = (-1).obs;
|
||||
RxInt sampleTypeIndex = (-1).obs;
|
||||
|
||||
//step3
|
||||
RxInt grainQualityInputIndex = (-1).obs;
|
||||
RxInt generatorOperatingStatusIndex = (-1).obs;
|
||||
RxInt workerContractStatusIndex = (-1).obs;
|
||||
RxInt newBeneficiaryRequestIndex = (-1).obs;
|
||||
|
||||
//step4
|
||||
RxInt inspectorConclusionIndex = (-1).obs;
|
||||
TextEditingController inspectorConclusionDescriptionController =
|
||||
TextEditingController();
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
|
||||
activeStepperIndex.listen((value) {
|
||||
pageController.animateToPage(
|
||||
value,
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.linear,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
void toggleExpanded(int index) {
|
||||
expandedIndex.value = expandedIndex.value == index ? -1 : index;
|
||||
}
|
||||
|
||||
void changeSegmentIndex(int index) {
|
||||
if (index == selectedSegmentIndex.value) {
|
||||
return;
|
||||
}
|
||||
expandedIndex.value = -1;
|
||||
selectedSegmentIndex.value = index;
|
||||
}
|
||||
|
||||
void changeTab(int index) {
|
||||
if (index == selectedTabIndex.value) {
|
||||
return;
|
||||
}
|
||||
selectedTabIndex.value = index;
|
||||
}
|
||||
|
||||
void clearForm() {
|
||||
nameOfThePoultryFarmUnit.clear();
|
||||
activeStepperIndex.value = 0;
|
||||
selectedTabIndex.value = 0;
|
||||
}
|
||||
|
||||
void setSanitaryConditionOfTheHallIndex(int index) {
|
||||
sanitaryConditionOfTheHallIndex.value =
|
||||
index == sanitaryConditionOfTheHallIndex.value ? -1 : index;
|
||||
}
|
||||
|
||||
void setFuelTypeIndex(int index) {
|
||||
fuelTypeIndex.value = index == fuelTypeIndex.value ? -1 : index;
|
||||
}
|
||||
|
||||
void setVentilationStatusIndex(int index) {
|
||||
ventilationStatusIndex.value = index == ventilationStatusIndex.value
|
||||
? -1
|
||||
: index;
|
||||
}
|
||||
|
||||
void setBeddingStatusIndex(int index) {
|
||||
beddingStatusIndex.value = index == beddingStatusIndex.value ? -1 : index;
|
||||
}
|
||||
|
||||
void setWaterQualityIndex(int index) {
|
||||
waterQualityIndex.value = index == waterQualityIndex.value ? -1 : index;
|
||||
}
|
||||
|
||||
void setSampleTypeIndex(int index) {
|
||||
sampleTypeIndex.value = index == sampleTypeIndex.value ? -1 : index;
|
||||
}
|
||||
|
||||
void setGrainQualityInputIndex(int index) {
|
||||
grainQualityInputIndex.value = index == grainQualityInputIndex.value
|
||||
? -1
|
||||
: index;
|
||||
}
|
||||
|
||||
void setGeneratorOperatingStatusIndex(int index) {
|
||||
generatorOperatingStatusIndex.value =
|
||||
index == generatorOperatingStatusIndex.value ? -1 : index;
|
||||
}
|
||||
|
||||
void setWorkerContractStatusIndex(int index) {
|
||||
workerContractStatusIndex.value = index == workerContractStatusIndex.value
|
||||
? -1
|
||||
: index;
|
||||
}
|
||||
|
||||
void setNewBeneficiaryRequestIndex(int index) {
|
||||
newBeneficiaryRequestIndex.value = index == newBeneficiaryRequestIndex.value
|
||||
? -1
|
||||
: index;
|
||||
}
|
||||
|
||||
void setInspectorConclusionIndex(int index) {
|
||||
inspectorConclusionIndex.value = index == inspectorConclusionIndex.value
|
||||
? -1
|
||||
: index;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,934 @@
|
||||
import 'package:flutter/material.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/info_card/info_card.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import '../widgets/cu_bottom_sheet.dart';
|
||||
import 'logic.dart';
|
||||
|
||||
class PoultryFarmInspectionHomePage extends GetView<PoultryFarmInspectionHomeLogic> {
|
||||
const PoultryFarmInspectionHomePage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ChickenBasePage(
|
||||
onFilterTap: () {
|
||||
//TODO
|
||||
},
|
||||
|
||||
onSearchTap: () {
|
||||
//TODO
|
||||
},
|
||||
|
||||
onSearchChanged: (data) {
|
||||
//TODO
|
||||
},
|
||||
backId: poultryFirstKey,
|
||||
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
infoCards(),
|
||||
segmentWidget(),
|
||||
ObxValue((data) {
|
||||
return data.value == 0 ? activeInspectionWidget() : inactiveInspectionWidget();
|
||||
}, controller.selectedSegmentIndex),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Positioned(
|
||||
right: 10,
|
||||
bottom: 90.h,
|
||||
child: RFab.add(
|
||||
onPressed: () {
|
||||
Get.bottomSheet(
|
||||
addOrEditBottomSheet(controller),
|
||||
isScrollControlled: true,
|
||||
ignoreSafeArea: false,
|
||||
).then((value) => controller.clearForm());
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Padding infoCards() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(9, 12, 9, 8),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
spacing: 8,
|
||||
children: [
|
||||
cardInfo(value: 2225256, description: 'بازرسی شده', color: const Color(0xFFB6DED8)),
|
||||
cardInfo(value: 2050, description: 'بازرسی نشده', color: const Color(0xFFE9CED7)),
|
||||
cardInfo(value: 2225256, description: 'عملکرد مناسب', color: const Color(0xFFCFE0FF)),
|
||||
cardInfo(value: 55225, description: 'عملکرد ضعیف', color: const Color(0xFFF3D6CB)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Padding segmentWidget() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8, 0, 8, 8),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: RSegment(
|
||||
children: ['بازرسی فعال', 'بایگانی'],
|
||||
selectedIndex: 0,
|
||||
borderColor: const Color(0xFFB4B4B4),
|
||||
selectedBorderColor: AppColor.blueNormal,
|
||||
selectedBackgroundColor: AppColor.blueLight,
|
||||
onSegmentSelected: (index) => controller.changeSegmentIndex(index),
|
||||
backgroundColor: AppColor.whiteGreyNormal,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget activeInspectionWidget() {
|
||||
return Expanded(
|
||||
child: ObxValue((data) {
|
||||
return RPaginatedListView(
|
||||
listType: ListType.separated,
|
||||
resource: data.first,
|
||||
hasMore: false,
|
||||
onLoadMore: () async {},
|
||||
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
|
||||
itemBuilder: (context, index) {
|
||||
return ObxValue((val) {
|
||||
return ExpandableListItem2(
|
||||
selected: val.value.isEqual(index),
|
||||
onTap: () => controller.toggleExpanded(index),
|
||||
index: index,
|
||||
child: activeinspecitonItemListWidget(),
|
||||
secondChild: avtiveInspectionItemListExpandedWidget(),
|
||||
labelColor: AppColor.blueLight,
|
||||
labelIcon: Assets.vec.checkSquareSvg.path,
|
||||
labelIconColor: AppColor.mediumGreyDarkHover,
|
||||
);
|
||||
}, controller.expandedIndex);
|
||||
},
|
||||
itemCount: 2,
|
||||
separatorBuilder: (context, index) => SizedBox(height: 8.h),
|
||||
);
|
||||
}, controller.inspectionList),
|
||||
);
|
||||
}
|
||||
|
||||
Container avtiveInspectionItemListExpandedWidget() {
|
||||
const farmerName = 'آرمان صادقی';
|
||||
const showViolationLabel = true;
|
||||
const violationLabel = 'پیگیری';
|
||||
const breed = 'راس ۳۰۸';
|
||||
const ageInDays = '۴۲';
|
||||
const growPeriod = 'بهار ۱۴۰۴';
|
||||
const licenceNumber = '۱۲۳۴۵۶۷۸';
|
||||
const chickVolume = '۲۵,۰۰۰';
|
||||
const hallRemain = '۲۳,۴۵۰';
|
||||
const losses = '۱,۵۵۰';
|
||||
const vetInfo = 'دکتر نرگس مرادی(۰۹۳۵۴۵۶۶۷۷۹)';
|
||||
const showReportButton = true;
|
||||
const reportStatus = 'ارسال تصویر جوجه ریزی فارم';
|
||||
final reportColor = AppColor.redDark;
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
||||
child: Column(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
farmerName,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
|
||||
),
|
||||
Spacer(),
|
||||
Visibility(
|
||||
visible: showViolationLabel,
|
||||
child: Text(
|
||||
violationLabel,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan10.copyWith(color: AppColor.redDark),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
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),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('نژاد:$breed', style: AppFonts.yekan14.copyWith(color: AppColor.textColor)),
|
||||
Text(
|
||||
' سن $ageInDays (روزه)',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
Text(
|
||||
' دوره جوجه ریزی:$growPeriod',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
buildRow(title: 'شماره مجوز جوجه ریزی', value: licenceNumber),
|
||||
buildUnitRow(title: 'حجم جوجه ریزی', value: chickVolume, unit: '(قطعه)'),
|
||||
buildUnitRow(title: 'مانده در سالن', value: hallRemain, unit: '(قطعه)'),
|
||||
buildUnitRow(title: 'تلفات', value: losses, unit: '(قطعه)'),
|
||||
buildRow(title: 'دامپزشک فارم', value: vetInfo),
|
||||
buildRow(
|
||||
title: 'شرح بازرسی',
|
||||
value: reportStatus,
|
||||
titleStyle: AppFonts.yekan14.copyWith(color: reportColor),
|
||||
valueStyle: AppFonts.yekan14.copyWith(color: reportColor),
|
||||
),
|
||||
Visibility(
|
||||
visible: showReportButton,
|
||||
child: RElevated(
|
||||
text: 'ثبت بازرسی',
|
||||
isFullWidth: true,
|
||||
width: 150.w,
|
||||
height: 40.h,
|
||||
onPressed: () {},
|
||||
textStyle: AppFonts.yekan20.copyWith(color: Colors.white),
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget activeinspecitonItemListWidget() {
|
||||
const farmerName = 'آرمان صادقی';
|
||||
const farmerMobile = '۰۹۱۲۱۲۳۴۵۶۷';
|
||||
const unitName = 'فارم نمونه آفتاب';
|
||||
const unitLicence = 'مجوز ۵۴۲۱-الف';
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
SizedBox(width: 20),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 5,
|
||||
children: [
|
||||
Text(
|
||||
farmerName,
|
||||
textAlign: TextAlign.start,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
Text(
|
||||
farmerMobile,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Column(
|
||||
spacing: 5,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
unitName,
|
||||
textAlign: TextAlign.start,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
Text(
|
||||
unitLicence,
|
||||
textAlign: TextAlign.left,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Assets.vec.scanSvg.svg(
|
||||
width: 32.w,
|
||||
height: 32.h,
|
||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget inactiveInspectionWidget() {
|
||||
return Expanded(
|
||||
child: ObxValue((data) {
|
||||
return RPaginatedListView(
|
||||
listType: ListType.separated,
|
||||
resource: data.first,
|
||||
hasMore: false,
|
||||
onLoadMore: () async {},
|
||||
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
|
||||
itemBuilder: (context, index) {
|
||||
return ObxValue((val) {
|
||||
return ExpandableListItem2(
|
||||
selected: val.value.isEqual(index),
|
||||
onTap: () => controller.toggleExpanded(index),
|
||||
index: index,
|
||||
child: inActiveinspecitonItemListWidget(),
|
||||
secondChild: inAvtiveInspectionItemListExpandedWidget(),
|
||||
labelColor: AppColor.blueLight,
|
||||
labelIcon: Assets.vec.checkSquareSvg.path,
|
||||
labelIconColor: AppColor.mediumGreyDarkHover,
|
||||
);
|
||||
}, controller.expandedIndex);
|
||||
},
|
||||
itemCount: 5,
|
||||
separatorBuilder: (context, index) => SizedBox(height: 8.h),
|
||||
);
|
||||
}, controller.inspectionList),
|
||||
);
|
||||
}
|
||||
|
||||
Widget inActiveinspecitonItemListWidget() {
|
||||
const farmerName = 'زهرا موسوی';
|
||||
const farmerMobile = '۰۹۳۸۸۸۷۷۶۶۵';
|
||||
const unitName = 'کشت و پرورش افق سبز';
|
||||
const unitLicence = 'مجوز ۷۶۳۲-ج';
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
SizedBox(width: 20),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 5,
|
||||
children: [
|
||||
Text(
|
||||
farmerName,
|
||||
textAlign: TextAlign.start,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
Text(
|
||||
farmerMobile,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Column(
|
||||
spacing: 5,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
unitName,
|
||||
textAlign: TextAlign.start,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
Text(
|
||||
unitLicence,
|
||||
textAlign: TextAlign.left,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Assets.vec.scanSvg.svg(
|
||||
width: 32.w,
|
||||
height: 32.h,
|
||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Container inAvtiveInspectionItemListExpandedWidget() {
|
||||
const farmerName = 'زهرا موسوی';
|
||||
const showViolationLabel = false;
|
||||
const violationLabel = 'عادی';
|
||||
const breed = 'کاب ۵۰۰';
|
||||
const ageInDays = '۳۵';
|
||||
const growPeriod = 'پاییز ۱۴۰۳';
|
||||
const licenceNumber = '۸۹۴۵۶۱۲۳';
|
||||
const chickVolume = '۱۸,۵۰۰';
|
||||
const hallRemain = '۱۷,۹۴۰';
|
||||
const losses = '۵۶۰';
|
||||
const vetInfo = 'دکتر حمید نادری(۰۹۱۳۴۴۵۵۶۶۷)';
|
||||
const reportStatus = 'بازدید تایید شده';
|
||||
final reportColor = AppColor.greenNormal;
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
||||
child: Column(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
farmerName,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
|
||||
),
|
||||
Spacer(),
|
||||
Visibility(
|
||||
visible: showViolationLabel,
|
||||
child: Text(
|
||||
violationLabel,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan10.copyWith(color: AppColor.redDark),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
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),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('نژاد:$breed', style: AppFonts.yekan14.copyWith(color: AppColor.textColor)),
|
||||
Text(
|
||||
' سن $ageInDays (روزه)',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
Text(
|
||||
' دوره جوجه ریزی:$growPeriod',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
buildRow(title: 'شماره مجوز جوجه ریزی', value: licenceNumber),
|
||||
buildUnitRow(title: 'حجم جوجه ریزی', value: chickVolume, unit: '(قطعه)'),
|
||||
buildUnitRow(title: 'مانده در سالن', value: hallRemain, unit: '(قطعه)'),
|
||||
buildUnitRow(title: 'تلفات', value: losses, unit: '(قطعه)'),
|
||||
buildRow(title: 'دامپزشک فارم', value: vetInfo),
|
||||
buildRow(
|
||||
title: 'شرح بازرسی',
|
||||
value: reportStatus,
|
||||
titleStyle: AppFonts.yekan14.copyWith(color: reportColor),
|
||||
valueStyle: AppFonts.yekan14.copyWith(color: reportColor),
|
||||
),
|
||||
ROutlinedElevated(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 4,
|
||||
children: [
|
||||
Assets.vec.excelDownloadSvg.svg(
|
||||
width: 24.w,
|
||||
height: 24.h,
|
||||
colorFilter: ColorFilter.mode(AppColor.greenDark, BlendMode.srcIn),
|
||||
),
|
||||
|
||||
Text(
|
||||
'مشاهده جزییات ',
|
||||
style: AppFonts.yekan14Bold.copyWith(color: AppColor.greenDark),
|
||||
),
|
||||
],
|
||||
),
|
||||
borderColor: AppColor.greenDark,
|
||||
onPressed: () {
|
||||
Get.bottomSheet(detailsWidget(), isScrollControlled: true, isDismissible: true);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget detailsWidget() {
|
||||
return BaseBottomSheet(
|
||||
height: Get.height * 0.8,
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 10),
|
||||
child: Text(
|
||||
'جزییات',
|
||||
style: AppFonts.yekan18Bold.copyWith(color: AppColor.iconColor),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(color: AppColor.blackLightHover, height: 1, thickness: 1),
|
||||
ObxValue((data) {
|
||||
return tabBarWidget(
|
||||
['اطلاعات', 'پاییش سلامت', 'زیرساخت', 'مستندات'],
|
||||
controller.selectedTabIndex.value,
|
||||
(index) => controller.changeTab(index),
|
||||
);
|
||||
}, controller.selectedTabIndex),
|
||||
|
||||
ObxValue((data) {
|
||||
switch (data.value) {
|
||||
case 0:
|
||||
return infoTable();
|
||||
case 1:
|
||||
return healthTable();
|
||||
case 2:
|
||||
return infrastructureTable();
|
||||
case 3:
|
||||
return documentsTable();
|
||||
default:
|
||||
return infoTable();
|
||||
}
|
||||
}, controller.selectedTabIndex),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// Expanded در سطح بالاتر
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Container infoTable() {
|
||||
return Container(
|
||||
height: Get.height,
|
||||
width: Get.width,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Text('مشخصات کلی', style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor)),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
|
||||
Container(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
||||
child: Column(
|
||||
children: [
|
||||
rTableRow(title: 'نام واحد مرغداری', value: 'لذیذ'),
|
||||
rTableRow(title: 'کد یکتا / شناسه واحد', value: '2541415'),
|
||||
rTableRow(title: 'نام مالک / بهرهبردار', value: 'مرغداری احمدی'),
|
||||
rTableRow(title: 'موجودی سوخت اضطراری', value: '200 لیتر'),
|
||||
|
||||
rTableRow(title: 'شهر/تعاونی', value: 'خرم آباد/تعاونی خرم آباد'),
|
||||
|
||||
rTableRow(title: 'شماره تلفن واحد', value: '021-12345678'),
|
||||
rTableRow(title: 'دامپزشک فارم', value: 'dd dd (05218569685)'),
|
||||
|
||||
rTableRow(title: 'سالن', value: '2'),
|
||||
rTableRow(title: 'تاریخ ثبت جوجه ریزی', value: '1402/09/19 (10:12)'),
|
||||
rTableRow(title: 'شهر/تعاونی', value: 'خرم آباد/تعاونی خرم آباد'),
|
||||
|
||||
rTableRow(title: 'شماره تلفن واحد', value: '021-12345678'),
|
||||
rTableRow(title: 'دامپزشک فارم', value: 'dd dd (05218569685)'),
|
||||
|
||||
rTableRow(title: 'سالن', value: '2'),
|
||||
rTableRow(title: 'تاریخ ثبت جوجه ریزی', value: '1402/09/19 (10:12)'),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Row rTableRow({String? title, String? value}) {
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 9, vertical: 11),
|
||||
alignment: Alignment.centerRight,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.bgLight2,
|
||||
border: Border(bottom: BorderSide(color: AppColor.blackLightHover, width: 1)),
|
||||
),
|
||||
child: Text(
|
||||
title ?? '',
|
||||
style: AppFonts.yekan14Bold.copyWith(color: AppColor.iconColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 9, vertical: 11),
|
||||
alignment: Alignment.centerRight,
|
||||
decoration: BoxDecoration(
|
||||
border: Border(bottom: BorderSide(color: AppColor.blackLightHover, width: 1)),
|
||||
),
|
||||
child: Text(
|
||||
value ?? '',
|
||||
style: AppFonts.yekan14Bold.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget tabBarWidget(List<String> tabs, int selectedIndex, Function(int) onTabSelected) {
|
||||
return SizedBox(
|
||||
height: 38.h,
|
||||
width: Get.width,
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
Positioned(
|
||||
right: 0,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
child: Row(
|
||||
children: [
|
||||
...tabs.map(
|
||||
(tab) => GestureDetector(
|
||||
onTap: () => onTabSelected(tabs.indexOf(tab)),
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 11),
|
||||
decoration: BoxDecoration(
|
||||
border: tab == tabs[selectedIndex]
|
||||
? Border(bottom: BorderSide(color: AppColor.blueNormalOld, width: 3))
|
||||
: null,
|
||||
),
|
||||
child: Text(
|
||||
tab,
|
||||
style: AppFonts.yekan12Bold.copyWith(
|
||||
color: tab == tabs[selectedIndex]
|
||||
? AppColor.blueNormalOld
|
||||
: AppColor.mediumGrey,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Divider(color: AppColor.blackLightHover, height: 1, thickness: 1),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget healthTable() {
|
||||
return Container(
|
||||
height: Get.height,
|
||||
width: Get.width,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Text('پاییش سلامت', style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor)),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
|
||||
Container(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
||||
child: Column(
|
||||
children: [
|
||||
rTableRow(title: 'نام واحد مرغداری', value: 'لذیذ'),
|
||||
rTableRow(title: 'کد یکتا / شناسه واحد', value: '2541415'),
|
||||
rTableRow(title: 'نام مالک / بهرهبردار', value: 'مرغداری احمدی'),
|
||||
rTableRow(title: 'موجودی سوخت اضطراری', value: '200 لیتر'),
|
||||
|
||||
rTableRow(title: 'شهر/تعاونی', value: 'خرم آباد/تعاونی خرم آباد'),
|
||||
|
||||
rTableRow(title: 'شماره تلفن واحد', value: '021-12345678'),
|
||||
rTableRow(title: 'دامپزشک فارم', value: 'dd dd (05218569685)'),
|
||||
|
||||
rTableRow(title: 'سالن', value: '2'),
|
||||
rTableRow(title: 'تاریخ ثبت جوجه ریزی', value: '1402/09/19 (10:12)'),
|
||||
rTableRow(title: 'شهر/تعاونی', value: 'خرم آباد/تعاونی خرم آباد'),
|
||||
|
||||
rTableRow(title: 'شماره تلفن واحد', value: '021-12345678'),
|
||||
rTableRow(title: 'دامپزشک فارم', value: 'dd dd (05218569685)'),
|
||||
|
||||
rTableRow(title: 'سالن', value: '2'),
|
||||
rTableRow(title: 'تاریخ ثبت جوجه ریزی', value: '1402/09/19 (10:12)'),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget infrastructureTable() {
|
||||
return Container(
|
||||
height: Get.height,
|
||||
width: Get.width,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Text('زیرساخت', style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor)),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
|
||||
Container(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
||||
child: Column(
|
||||
children: [
|
||||
rTableRow(title: 'نام واحد مرغداری', value: 'لذیذ'),
|
||||
rTableRow(title: 'کد یکتا / شناسه واحد', value: '2541415'),
|
||||
rTableRow(title: 'نام مالک / بهرهبردار', value: 'مرغداری احمدی'),
|
||||
rTableRow(title: 'موجودی سوخت اضطراری', value: '200 لیتر'),
|
||||
|
||||
rTableRow(title: 'شهر/تعاونی', value: 'خرم آباد/تعاونی خرم آباد'),
|
||||
|
||||
rTableRow(title: 'شماره تلفن واحد', value: '021-12345678'),
|
||||
rTableRow(title: 'دامپزشک فارم', value: 'dd dd (05218569685)'),
|
||||
|
||||
rTableRow(title: 'سالن', value: '2'),
|
||||
rTableRow(title: 'تاریخ ثبت جوجه ریزی', value: '1402/09/19 (10:12)'),
|
||||
rTableRow(title: 'شهر/تعاونی', value: 'خرم آباد/تعاونی خرم آباد'),
|
||||
|
||||
rTableRow(title: 'شماره تلفن واحد', value: '021-12345678'),
|
||||
rTableRow(title: 'دامپزشک فارم', value: 'dd dd (05218569685)'),
|
||||
|
||||
rTableRow(title: 'سالن', value: '2'),
|
||||
rTableRow(title: 'تاریخ ثبت جوجه ریزی', value: '1402/09/19 (10:12)'),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget documentsTable() {
|
||||
return Container(
|
||||
height: Get.height,
|
||||
width: Get.width,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Text('مستندات', style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor)),
|
||||
],
|
||||
),
|
||||
|
||||
SizedBox(height: 16),
|
||||
|
||||
Container(
|
||||
height: 135.h,
|
||||
width: Get.width,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.bgLight,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 10,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 100.h,
|
||||
width: Get.width,
|
||||
child: ListView.separated(
|
||||
itemCount: 10,
|
||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemBuilder: (context, index) {
|
||||
return Container(
|
||||
width: 80.w,
|
||||
height: 80.h,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0x33000000),
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
image: NetworkImage("https://picsum.photos/150/150?random=$index"),
|
||||
),
|
||||
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (context, index) => SizedBox(width: 10),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 18),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'200 فارم در این سالن تخمین زده شده است.',
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan14Bold.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 16),
|
||||
|
||||
Container(
|
||||
height: 135.h,
|
||||
width: Get.width,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.bgLight,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 10,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 100.h,
|
||||
width: Get.width,
|
||||
child: ListView.separated(
|
||||
itemCount: 10,
|
||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemBuilder: (context, index) {
|
||||
return Container(
|
||||
width: 80.w,
|
||||
height: 80.h,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0x33000000),
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
image: NetworkImage(
|
||||
"https://picsum.photos/150/150?random=${index * 2 + 1}",
|
||||
),
|
||||
),
|
||||
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (context, index) => SizedBox(width: 10),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 18),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'انبار نهاده ها',
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan14Bold.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 16),
|
||||
|
||||
Container(
|
||||
height: 135.h,
|
||||
width: Get.width,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.bgLight,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 10,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 100.h,
|
||||
width: Get.width,
|
||||
child: ListView.separated(
|
||||
itemCount: 10,
|
||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemBuilder: (context, index) {
|
||||
return Container(
|
||||
width: 80.w,
|
||||
height: 80.h,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0x33000000),
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
image: NetworkImage(
|
||||
"https://picsum.photos/150/150?random=${index * 3 + 1}",
|
||||
),
|
||||
),
|
||||
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (context, index) => SizedBox(width: 10),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 18),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'تلفات',
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan14Bold.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user