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
flutter.sdk=C:\\src\\flutter
flutter.buildMode=debug
flutter.versionName=1.3.21
flutter.versionCode=18
flutter.buildMode=release
flutter.versionName=1.3.22
flutter.versionCode=19

View File

@@ -1,5 +1,6 @@
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:rasadyar_chicken/data/data_source/local/chicken_local.dart';
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
@@ -210,9 +211,7 @@ class StewardRootLogic extends GetxController {
final currentRoute = currentNestedKey?.currentState;
fLog(Get.currentRoute);
/*
fLog("onPopScopTaped ==> ${currentNestedKey?.currentState?.canPop()}");
if (currentNestedKey?.currentState?.canPop() == true) {
iLog(currentNestedKey?.currentState?.canPop());
@@ -233,6 +232,6 @@ class StewardRootLogic extends GetxController {
} else {
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/utils/nested_keys_utils.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> {
StewardRootPage({super.key});
@override
Widget build(BuildContext context) {
return ObxValue((data) {

View File

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

View File

@@ -17,7 +17,7 @@ class SegmentationLogic extends GetxController {
RxInt selectedSegmentIndex = 0.obs;
RxBool isExpanded = false.obs;
RxList<int> isExpandedList = <int>[].obs;
RxInt expandedListIndex = (-1).obs;
Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rx<Jalali> toDateFilter = Jalali.now().obs;
RxnString searchedValue = RxnString();
@@ -89,12 +89,12 @@ class SegmentationLogic extends GetxController {
}
void validateForm() {
var weight = int.tryParse(weightController.text.clearComma.trim());
var weight = int.tryParse(weightController.text.trim().clearComma);
isSubmitButtonEnabled.value =
selectedProduct.value != null &&
weightController.text.isNotEmpty &&
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 {
@@ -169,6 +169,7 @@ class SegmentationLogic extends GetxController {
),
onSuccess: (result) {
res = true;
onRefresh();
},
onError: (error, stacktrace) {
res = false;
@@ -196,6 +197,7 @@ class SegmentationLogic extends GetxController {
onSuccess: (result) {
res = true;
isSubmitButtonEnabled.value = true;
onRefresh();
},
onError: (error, stacktrace) {
res = false;
@@ -221,8 +223,17 @@ class SegmentationLogic extends GetxController {
}
Future<void> onRefresh() async {
toggleExpansion();
currentPage.value = 1;
await rootLogic.onRefresh();
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) {
return RPaginatedListView(
onLoadMore: () async => controller.getAllSegmentation(true),
hasMore: data.value.data?.next != null,
listType: ListType.separated,
resource: data.value,
@@ -35,8 +34,8 @@ class SegmentationPage extends GetView<SegmentationLogic> {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ExpandableListItem2(
selected: val.contains(index),
onTap: () => controller.isExpandedList.toggle(index),
selected: val.value == index,
onTap: () => controller.toggleExpansion(index: index),
index: index,
child: itemListWidget(item),
secondChild: itemListExpandedWidget(item, index),
@@ -44,7 +43,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
labelIconColor: AppColor.customGrey,
labelIcon: Assets.vec.convertCubeSvg.path,
);
}, controller.isExpandedList);
}, controller.expandedListIndex);
},
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
@@ -239,7 +238,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
onPressed: () {
buildDeleteDialog(
onConfirm: () async {
controller.isExpandedList.remove(index);
controller.toggleExpansion();
controller.deleteSegmentation(item.key!);
},
onRefresh: () => controller.onRefresh(),
@@ -256,7 +255,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
Widget addOrEditBottomSheet([bool isOnEdit = false]) {
return BaseBottomSheet(
height: 480.h,
height: 500.h,
child: SingleChildScrollView(
child: Form(
key: controller.formKey,
@@ -282,30 +281,23 @@ class SegmentationPage extends GetView<SegmentationLogic> {
SizedBox(
height: 40,
child: ObxValue((data) {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Radio(
value: 1,
groupValue: controller.segmentType.value,
return RadioGroup(
onChanged: (value) {
controller.segmentType.value = value!;
controller.selectedGuildModel.value = null;
controller.selectedGuildModel.refresh();
},
),
groupValue: controller.segmentType.value,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Radio(value: 1),
Text('قطعه‌بندی(کاربر)', style: AppFonts.yekan14),
SizedBox(width: 12),
Radio(
value: 2,
groupValue: controller.segmentType.value,
onChanged: (value) {
controller.segmentType.value = value!;
},
),
Radio(value: 2),
Text('تخصیص به قطعه‌بند', style: AppFonts.yekan14),
],
),
);
}, controller.saleType),
),
@@ -425,8 +417,6 @@ class SegmentationPage extends GetView<SegmentationLogic> {
? await controller.editSegment()
: await controller.createSegment();
if (res) {
await controller.getAllSegmentation();
controller.clearForm();
Get.back();
}
}

View File

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