feat : new changes from back

This commit is contained in:
2025-10-12 12:48:20 +03:30
parent 60dd806f7c
commit e67d3e8c04
7 changed files with 45 additions and 46 deletions

View File

@@ -1,5 +1,5 @@
sdk.dir=C:/Users/Housh11/AppData/Local/Android/Sdk sdk.dir=C:/Users/Housh11/AppData/Local/Android/Sdk
flutter.sdk=C:\\src\\flutter flutter.sdk=C:\\src\\flutter
flutter.buildMode=debug flutter.buildMode=release
flutter.versionName=1.3.21 flutter.versionName=1.3.22
flutter.versionCode=18 flutter.versionCode=19

View File

@@ -1,5 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:rasadyar_chicken/data/data_source/local/chicken_local.dart'; import 'package:rasadyar_chicken/data/data_source/local/chicken_local.dart';
import 'package:rasadyar_chicken/data/di/chicken_di.dart'; import 'package:rasadyar_chicken/data/di/chicken_di.dart';
@@ -210,9 +211,7 @@ class StewardRootLogic extends GetxController {
final currentRoute = currentNestedKey?.currentState; final currentRoute = currentNestedKey?.currentState;
fLog(Get.currentRoute);
/*
fLog("onPopScopTaped ==> ${currentNestedKey?.currentState?.canPop()}"); fLog("onPopScopTaped ==> ${currentNestedKey?.currentState?.canPop()}");
if (currentNestedKey?.currentState?.canPop() == true) { if (currentNestedKey?.currentState?.canPop() == true) {
iLog(currentNestedKey?.currentState?.canPop()); iLog(currentNestedKey?.currentState?.canPop());
@@ -233,6 +232,6 @@ class StewardRootLogic extends GetxController {
} else { } else {
await SystemNavigator.pop(); await SystemNavigator.pop();
} }
}*/ }
} }
} }

View File

@@ -4,13 +4,11 @@ import 'package:rasadyar_chicken/data/models/response/kill_house_distribution_in
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart'; import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart'; import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart'; import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_core/core.dart' hide LinearGradient; import 'package:rasadyar_core/core.dart';
class StewardRootPage extends GetView<StewardRootLogic> { class StewardRootPage extends GetView<StewardRootLogic> {
StewardRootPage({super.key}); StewardRootPage({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ObxValue((data) { return ObxValue((data) {

View File

@@ -201,7 +201,7 @@ class SalesOutOfProvinceLogic extends GetxController {
Future<bool> editSale() async { Future<bool> editSale() async {
bool res = false; bool res = false;
StewardFreeSaleBarRequest requestBody = StewardFreeSaleBarRequest( StewardFreeSaleBarRequest requestBody = StewardFreeSaleBarRequest(
numberOfCarcasses: 0, numberOfCarcasses: int.tryParse(saleCountController.text.clearComma),
weightOfCarcasses: int.tryParse(saleWeightController.text.clearComma), weightOfCarcasses: int.tryParse(saleWeightController.text.clearComma),
date: saleDate.value.toDateTime().formattedDashedGregorian, date: saleDate.value.toDateTime().formattedDashedGregorian,
clearanceCode: quarantineCodeController.text, clearanceCode: quarantineCodeController.text,
@@ -229,6 +229,7 @@ class SalesOutOfProvinceLogic extends GetxController {
} }
Future<void> onRefresh() async { Future<void> onRefresh() async {
toggleExpansion();
currentPage.value = 1; currentPage.value = 1;
resetSubmitForm(); resetSubmitForm();
clearSaleForm(); clearSaleForm();

View File

@@ -17,7 +17,7 @@ class SegmentationLogic extends GetxController {
RxInt selectedSegmentIndex = 0.obs; RxInt selectedSegmentIndex = 0.obs;
RxBool isExpanded = false.obs; RxBool isExpanded = false.obs;
RxList<int> isExpandedList = <int>[].obs; RxInt expandedListIndex = (-1).obs;
Rx<Jalali> fromDateFilter = Jalali.now().obs; Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rx<Jalali> toDateFilter = Jalali.now().obs; Rx<Jalali> toDateFilter = Jalali.now().obs;
RxnString searchedValue = RxnString(); RxnString searchedValue = RxnString();
@@ -89,12 +89,12 @@ class SegmentationLogic extends GetxController {
} }
void validateForm() { void validateForm() {
var weight = int.tryParse(weightController.text.clearComma.trim()); var weight = int.tryParse(weightController.text.trim().clearComma);
isSubmitButtonEnabled.value = isSubmitButtonEnabled.value =
selectedProduct.value != null && selectedProduct.value != null &&
weightController.text.isNotEmpty && weightController.text.isNotEmpty &&
weight! > 0 && weight! > 0 &&
(saleType.value == 1 || (saleType.value == 2 && selectedGuildModel.value != null)); (segmentType.value == 1 || (segmentType.value == 2 && selectedGuildModel.value != null));
} }
Future<void> getAllSegmentation([bool isLoadingMore = false]) async { Future<void> getAllSegmentation([bool isLoadingMore = false]) async {
@@ -169,6 +169,7 @@ class SegmentationLogic extends GetxController {
), ),
onSuccess: (result) { onSuccess: (result) {
res = true; res = true;
onRefresh();
}, },
onError: (error, stacktrace) { onError: (error, stacktrace) {
res = false; res = false;
@@ -196,6 +197,7 @@ class SegmentationLogic extends GetxController {
onSuccess: (result) { onSuccess: (result) {
res = true; res = true;
isSubmitButtonEnabled.value = true; isSubmitButtonEnabled.value = true;
onRefresh();
}, },
onError: (error, stacktrace) { onError: (error, stacktrace) {
res = false; res = false;
@@ -221,8 +223,17 @@ class SegmentationLogic extends GetxController {
} }
Future<void> onRefresh() async { Future<void> onRefresh() async {
toggleExpansion();
currentPage.value = 1; currentPage.value = 1;
await rootLogic.onRefresh(); await rootLogic.onRefresh();
await getAllSegmentation(); await getAllSegmentation();
} }
void toggleExpansion({int? index}) {
if (expandedListIndex.value == index || index == null) {
expandedListIndex.value = -1;
} else {
expandedListIndex.value = index;
}
}
} }

View File

@@ -26,7 +26,6 @@ class SegmentationPage extends GetView<SegmentationLogic> {
child: ObxValue((data) { child: ObxValue((data) {
return RPaginatedListView( return RPaginatedListView(
onLoadMore: () async => controller.getAllSegmentation(true), onLoadMore: () async => controller.getAllSegmentation(true),
hasMore: data.value.data?.next != null, hasMore: data.value.data?.next != null,
listType: ListType.separated, listType: ListType.separated,
resource: data.value, resource: data.value,
@@ -35,8 +34,8 @@ class SegmentationPage extends GetView<SegmentationLogic> {
var item = data.value.data!.results![index]; var item = data.value.data!.results![index];
return ObxValue((val) { return ObxValue((val) {
return ExpandableListItem2( return ExpandableListItem2(
selected: val.contains(index), selected: val.value == index,
onTap: () => controller.isExpandedList.toggle(index), onTap: () => controller.toggleExpansion(index: index),
index: index, index: index,
child: itemListWidget(item), child: itemListWidget(item),
secondChild: itemListExpandedWidget(item, index), secondChild: itemListExpandedWidget(item, index),
@@ -44,7 +43,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
labelIconColor: AppColor.customGrey, labelIconColor: AppColor.customGrey,
labelIcon: Assets.vec.convertCubeSvg.path, labelIcon: Assets.vec.convertCubeSvg.path,
); );
}, controller.isExpandedList); }, controller.expandedListIndex);
}, },
itemCount: data.value.data?.results?.length ?? 0, itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h), separatorBuilder: (context, index) => SizedBox(height: 8.h),
@@ -239,7 +238,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
onPressed: () { onPressed: () {
buildDeleteDialog( buildDeleteDialog(
onConfirm: () async { onConfirm: () async {
controller.isExpandedList.remove(index); controller.toggleExpansion();
controller.deleteSegmentation(item.key!); controller.deleteSegmentation(item.key!);
}, },
onRefresh: () => controller.onRefresh(), onRefresh: () => controller.onRefresh(),
@@ -256,7 +255,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
Widget addOrEditBottomSheet([bool isOnEdit = false]) { Widget addOrEditBottomSheet([bool isOnEdit = false]) {
return BaseBottomSheet( return BaseBottomSheet(
height: 480.h, height: 500.h,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Form( child: Form(
key: controller.formKey, key: controller.formKey,
@@ -282,30 +281,23 @@ class SegmentationPage extends GetView<SegmentationLogic> {
SizedBox( SizedBox(
height: 40, height: 40,
child: ObxValue((data) { child: ObxValue((data) {
return Row( return RadioGroup(
mainAxisAlignment: MainAxisAlignment.start, onChanged: (value) {
children: [ controller.segmentType.value = value!;
Radio( controller.selectedGuildModel.value = null;
value: 1, controller.selectedGuildModel.refresh();
groupValue: controller.segmentType.value, },
onChanged: (value) { groupValue: controller.segmentType.value,
controller.segmentType.value = value!; child: Row(
mainAxisAlignment: MainAxisAlignment.start,
controller.selectedGuildModel.value = null; children: [
controller.selectedGuildModel.refresh(); Radio(value: 1),
}, Text('قطعه‌بندی(کاربر)', style: AppFonts.yekan14),
), SizedBox(width: 12),
Text('قطعه‌بندی(کاربر)', style: AppFonts.yekan14), Radio(value: 2),
SizedBox(width: 12), Text('تخصیص به قطعه‌بند', style: AppFonts.yekan14),
Radio( ],
value: 2, ),
groupValue: controller.segmentType.value,
onChanged: (value) {
controller.segmentType.value = value!;
},
),
Text('تخصیص به قطعه‌بند', style: AppFonts.yekan14),
],
); );
}, controller.saleType), }, controller.saleType),
), ),
@@ -425,8 +417,6 @@ class SegmentationPage extends GetView<SegmentationLogic> {
? await controller.editSegment() ? await controller.editSegment()
: await controller.createSegment(); : await controller.createSegment();
if (res) { if (res) {
await controller.getAllSegmentation();
controller.clearForm();
Get.back(); Get.back();
} }
} }

View File

@@ -1,7 +1,7 @@
name: rasadyar_app name: rasadyar_app
description: "A new Flutter project." description: "A new Flutter project."
publish_to: 'none' publish_to: 'none'
version: 1.3.21+18 version: 1.3.22+19
environment: environment:
sdk: ^3.9.2 sdk: ^3.9.2