feat : inspection

This commit is contained in:
2025-09-07 20:24:14 +03:30
parent aca9bbfccb
commit d6f4ed433b
22 changed files with 440 additions and 47 deletions

View File

@@ -2,8 +2,8 @@ import 'package:flutter/cupertino.dart' hide LinearGradient;
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/inventory/inventory_model.dart';
import 'package:rasadyar_chicken/data/models/response/kill_house_distribution_info/kill_house_distribution_info.dart';
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
import 'package:rasadyar_chicken/presentation/widget/app_bar.dart';
import 'package:rasadyar_chicken/presentation/widget/steward/widely_used/view.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
@@ -50,7 +50,9 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
height: 40,
decoration: ShapeDecoration(
image: DecorationImage(
image: AssetImage(Assets.images.chicken.path),
image: AssetImage(
Assets.images.chicken.path,
),
fit: BoxFit.cover,
),
shape: RoundedRectangleBorder(
@@ -58,7 +60,9 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
width: 0.25,
color: const Color(0xFFB0B0B0),
),
borderRadius: BorderRadius.circular(4),
borderRadius: BorderRadius.circular(
4,
),
),
),
),
@@ -73,7 +77,10 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
AnimatedRotation(
turns: 180,
duration: Duration(milliseconds: 3000),
child: Icon(CupertinoIcons.chevron_up, size: 18),
child: Icon(
CupertinoIcons.chevron_up,
size: 18,
),
),
],
),
@@ -108,7 +115,9 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
height: 40,
decoration: ShapeDecoration(
image: DecorationImage(
image: AssetImage(Assets.images.chicken.path),
image: AssetImage(
Assets.images.chicken.path,
),
fit: BoxFit.cover,
),
shape: RoundedRectangleBorder(
@@ -116,7 +125,9 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
width: 0.25,
color: const Color(0xFFB0B0B0),
),
borderRadius: BorderRadius.circular(4),
borderRadius: BorderRadius.circular(
4,
),
),
),
),
@@ -141,7 +152,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
),
),
// WidelyUsedWidget(),
widelyWidget(),
SizedBox(height: 20),
],
),
@@ -160,16 +171,19 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
_informationIconCard(
title: 'کمترین سن جوجه ریزیط',
isLoading: data.value == null,
description: data.value?.hatchingMinAge.separatedByComma ?? '0',
iconPath: Assets.vec.truckSvg.path,
description:
'${data.value?.hatchingMinAge.separatedByComma} روز' ?? '0',
iconPath: Assets.vec.homeTrendUpSvg.path,
iconColor: const Color.fromRGBO(85, 97, 93, 1),
bgDescriptionColor: const Color(0xFFE6FAF5),
bgLabelColor: const Color(0xFFB0EFDF),
),
_informationIconCard(
title: 'بیشترین سن جوجه ریزی',
description: data.value?.hatchingMaxAge?.separatedByComma ?? '0',
iconPath: Assets.vec.convertCubeSvg.path,
description:
'${data.value?.hatchingMaxAge.separatedByComma} روز' ?? '0',
iconPath: Assets.vec.homeTrendUpSvg.path,
iconColor: const Color(0xFF6F6164),
bgDescriptionColor: const Color(0xFFEDDCE0),
bgLabelColor: const Color(0xFFE0BCC5),
@@ -191,8 +205,10 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
child: _informationLabelCard(
title: 'تلفات',
isLoading: data.value == null,
description: data.value?.hatchingLosses?.separatedByComma ?? '0',
iconPath: Assets.vec.a3dCubeSquareSvg.path,
unit: 'قطعه',
description:
data.value?.hatchingLosses?.separatedByComma ?? '0',
iconPath: Assets.vec.boxRemoveSvg.path,
iconColor: const Color(0xFF6C5D60),
bgDescriptionColor: const Color(0xFFEDDCE0),
bgLabelColor: const Color(0xFFDDC0C7),
@@ -201,9 +217,11 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
Expanded(
child: _informationLabelCard(
title: 'حجم کشتار شده',
unit: 'قطعه',
isLoading: data.value == null,
description: data.value?.hatchingKilledQuantity.separatedByComma ?? '0',
iconPath: Assets.vec.cubeSearchSvg.path,
description:
data.value?.hatchingKilledQuantity.separatedByComma ?? '0',
iconPath: Assets.vec.closeSquareFilledSvg.path,
iconColor: Color(0xFF2D5FFF),
bgLabelColor: const Color(0xFFAFCBFF),
bgDescriptionColor: const Color(0xFFCEDFFF),
@@ -227,8 +245,9 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
title: 'حجم جوجه ریزی',
isLoading: data.value == null,
unit: 'قطعه',
description: data.value?.hatchingQuantity.separatedByComma ?? '0',
iconPath: Assets.vec.cubeSearchSvg.path,
description:
data.value?.hatchingQuantity.separatedByComma ?? '0',
iconPath: Assets.vec.hashtagSvg.path,
iconColor: const Color(0xFF426060),
bgDescriptionColor: const Color(0xFFC7DFE0),
bgLabelColor: const Color(0xFFA5D1D2),
@@ -239,8 +258,9 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
title: 'مانده در سالن',
unit: 'قطعه',
isLoading: data.value == null,
description: data.value?.hatchingLeftOver.separatedByComma ?? '0',
iconPath: Assets.vec.cubeRotateSvg.path,
description:
data.value?.hatchingLeftOver.separatedByComma ?? '0',
iconPath: Assets.vec.homeHashtagSvg.path,
iconColor: Color(0xFF5C4D64),
bgLabelColor: Color(0xFFC8B8D1),
bgDescriptionColor: Color(0xFFDAD4DD),
@@ -262,7 +282,6 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
child: ObxValue(
(data) => _informationLabelCard(
title: 'کل فارم ها',
titleColor: AppColor.blueNormal,
isLoading: data.value == null,
description: data.value?.farmCount?.separatedByComma ?? '0',
iconPath: Assets.vec.cubeSearchSvg.path,
@@ -281,15 +300,15 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
Expanded(
child: ObxValue((data) {
return _informationLabelCard(
title: 'تعداد جوجه ریزی ها',
title: 'تعداد جوجه ریزی',
isLoading: data.value == null,
description: data.value?.hatchingCount.separatedByComma ?? '0',
iconPath: Assets.vec.cubeWattingSvg.path,
iconPath: Assets.vec.cubeCardSvg.path,
bgDescriptionColor: Colors.white,
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [const Color(0xFFFFE7BB), Colors.white],
colors: [AppColor.greenLightHover, Colors.white],
),
);
}, controller.homeInformation),
@@ -304,7 +323,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
required String description,
required String iconPath,
required Color bgDescriptionColor,
String unit = 'کیلوگرم',
String? unit,
bool isLoading = false,
Color? iconColor,
Color? titleColor,
@@ -343,7 +362,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
Text(
title,
textAlign: TextAlign.right,
style: AppFonts.yekan14.copyWith(
style: AppFonts.yekan10.copyWith(
color: titleColor ?? AppColor.mediumGreyDarkActive,
),
),
@@ -370,12 +389,19 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
Text(
description,
textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
style: AppFonts.yekan12.copyWith(
color: AppColor.mediumGreyDarkActive,
),
),
Text(
unit,
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
Visibility(
visible: unit != null,
child: Text(
unit ?? '',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(
color: AppColor.mediumGreyDarkActive,
),
),
),
],
),
@@ -397,7 +423,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
required Color bgLabelColor,
}) {
return Container(
height: 80.h,
height: 100.h,
width: 145.w,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(8)),
clipBehavior: Clip.hardEdge,
@@ -422,7 +448,9 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
Text(
title,
textAlign: TextAlign.right,
style: AppFonts.yekan14.copyWith(color: AppColor.mediumGreyDarkActive),
style: AppFonts.yekan14.copyWith(
color: AppColor.mediumGreyDarkActive,
),
),
isLoading
@@ -430,7 +458,9 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
: Text(
description,
textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
style: AppFonts.yekan16.copyWith(
color: AppColor.mediumGreyDarkActive,
),
),
Visibility(
@@ -438,7 +468,9 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
child: Text(
unit ?? '',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
style: AppFonts.yekan12.copyWith(
color: AppColor.mediumGreyDarkActive,
),
),
),
],
@@ -499,8 +531,14 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
'کل ورودی به انبار (کیلوگرم)',
model.totalFreeBarsCarcassesWeight.toString(),
),
buildRow('کل فروش (کیلوگرم)', model.realAllocatedWeight.toString()),
buildRow('مانده انبار (کیلوگرم)', model.totalRemainWeight.toString()),
buildRow(
'کل فروش (کیلوگرم)',
model.realAllocatedWeight.toString(),
),
buildRow(
'مانده انبار (کیلوگرم)',
model.totalRemainWeight.toString(),
),
],
),
),
@@ -519,7 +557,9 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
child: Text(
title,
textAlign: TextAlign.right,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
),
Flexible(
@@ -527,7 +567,9 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
child: Text(
value,
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
),
],
@@ -553,7 +595,9 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
Text(
'اطلاعات ارسالی',
textAlign: TextAlign.right,
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
style: AppFonts.yekan16Bold.copyWith(
color: AppColor.blueNormal,
),
),
const SizedBox(height: 12),
buildRow(
@@ -605,4 +649,193 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
),
);
}
Widget widelyWidget() {
return Column(
children: [
Padding(
padding: EdgeInsetsGeometry.all(6),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'پر کاربرد ها',
textAlign: TextAlign.right,
style: AppFonts.yekan16,
),
],
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 2.0, vertical: 2),
child: Wrap(
spacing: 15,
runSpacing: 8,
children: [
widelyUsed(
title: 'بازرسی',
iconPath: Assets.vec.cubeSearchSvg.path,
isOnEdit: false,
cardColor: AppColor.greenLightActive,
labelColor: AppColor.greenNormal,
textColor: AppColor.greenDarkHover,
onTap: () async {
controller.rootLogic.currentPage.value = 0;
controller.rootLogic.currentPage.refresh();
await Future.delayed(Duration(milliseconds: 100));
Get.toNamed(ChickenRoutes.inspectionPoultryScience, id: 0);
},
),
widelyUsed(
title: 'ثبت کشتار',
iconPath: Assets.vec.noteRemoveSvg.path,
onTap: () async {
controller.rootLogic.currentPage.value = 0;
controller.rootLogic.currentPage.refresh();
await Future.delayed(Duration(milliseconds: 100));
//Get.toNamed(ChickenRoutes.inspectionPoultryScience, id: 0);
},
isOnEdit: false,
),
widelyUsed(
title: 'فارم ها',
iconPath: Assets.vec.a3dCubeSquareSvg.path,
isOnEdit: false,
onTap: () async {
controller.rootLogic.currentPage.value = 1;
controller.rootLogic.currentPage.refresh();
await Future.delayed(Duration(milliseconds: 100));
// Get.toNamed(ChickenRoutes.salesOutOfProvinceSteward, id: 1);
},
),
widelyUsed(
title: 'جوجه ریزی فعال',
iconPath: Assets.vec.boxTickSvg.path,
isOnEdit: false,
onTap: () async {
controller.rootLogic.currentPage.value = 1;
controller.rootLogic.currentPage.refresh();
await Future.delayed(Duration(milliseconds: 100));
// Get.toNamed(ChickenRoutes.salesInProvinceSteward, id: 1);
},
),
],
),
),
],
);
}
Widget widelyUsed({
required String title,
required String iconPath,
required VoidCallback onTap,
required bool isOnEdit,
Color? cardColor,
Color? labelColor,
Color? textColor,
}) {
return GestureDetector(
onTap: !isOnEdit ? onTap : null,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
spacing: 4,
children: [
Stack(
clipBehavior: Clip.none,
children: [
Container(
width: 48,
height: 48,
padding: EdgeInsets.all(4),
decoration: ShapeDecoration(
color: cardColor ?? Color(0xFFBECDFF),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
child: Container(
width: 40,
height: 40,
decoration: ShapeDecoration(
color: labelColor ?? AppColor.blueNormal,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
child: SvgGenImage.vec(iconPath).svg(
width: 24,
height: 24,
colorFilter: ColorFilter.mode(
Colors.white,
BlendMode.srcIn,
),
fit: BoxFit.cover,
),
),
),
Visibility(
visible: isOnEdit,
child: Container(
width: 48,
height: 48,
padding: EdgeInsets.all(4),
decoration: ShapeDecoration(
color: Colors.white60,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
),
),
Visibility(
visible: isOnEdit,
child: Positioned(
top: -15,
left: -12,
child: SizedBox(
width: 32.w,
height: 32.h,
child: GestureDetector(
onTap: () {},
behavior: HitTestBehavior.translucent,
child: Center(
child: Container(
width: 16,
height: 16,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
),
alignment: Alignment.center,
child: Icon(
CupertinoIcons.minus,
color: AppColor.error,
size: 15,
),
),
),
),
),
),
),
],
),
Text(
title,
style: AppFonts.yekan10.copyWith(
color: textColor ?? AppColor.blueNormal,
),
),
],
),
);
}
}