feat : live stock batch

This commit is contained in:
2025-08-09 16:58:52 +03:30
parent c05086a37b
commit 2669af7a92
16 changed files with 1974 additions and 141 deletions

View File

@@ -136,11 +136,11 @@ class AuthPage extends GetView<AuthLogic> {
})
: null,
validator: (value) {
if (value == null || value.isEmpty) {
/* if (value == null || value.isEmpty) {
return '⚠️ شماره موبایل را وارد کنید';
} else if (value.length < 10) {
return '⚠️ شماره موبایل باید 11 رقم باشد';
}
}*/
return null;
},
style: AppFonts.yekan13,

File diff suppressed because one or more lines are too long

View File

@@ -42,12 +42,10 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
flex: 2,
child: RElevated(
height: 40.h,
onPressed: () {
controller.currentIndex.value++;
},
enabled: data.value,
// onPressed: controller.onNext,
child: Text('بعدی'),
onPressed: controller.onNext,
isLoading: controller.isLoading.value,
child: Text(controller.currentIndex.value == 2 ? 'ثبت' : 'بعدی'),
backgroundColor: AppColor.blueNormal,
),
),
@@ -186,7 +184,7 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
),
GestureDetector(
onTap: () async {
await controller.pickImage();
await controller.pickImage(controller.rancherImage);
await showCropDialog();
},
child: Container(
@@ -284,7 +282,8 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
style: AppFonts.yekan16Bold.copyWith(color: AppColor.textColor),
),
TextSpan(
text: controller.addressLocationValue.string ?? 'N/A',
text:
'${controller.addressLocationValue.value?.latitude} , ${controller.addressLocationValue.value?.longitude}',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
],
@@ -337,7 +336,7 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
),
GestureDetector(
onTap: () async {
await controller.pickImage();
await controller.pickImage(controller.herdImage);
await showCropDialog();
},
child: Container(
@@ -392,24 +391,11 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
_buildSearchWidget(),
_buildInfoDetails(),
_buildListContent(),
SizedBox(height: 10),
Padding(
padding: const EdgeInsets.fromLTRB(35, 0, 35, 20),
child: RElevated(
text: 'ثبت نهایی و ارسال به اتحادیه',
textStyle: AppFonts.yekan18,
height: 40,
backgroundColor: AppColor.greenNormal,
onPressed: () {},
isFullWidth: true,
),
),
],
),
Positioned(
right: 10,
bottom: 75,
bottom: 5,
child: RFab.add(
onPressed: () {
Get.bottomSheet(_buildBottomSheet(), isScrollControlled: true);
@@ -436,26 +422,28 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
Expanded _buildListContent() {
return Expanded(
child: RListView.separated(
itemCount: 20,
padding: EdgeInsets.symmetric(horizontal: 8.w),
itemBuilder: (BuildContext context, int index) {
return ObxValue((val) {
return ExpandableListItem2(
isTag: true,
selected: val.contains(index),
onTap: () => controller.isExpandedList.toggle(index),
index: index,
child: itemListWidget(index),
secondChild: itemListExpandedWidget(index),
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.virtualSvg.path,
);
}, controller.isExpandedList);
},
resource: Resource.success(List.generate(20, (i) => i)),
separatorBuilder: (BuildContext context, int index) => SizedBox(height: 8.h),
),
child: ObxValue((data) {
return RListView.separated(
itemCount: data.length,
padding: EdgeInsets.symmetric(horizontal: 8.w),
itemBuilder: (BuildContext context, int index) {
return ObxValue((val) {
return ExpandableListItem2(
isTag: true,
selected: val.contains(index),
onTap: () => controller.isExpandedList.toggle(index),
index: index,
child: itemListWidget(index),
secondChild: itemListExpandedWidget(index),
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.virtualSvg.path,
);
}, controller.isExpandedList);
},
resource: Resource.success(List.generate(data.length, (i) => i)),
separatorBuilder: (BuildContext context, int index) => SizedBox(height: 8.h),
);
}, controller.livestockList),
);
}
@@ -521,12 +509,13 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: RElevated(
text: 'افزودن دام به گله',
text: 'افزودن دام به گله',
textStyle: AppFonts.yekan18.copyWith(color: Colors.white),
width: Get.width,
backgroundColor: AppColor.greenNormal,
height: 40,
onPressed: () {
controller.addLiveStock();
Get.back();
},
),
@@ -712,45 +701,61 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
SizedBox _buildLiveStockImage() {
return SizedBox(
width: Get.width,
height: 350,
child: Card(
color: Colors.white,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
Expanded(
child: Container(
width: Get.width,
decoration: BoxDecoration(
color: AppColor.lightGreyNormal,
borderRadius: BorderRadius.circular(8),
),
child: Center(child: Assets.images.placeHolder.image(height: 150, width: 200)),
height: 356.h,
child: Container(
padding: EdgeInsets.all(8.r),
decoration: BoxDecoration(
border: Border.all(color: AppColor.lightGreyNormal, width: 1.w),
borderRadius: BorderRadius.circular(8.r),
),
child: Column(
spacing: 8,
children: [
Row(children: [Text('تصویر دام', style: AppFonts.yekan16Bold)]),
Expanded(
child: Container(
width: Get.width,
decoration: BoxDecoration(
color: AppColor.lightGreyNormal,
borderRadius: BorderRadius.circular(8.r),
),
child: Center(
child: ObxValue((tmpImage) {
if (tmpImage.value == null) {
return Assets.vec.placeHolderSvg.svg(height: 150.h, width: 200.w);
} else {
return Image.file(File(tmpImage.value!.path), fit: BoxFit.cover);
}
}, controller.taggingImage),
),
),
SizedBox(height: 15),
Container(
),
GestureDetector(
onTap: () async {
await controller.pickImage(controller.taggingImage);
await showCropDialog();
},
child: Container(
width: Get.width,
height: 40,
height: 40.h,
clipBehavior: Clip.antiAlias,
decoration: ShapeDecoration(
color: AppColor.blueNormal,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
child: Padding(
padding: const EdgeInsets.all(10.0),
padding: EdgeInsets.all(10.r),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('تصویر دام', style: AppFonts.yekan14.copyWith(color: Colors.white)),
Text(' دوربین', style: AppFonts.yekan14.copyWith(color: Colors.white)),
Icon(CupertinoIcons.arrow_up_doc, color: Colors.white),
],
),
),
),
],
),
),
],
),
),
);
@@ -760,7 +765,7 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
return OverlayDropdownWidget(
items: ['نوع پلاک 1', 'نوع پلاک 2', 'نوع پلاک 3'],
onChanged: (value) {
print('Selected Breed: $value');
controller.tagType.value = value;
},
itemBuilder: (item) => Text(item),
labelBuilder: (item) => Text(item ?? 'نوع پلاک'),
@@ -769,6 +774,7 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
TextFiledFixedHint _buildTagNumber() {
return TextFiledFixedHint(
controller: controller.herdTagController,
inputType: InputType.number,
hintText: 'پلاک دام',
onChanged: (String value) {
@@ -779,21 +785,19 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
TextFiledFixedHint _buildFatherTagNumber() {
return TextFiledFixedHint(
controller: controller.fatherTagNumberController,
inputType: InputType.number,
hintText: 'پلاک پدر ',
onChanged: (String value) {
eLog('father Tag: $value');
},
onChanged: (String value) {},
);
}
TextFiledFixedHint _buildMotherTagNumber() {
return TextFiledFixedHint(
controller: controller.motherTagNumberController,
inputType: InputType.number,
hintText: 'پلاک مادر ',
onChanged: (String value) {
eLog('Mother Tag: $value');
},
onChanged: (value) {},
);
}
@@ -801,7 +805,8 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
return OverlayDropdownWidget(
items: ['نوع نژاد 1', 'نوع نژاد 2', 'نوع نژاد 3'],
onChanged: (value) {
print('Selected Breed: $value');
controller.breed.value = value;
eLog('Selected Breed: $value');
},
itemBuilder: (item) => Text(item),
labelBuilder: (item) => Text(item ?? 'نژاد'),
@@ -846,24 +851,39 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
);
}
Container _buildLivestockBirthday() {
return Container(
height: 40,
width: Get.width,
padding: const EdgeInsets.symmetric(horizontal: 12),
decoration: BoxDecoration(
border: Border.all(color: AppColor.darkGreyLight),
borderRadius: BorderRadius.circular(8),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'تاریخ تولد',
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyNormalActive),
),
Text('1404/5/5', style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyNormalActive)),
],
Widget _buildLivestockBirthday() {
return GestureDetector(
onTap: () {
Get.bottomSheet(
modalDatePicker((value) {
controller.dateOfBirth.value = value;
}),
isScrollControlled: true,
isDismissible: true,
ignoreSafeArea: false,
);
},
child: Container(
height: 40,
width: Get.width,
padding: const EdgeInsets.symmetric(horizontal: 12),
decoration: BoxDecoration(
border: Border.all(color: AppColor.darkGreyLight),
borderRadius: BorderRadius.circular(8),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'تاریخ تولد',
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyNormalActive),
),
Text(
'1404/5/5',
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyNormalActive),
),
],
),
),
);
}
@@ -872,7 +892,7 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
return OverlayDropdownWidget(
items: ['گوسفند ماده', 'گوسفند نر', 'بز ماده', 'بز نر', 'گوساله ماده', 'گوساله نر'],
onChanged: (value) {
print('Selected: $value');
controller.species.value = value;
},
itemBuilder: (item) => Text(item),
labelBuilder: (item) => Text(item ?? 'گونه دام'),