diff --git a/assets/icons/chicken_pattern.svg b/assets/icons/chicken_pattern.svg
new file mode 100644
index 0000000..d7c33e2
--- /dev/null
+++ b/assets/icons/chicken_pattern.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/vec/chicken_pattern.svg.vec b/assets/vec/chicken_pattern.svg.vec
new file mode 100644
index 0000000..a8afc43
Binary files /dev/null and b/assets/vec/chicken_pattern.svg.vec differ
diff --git a/packages/chicken/lib/presentation/pages/poultry_science/genocide/logic.dart b/packages/chicken/lib/presentation/pages/poultry_science/genocide/logic.dart
index 332cc67..86e34f0 100644
--- a/packages/chicken/lib/presentation/pages/poultry_science/genocide/logic.dart
+++ b/packages/chicken/lib/presentation/pages/poultry_science/genocide/logic.dart
@@ -1,4 +1,5 @@
import 'package:rasadyar_chicken/data/models/response/poultry_order/poultry_order.dart';
+import 'package:rasadyar_chicken/presentation/pages/poultry_science/killing_registration/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/logic.dart';
import 'package:rasadyar_core/core.dart';
@@ -7,6 +8,7 @@ class GenocideLogic extends GetxController {
var tokenService = Get.find();
var gService = Get.find();
var rootLogic = Get.find();
+ var killRegistration = Get.find();
Rx>> poultryOrderList =
Resource>.loading().obs;
diff --git a/packages/chicken/lib/presentation/pages/poultry_science/genocide/view.dart b/packages/chicken/lib/presentation/pages/poultry_science/genocide/view.dart
index b045c8f..fb30829 100644
--- a/packages/chicken/lib/presentation/pages/poultry_science/genocide/view.dart
+++ b/packages/chicken/lib/presentation/pages/poultry_science/genocide/view.dart
@@ -36,7 +36,10 @@ class GenocidePage extends GetView {
isScrollControlled: true,
backgroundColor: Colors.transparent,
killRegistrationBottomSheet(),
- );
+ ).whenComplete(() {
+ controller.killRegistration.clearAllFields();
+ controller.killRegistration.onReady();
+ });
},
),
),
diff --git a/packages/chicken/lib/presentation/pages/poultry_science/killing_registration/logic.dart b/packages/chicken/lib/presentation/pages/poultry_science/killing_registration/logic.dart
index c48a20d..161a0af 100644
--- a/packages/chicken/lib/presentation/pages/poultry_science/killing_registration/logic.dart
+++ b/packages/chicken/lib/presentation/pages/poultry_science/killing_registration/logic.dart
@@ -25,8 +25,10 @@ class KillingRegistrationLogic extends GetxController {
Rxn poultryExport = Rxn();
TextEditingController quantityKillsController = TextEditingController();
+ RxBool quantityKillsIsCompleted = false.obs;
TextEditingController quantityLoseController = TextEditingController(text: 0.toString());
TextEditingController averageWeightKillsController = TextEditingController();
+ RxBool averageWeightKillsIsCompleted = false.obs;
TextEditingController priceFreeSaleController = TextEditingController();
RxInt generatedApprovedPrice = 0.obs;
@@ -87,6 +89,7 @@ class KillingRegistrationLogic extends GetxController {
);
}
+
@override
void onClose() {
super.onClose();
@@ -102,7 +105,9 @@ class KillingRegistrationLogic extends GetxController {
void priceListener() {
quantityKillsController.addListener(() {
- if (averageWeightKillsController.text.isNotEmpty && quantityKillsController.text.isNotEmpty) {
+ quantityKillsIsCompleted.value = quantityKillsController.text.trim().isNotEmpty;
+
+ if (averageWeightKillsController.text.isNotEmpty && quantityKillsController.text.trim().isNotEmpty) {
generatedApprovedPrice.value = calculateApprovedPrice().toInt();
priceFreeSaleController.text = generatedApprovedPrice.value.separatedByComma;
@@ -115,7 +120,10 @@ class KillingRegistrationLogic extends GetxController {
});
averageWeightKillsController.addListener(() {
- if (averageWeightKillsController.text.isNotEmpty && quantityKillsController.text.isNotEmpty) {
+
+ averageWeightKillsIsCompleted.value = averageWeightKillsController.text.trim().isNotEmpty;
+
+ if (averageWeightKillsController.text.trim().isNotEmpty && quantityKillsController.text.trim().isNotEmpty) {
generatedApprovedPrice.value = calculateApprovedPrice().toInt();
priceFreeSaleController.text = generatedApprovedPrice.value.separatedByComma;
checkSubmitButton();
@@ -356,10 +364,50 @@ class KillingRegistrationLogic extends GetxController {
Get.back(id: poultryFirstKey);
});
},
-
);
},
onError: (error, stackTrace) {},
);
}
+
+ void clearAllFields() {
+ // ریست فرم
+ formKey.currentState?.reset();
+
+ // ریست Rxn ها
+ approvedPrice.value = null;
+ sellForFreezing.value = null;
+ poultryExport.value = null;
+ selectedPoultry.value = null;
+ selectedKillRequestPoultry.value = null;
+ selectedPoultryHatching.value = null;
+ selectedKillHouse.value = null;
+
+ // ریست Rx ها
+ killsDate.value = Jalali.now();
+ generatedApprovedPrice.value = 0;
+ isOnSubmitLoading.value = false;
+ isExportSelected.value = false;
+ isFreezedSelected.value = false;
+ isMarketSelected.value = false;
+ isFreeSale.value = false;
+
+ // ریست TextEditingController ها
+ quantityKillsController.clear();
+ quantityLoseController.text = '0';
+ averageWeightKillsController.clear();
+ priceFreeSaleController.clear();
+
+ // ریست RxBool ها
+ quantityKillsIsCompleted.value = false;
+ averageWeightKillsIsCompleted.value = false;
+
+ // ریست Resource لیستها
+ allPoultryList.value = Resource>.loading();
+ poultryList.value = Resource>.success([]);
+ poultryHatchingList.value = Resource>.success([]);
+ killHouseList.value = Resource>.success([]);
+ }
+
+
}
diff --git a/packages/chicken/lib/presentation/pages/poultry_science/killing_registration/view.dart b/packages/chicken/lib/presentation/pages/poultry_science/killing_registration/view.dart
index b234599..6a158e0 100644
--- a/packages/chicken/lib/presentation/pages/poultry_science/killing_registration/view.dart
+++ b/packages/chicken/lib/presentation/pages/poultry_science/killing_registration/view.dart
@@ -13,16 +13,16 @@ class KillingRegistrationPage extends GetView {
@override
Widget build(BuildContext context) {
- return Column(
- children: [
- poultryFarmWidget(),
- poultryUserListWidget(),
- poultryHatchingWidget(),
- ObxValue((data) {
- return Visibility(
- visible: controller.selectedPoultryHatching.value != null,
- child: Form(
- key: controller.formKey,
+ return Form(
+ key: controller.formKey,
+ child: Column(
+ children: [
+ poultryFarmWidget(),
+ poultryUserListWidget(),
+ poultryHatchingWidget(),
+ ObxValue((data) {
+ return Visibility(
+ visible: controller.selectedPoultryHatching.value != null,
child: Column(
children: [
informationWidget(),
@@ -33,18 +33,43 @@ class KillingRegistrationPage extends GetView {
},
),
quantityKillsWidget(),
+ ],
+ ),
+ );
+ }, controller.selectedPoultryHatching),
+ ObxValue((data) {
+ return Visibility(
+ visible: data.value,
+ child: Column(
+ children: [
+
averageWeightKillsWidget(),
+
+ ],
+ ),
+ );
+ }, controller.quantityKillsIsCompleted),
+
+ ObxValue((data) {
+ return Visibility(
+ visible: data.value,
+ child: Column(
+ children: [
+
saleTypeWidget(),
priceWidget(),
buyerListWidget(),
slaughterhouseSelectedWidget(),
submitButtonWidget(),
+
],
),
- ),
- );
- }, controller.selectedPoultryHatching),
- ],
+ );
+ }, controller.averageWeightKillsIsCompleted),
+
+
+ ],
+ ),
);
}
diff --git a/packages/chicken/lib/presentation/pages/poultry_science/poultry_action/view.dart b/packages/chicken/lib/presentation/pages/poultry_science/poultry_action/view.dart
index 65a43db..29df72c 100644
--- a/packages/chicken/lib/presentation/pages/poultry_science/poultry_action/view.dart
+++ b/packages/chicken/lib/presentation/pages/poultry_science/poultry_action/view.dart
@@ -12,15 +12,13 @@ class PoultryActionPage extends GetView {
Widget build(BuildContext context) {
return Scaffold(
appBar: chickenAppBar(hasBack: false, hasFilter: false, hasSearch: false, isBase: false),
- body: Container(
- decoration: BoxDecoration(
- image: DecorationImage(
- image: AssetImage(Assets.images.bgChickenPattern.path),
- fit: BoxFit.cover,
- ),
- ),
- child: gridWidget(),
- ),
+ body: Stack(
+ fit: StackFit.expand,
+ children: [
+ Positioned.fill(child: Assets.vec.chickenPatternSvg.svg(fit: BoxFit.cover,)),
+ Positioned.fill(child: gridWidget()),
+ ],
+ )
);
}
diff --git a/packages/core/lib/presentation/common/assets.gen.dart b/packages/core/lib/presentation/common/assets.gen.dart
index 2eeca3a..48f8537 100644
--- a/packages/core/lib/presentation/common/assets.gen.dart
+++ b/packages/core/lib/presentation/common/assets.gen.dart
@@ -89,6 +89,9 @@ class $AssetsIconsGen {
/// File path: assets/icons/chicken_map_marker.svg
SvgGenImage get chickenMapMarker => const SvgGenImage('assets/icons/chicken_map_marker.svg');
+ /// File path: assets/icons/chicken_pattern.svg
+ SvgGenImage get chickenPattern => const SvgGenImage('assets/icons/chicken_pattern.svg');
+
/// File path: assets/icons/clipboard_eye.svg
SvgGenImage get clipboardEye => const SvgGenImage('assets/icons/clipboard_eye.svg');
@@ -350,6 +353,7 @@ class $AssetsIconsGen {
chicken,
chickenHouse,
chickenMapMarker,
+ chickenPattern,
clipboardEye,
clipboardTask,
clock,
@@ -549,6 +553,9 @@ class $AssetsVecGen {
/// File path: assets/vec/chicken_map_marker.svg.vec
SvgGenImage get chickenMapMarkerSvg => const SvgGenImage.vec('assets/vec/chicken_map_marker.svg.vec');
+ /// File path: assets/vec/chicken_pattern.svg.vec
+ SvgGenImage get chickenPatternSvg => const SvgGenImage.vec('assets/vec/chicken_pattern.svg.vec');
+
/// File path: assets/vec/clipboard_eye.svg.vec
SvgGenImage get clipboardEyeSvg => const SvgGenImage.vec('assets/vec/clipboard_eye.svg.vec');
@@ -810,6 +817,7 @@ class $AssetsVecGen {
chickenSvg,
chickenHouseSvg,
chickenMapMarkerSvg,
+ chickenPatternSvg,
clipboardEyeSvg,
clipboardTaskSvg,
clockSvg,