fix : some ui bug

This commit is contained in:
2025-09-20 13:12:16 +03:30
parent 0855489952
commit afc5c5be5c
12 changed files with 49 additions and 38 deletions

View File

@@ -41,7 +41,7 @@ class FarmLogic extends GetxController {
RxInt currentPage = 1.obs;
final RxBool isLoadingMoreList = false.obs;
RxList<int> isExpandedList = <int>[].obs;
RxInt expandedIndex = RxInt(-1);
@override
void onReady() {
@@ -92,7 +92,7 @@ class FarmLogic extends GetxController {
previous: res?.previous,
results: [
...(farmList.value.data?.results ?? []),
...?(res?.results as List<PoultryFarm>?),
...?res?.results,
],
),
);
@@ -101,4 +101,7 @@ class FarmLogic extends GetxController {
onError: (error, stackTrace) {},
);
}
void toggleExpanded(int index) {
expandedIndex.value = expandedIndex.value == index ? -1 : index;
}
}

View File

@@ -51,15 +51,15 @@ class FarmPage extends GetView<FarmLogic> {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ExpandableListItem2(
selected: val.contains(index),
onTap: () => controller.isExpandedList.toggle(index),
selected: val.value.isEqual(index),
onTap: () => controller.toggleExpanded(index),
index: index,
child: itemListWidget(item),
secondChild: itemListExpandedWidget(item),
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.cubeScanSvg.path,
);
}, controller.isExpandedList);
}, controller.expandedIndex);
},
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),