fix : kill registration form and action page bg

This commit is contained in:
2025-09-22 12:15:13 +03:30
parent a5da59b5dd
commit 0f4a1d8e56
8 changed files with 112 additions and 27 deletions

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 249 KiB

Binary file not shown.

View File

@@ -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<TokenStorageService>();
var gService = Get.find<GService>();
var rootLogic = Get.find<PoultryScienceRootLogic>();
var killRegistration = Get.find<KillingRegistrationLogic>();
Rx<Resource<PaginationModel<PoultryOrder>>> poultryOrderList =
Resource<PaginationModel<PoultryOrder>>.loading().obs;

View File

@@ -36,7 +36,10 @@ class GenocidePage extends GetView<GenocideLogic> {
isScrollControlled: true,
backgroundColor: Colors.transparent,
killRegistrationBottomSheet(),
);
).whenComplete(() {
controller.killRegistration.clearAllFields();
controller.killRegistration.onReady();
});
},
),
),

View File

@@ -25,8 +25,10 @@ class KillingRegistrationLogic extends GetxController {
Rxn<PoultryExport> poultryExport = Rxn<PoultryExport>();
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<List<AllPoultry>>.loading();
poultryList.value = Resource<List<KillRequestPoultry>>.success([]);
poultryHatchingList.value = Resource<List<PoultryHatching>>.success([]);
killHouseList.value = Resource<List<KillHousePoultry>>.success([]);
}
}

View File

@@ -13,16 +13,16 @@ class KillingRegistrationPage extends GetView<KillingRegistrationLogic> {
@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<KillingRegistrationLogic> {
},
),
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),
],
),
);
}

View File

@@ -12,15 +12,13 @@ class PoultryActionPage extends GetView<PoultryActionLogic> {
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()),
],
)
);
}

View File

@@ -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,