refactor : base page

This commit is contained in:
2025-09-24 16:24:45 +03:30
parent d2c495bfb1
commit 19802e913c
23 changed files with 562 additions and 568 deletions

View File

@@ -15,22 +15,32 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
@override
Widget build(BuildContext context) {
return BasePage(
return ChickenBasePage(
hasBack: true,
hasFilter: true,
hasSearch: true,
filteringWidget: filterBottomSheet(),
onSearchChanged: (data) => controller.setSearchValue(data),
backId: poultryFirstKey,
routes: controller.routesName,
//routesWidget: ObxValue((route) => buildContainerPageRoute(route), controller.routesName),
child: Stack(
children: [
Positioned.fill(
child: Assets.vec.chickenPatternSvg.svg(
fit: BoxFit.cover,
colorFilter: ColorFilter.mode(Color(0xFFC3CBDA), BlendMode.srcIn),
),
),
SizedBox(height: 50, child: segmentWidget()),
routesWidget: ObxValue((route) => buildContainerPageRoute(route), controller.routesName),
onBackPressed: () => Get.back(id: poultryFirstKey),
widgets: [
segmentWidget(),
ObxValue((data) {
return data.value == 0 ? hatchingWidget() : reportWidget();
}, controller.selectedSegmentIndex),
],
Expanded(
child: ObxValue((data) {
return data.value == 0 ? hatchingWidget() : reportWidget();
}, controller.selectedSegmentIndex),
),
],
),
);
}
@@ -109,9 +119,10 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('نژاد:${ item.breed?.first.breed ?? 'N/A'}',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor)),
Text(
'نژاد:${item.breed?.first.breed ?? 'N/A'}',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
Text(
' سن ${item.age} (روزه)',
@@ -133,12 +144,14 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
unit: '(قطعه)',
),
buildUnitRow(
title: 'مانده در سالن', value: item.leftOver.separatedByCommaFa, unit: '(قطعه)',),
buildUnitRow(title: 'تلفات', value: item.losses.separatedByCommaFa, unit: '(قطعه)',),
title: 'مانده در سالن',
value: item.leftOver.separatedByCommaFa,
unit: '(قطعه)',
),
buildUnitRow(title: 'تلفات', value: item.losses.separatedByCommaFa, unit: '(قطعه)'),
buildRow(
title: 'دامپزشک فارم',
value: '${item.vetFarm?.vetFarmFullName}(${item.vetFarm?.vetFarmMobile})',
),
buildRow(
title: 'شرح بازرسی',
@@ -188,77 +201,77 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
shrinkWrap: true,
itemCount: controller.pickedImages.length + 1,
itemBuilder: (context, index) {
if (index + 1 < 7&& index == data.length) {
return GestureDetector(
onTap: () async {
await controller.pickImages();
},
child: Container(
width: 80.h,
height: 80.h,
decoration: BoxDecoration(
color: AppColor.lightGreyNormal,
borderRadius: BorderRadius.circular(8.r),
),
child: Center(
child: Icon(
Icons.add_a_photo,
color: AppColor.lightGreyDarker,
size: 32.h,
),
),
),
);
} else {
return Container(
if (index + 1 < 7 && index == data.length) {
return GestureDetector(
onTap: () async {
await controller.pickImages();
},
child: Container(
width: 80.h,
height: 80.h,
decoration: BoxDecoration(
color: AppColor.lightGreyNormal,
borderRadius: BorderRadius.circular(8.r),
),
child: Stack(
children: [
Positioned.fill(
child: Image.file(File(data[index].path), fit: BoxFit.cover),
),
child: Center(
child: Icon(
Icons.add_a_photo,
color: AppColor.lightGreyDarker,
size: 32.h,
),
),
),
);
} else {
return Container(
width: 80.h,
height: 80.h,
decoration: BoxDecoration(
color: AppColor.lightGreyNormal,
borderRadius: BorderRadius.circular(8.r),
),
child: Stack(
children: [
Positioned.fill(
child: Image.file(File(data[index].path), fit: BoxFit.cover),
),
Positioned(
top: 4,
left: 4,
child: GestureDetector(
onTap: () {
controller.removeImage(index);
},
child: Container(
width: 24.w,
height: 24.h,
clipBehavior: Clip.antiAlias,
padding: EdgeInsets.all(4),
decoration: ShapeDecoration(
color: Colors.white.withValues(alpha: 0.80),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4),
),
Positioned(
top: 4,
left: 4,
child: GestureDetector(
onTap: () {
controller.removeImage(index);
},
child: Container(
width: 24.w,
height: 24.h,
clipBehavior: Clip.antiAlias,
padding: EdgeInsets.all(4),
decoration: ShapeDecoration(
color: Colors.white.withValues(alpha: 0.80),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4),
),
child: Assets.vec.trashSvg.svg(
width: 8.w,
height: 8.h,
colorFilter: ColorFilter.mode(
AppColor.redNormal,
BlendMode.srcIn,
),
),
child: Assets.vec.trashSvg.svg(
width: 8.w,
height: 8.h,
colorFilter: ColorFilter.mode(
AppColor.redNormal,
BlendMode.srcIn,
),
),
),
),
],
),
);
}
}, );
},controller.pickedImages),
),
],
),
);
}
},
);
}, controller.pickedImages),
SizedBox(height: 35.h),
Text(
@@ -305,7 +318,7 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
),
).whenComplete(() {
controller.pickedImages.clear();
},);
});
}
Padding segmentWidget() {
@@ -410,8 +423,6 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
item.hatching?.chickenBreed ?? 'N/A',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
],
),
Text(
@@ -428,23 +439,25 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
buildRow(title: 'شماره مجوز جوجه ریزی', value: item.hatching?.licenceNumber ?? 'N/A'),
buildUnitRow(
title: 'حجم جوجه ریزی',
value: item.hatching?.quantity.separatedByCommaFa ?? 'N/A',
title: 'حجم جوجه ریزی',
value: item.hatching?.quantity.separatedByCommaFa ?? 'N/A',
unit: '(قطعه)'
unit: '(قطعه)',
),
buildUnitRow(
title: 'مانده در سالن',
value: item.hatching?.leftOver.separatedByCommaFa ?? 'N/A',
unit: '(قطعه)'
title: 'مانده در سالن',
value: item.hatching?.leftOver.separatedByCommaFa ?? 'N/A',
unit: '(قطعه)',
),
buildUnitRow(
title: 'تلفات',
value: item.hatching?.losses.separatedByCommaFa ?? 'N/A',
unit: '(قطعه)',
),
buildUnitRow(title: 'تلفات',
value: item.hatching?.losses.separatedByCommaFa ?? 'N/A',
unit: '(قطعه)'),
buildRow(
title: 'دامپزشک فارم',
value:
'${item.hatching?.vetFarm?.vetFarmFullname}(${item.hatching?.vetFarm?.vetFarmMobile})',
'${item.hatching?.vetFarm?.vetFarmFullname}(${item.hatching?.vetFarm?.vetFarmMobile})',
),
buildRow(
title: 'شرح بازرسی',
@@ -457,12 +470,16 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
Visibility(
visible: item.realQuantityAi != null,
child: buildRow(
title: 'تعداد تاییده هوش مصنوعی', value: item.realQuantityAi.separatedByComma),
title: 'تعداد تاییده هوش مصنوعی',
value: item.realQuantityAi.separatedByComma,
),
),
Visibility(
visible: item.realQuantity != null,
child: buildRow(
title: 'تعداد تاییده', value: item.realQuantity.separatedByComma ?? '-'),
title: 'تعداد تاییده',
value: item.realQuantity.separatedByComma ?? '-',
),
),
},
@@ -493,7 +510,6 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
visible: item.messageRegistererRole != null,
child: buildRow(title: 'نقش کننده گزارش', value: item.messageRegistererRole ?? '-'),
),
},
SizedBox(
@@ -506,18 +522,17 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
mainAxisSpacing: 10,
crossAxisSpacing: 10,
),
itemBuilder: (context, index) =>
Container(
height: 100.h,
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.r),
image: DecorationImage(
image: NetworkImage(item.image?[index] ?? ''),
fit: BoxFit.cover,
),
),
itemBuilder: (context, index) => Container(
height: 100.h,
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.r),
image: DecorationImage(
image: NetworkImage(item.image?[index] ?? ''),
fit: BoxFit.cover,
),
),
),
),
),
],
@@ -639,7 +654,6 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
);
}
Widget filterBottomSheet() {
return BaseBottomSheet(
height: 200,