fix : some ui bug
This commit is contained in:
@@ -11,7 +11,7 @@ class GenocideLogic extends GetxController {
|
||||
Rx<Resource<PaginationModel<PoultryOrder>>> poultryOrderList =
|
||||
Resource<PaginationModel<PoultryOrder>>.loading().obs;
|
||||
|
||||
RxList<int> isExpandedList = <int>[].obs;
|
||||
RxInt expandedIndex = RxInt(-1);
|
||||
final RxInt currentPage = 1.obs;
|
||||
|
||||
final RxBool isLoadingMore = false.obs;
|
||||
@@ -84,7 +84,7 @@ class GenocideLogic extends GetxController {
|
||||
|
||||
|
||||
Future<void> deletePoultryOrder(int id) async {
|
||||
isExpandedList.clear();
|
||||
toggleExpanded(-1);
|
||||
await safeCall(
|
||||
call: () async => await rootLogic.poultryRepository.deletePoultryOder(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
@@ -95,4 +95,9 @@ class GenocideLogic extends GetxController {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void toggleExpanded(int index) {
|
||||
expandedIndex.value = expandedIndex.value == index ? -1 : index;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,15 +45,15 @@ class GenocidePage extends GetView<GenocideLogic> {
|
||||
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