fix : some ui bug
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user