feat : new ui and fix bug's

This commit is contained in:
2025-10-06 10:57:46 +03:30
parent a4c7fa87a3
commit 887aff27ae
44 changed files with 842 additions and 206 deletions

View File

@@ -5,8 +5,6 @@ import 'package:rasadyar_chicken/data/models/response/roles_products/roles_produ
import 'package:rasadyar_chicken/data/models/response/segmentation_model/segmentation_model.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_chicken/presentation/widget/filter_bottom_sheet.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
@@ -23,53 +21,56 @@ class SegmentationPage extends GetView<SegmentationLogic> {
hasBack: false,
child: Stack(
children: [
Positioned.fill(child: ObxValue((data) {
return RPaginatedListView(
onLoadMore: () async => controller.getAllSegmentation(true),
onRefresh: () async {
controller.currentPage.value = 1;
await controller.getAllSegmentation();
},
hasMore: data.value.data?.next != null,
listType: ListType.separated,
resource: data.value,
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
itemBuilder: (context, index) {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ExpandableListItem2(
selected: val.contains(index),
onTap: () => controller.isExpandedList.toggle(index),
index: index,
child: itemListWidget(item),
secondChild: itemListExpandedWidget(item, index),
labelColor: AppColor.blueLight,
labelIconColor: AppColor.customGrey,
labelIcon: Assets.vec.convertCubeSvg.path,
);
}, controller.isExpandedList);
},
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
);
}, controller.segmentationList)),
Positioned.fill(
child: ObxValue((data) {
return RPaginatedListView(
onLoadMore: () async => controller.getAllSegmentation(true),
onRefresh: () async {
controller.currentPage.value = 1;
await controller.getAllSegmentation();
},
hasMore: data.value.data?.next != null,
listType: ListType.separated,
resource: data.value,
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
itemBuilder: (context, index) {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ExpandableListItem2(
selected: val.contains(index),
onTap: () => controller.isExpandedList.toggle(index),
index: index,
child: itemListWidget(item),
secondChild: itemListExpandedWidget(item, index),
labelColor: AppColor.blueLight,
labelIconColor: AppColor.customGrey,
labelIcon: Assets.vec.convertCubeSvg.path,
);
}, controller.isExpandedList);
},
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
);
}, controller.segmentationList),
),
Positioned(
right: 10,
bottom: 90.h,
child: RFab.add(
onPressed: () {
Get.bottomSheet(
addOrEditBottomSheet(),
isScrollControlled: true,
ignoreSafeArea: false,
).whenComplete(() {
controller.clearForm();
});
},
))
right: 10,
bottom: 90.h,
child: RFab.add(
onPressed: () {
Get.bottomSheet(
addOrEditBottomSheet(),
isScrollControlled: true,
ignoreSafeArea: false,
).whenComplete(() {
controller.clearForm();
//defaultShowSuccessMessage('با موفقیت ثبت شد');
});
},
),
),
],
),
);
}
@@ -257,7 +258,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
Widget addOrEditBottomSheet([bool isOnEdit = false]) {
return BaseBottomSheet(
height: 430.h,
height: 480.h,
child: SingleChildScrollView(
child: Form(
key: controller.formKey,
@@ -284,25 +285,25 @@ class SegmentationPage extends GetView<SegmentationLogic> {
height: 40,
child: ObxValue((data) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Radio(
value: 1,
groupValue: controller.saleType.value,
groupValue: controller.segmentType.value,
onChanged: (value) {
controller.saleType.value = value!;
controller.segmentType.value = value!;
controller.selectedGuildModel.value = null;
controller.selectedGuildModel.refresh();
},
),
Text('قطعه‌بندی(مباشر)', style: AppFonts.yekan14),
Text('قطعه‌بندی(کاربر)', style: AppFonts.yekan14),
SizedBox(width: 12),
Radio(
value: 2,
groupValue: controller.saleType.value,
groupValue: controller.segmentType.value,
onChanged: (value) {
controller.saleType.value = value!;
controller.segmentType.value = value!;
},
),
Text('تخصیص به قطعه‌بند', style: AppFonts.yekan14),
@@ -312,7 +313,68 @@ class SegmentationPage extends GetView<SegmentationLogic> {
),
const SizedBox(height: 12),
guildsDropDown(),
ObxValue((data) {
return Visibility(visible: data.value == 2, child: guildsDropDown());
}, controller.segmentType),
],
),
),
Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.darkGreyLight, width: 1),
),
child: Column(
children: [
const SizedBox(height: 8),
SizedBox(
height: 40,
child: ObxValue((data) {
return RadioGroup(
onChanged: (value) {
controller.saleType.value = value ?? 0;
controller.selectedGuildModel.value = null;
controller.selectedGuildModel.refresh();
},
groupValue: controller.saleType.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),
),
const SizedBox(height: 12),
SizedBox(
height: 40,
child: ObxValue((data) {
return RadioGroup(
onChanged: (value) {
controller.quotaType.value = value ?? 0;
},
groupValue: controller.quotaType.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),
),
],
),
),