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

@@ -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,
onChanged: (value) {
controller.segmentType.value = value!;
controller.selectedGuildModel.value = null;
controller.selectedGuildModel.refresh();
},
),
Text('قطعه‌بندی(کاربر)', style: AppFonts.yekan14),
SizedBox(width: 12),
Radio(
value: 2,
groupValue: controller.segmentType.value,
onChanged: (value) {
controller.segmentType.value = value!;
},
),
Text('تخصیص به قطعه‌بند', style: AppFonts.yekan14),
],
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),
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();
}
}