feat: add step 5 page and update active stepper logic in poultry farm inspection

This commit is contained in:
2025-11-23 09:13:54 +03:30
parent b52ba76bd8
commit 11927e8283

View File

@@ -0,0 +1,598 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import '../home/logic.dart';
Widget step5Page(PoultryFarmInspectionHomeLogic controller) {
return SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: detailsWidget(controller),
);
}
Widget detailsWidget(PoultryFarmInspectionHomeLogic controller) {
return Column(
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
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 در سطح بالاتر
],
);
}
Column infoTable() {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
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 Column(
mainAxisAlignment: MainAxisAlignment.center,
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 Column(
mainAxisAlignment: MainAxisAlignment.center,
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 Column(
mainAxisAlignment: MainAxisAlignment.center,
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),
),
child: Stack(
fit: StackFit.expand,
children: [
Positioned(
top: 6,
left: 6,
child: Container(
width: 24.w,
height: 24.h,
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Colors.white.withValues(alpha: 0.80),
borderRadius: BorderRadius.circular(4),
),
child: Assets.vec.trashSvg.svg(
width: 16.w,
height: 16.h,
colorFilter: ColorFilter.mode(
AppColor.redNormal,
BlendMode.srcIn,
),
),
),
),
],
),
);
},
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),
),
child: Stack(
fit: StackFit.expand,
children: [
Positioned(
top: 6,
left: 6,
child: Container(
width: 24.w,
height: 24.h,
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Colors.white.withValues(alpha: 0.80),
borderRadius: BorderRadius.circular(4),
),
child: Assets.vec.trashSvg.svg(
width: 16.w,
height: 16.h,
colorFilter: ColorFilter.mode(
AppColor.redNormal,
BlendMode.srcIn,
),
),
),
),
],
),
);
},
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),
),
child: Stack(
fit: StackFit.expand,
children: [
Positioned(
top: 6,
left: 6,
child: Container(
width: 24.w,
height: 24.h,
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Colors.white.withValues(alpha: 0.80),
borderRadius: BorderRadius.circular(4),
),
child: Assets.vec.trashSvg.svg(
width: 16.w,
height: 16.h,
colorFilter: ColorFilter.mode(
AppColor.redNormal,
BlendMode.srcIn,
),
),
),
),
],
),
);
},
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,
),
),
],
),
),
],
),
),
],
);
}