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

@@ -10,7 +10,7 @@ class ActiveHatchingLogic extends GetxController {
final RxBool isLoadingMoreList = false.obs;
RxInt currentPage = 1.obs;
RxList<int> isExpandedList = <int>[].obs;
RxInt expandedIndex = RxInt(-1);
List<String> routesName = ['اقدام', 'جوجه ریزی فعال'];
@override
@@ -65,4 +65,8 @@ class ActiveHatchingLogic extends GetxController {
},
);
}
void toggleExpanded(int index) {
expandedIndex.value = expandedIndex.value == index ? -1 : index;
}
}

View File

@@ -37,15 +37,15 @@ class ActiveHatchingPage extends GetView<ActiveHatchingLogic> {
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.checkSquareSvg.path,
);
}, controller.isExpandedList);
}, controller.expandedIndex);
},
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),

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),

View File

@@ -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;
}
}

View File

@@ -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),

View File

@@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart' hide LinearGradient;
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/app_bar.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_core/presentation/widget/custom/information_card_widget.dart';
@@ -219,22 +220,20 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 2.0, vertical: 2),
child: Wrap(
spacing: 15,
runSpacing: 8,
spacing: 24.w,
runSpacing: 8.h,
children: [
widelyUsed(
title: 'بازرسی',
iconPath: Assets.vec.cubeSearchSvg.path,
isOnEdit: false,
cardColor: AppColor.greenLightActive,
labelColor: AppColor.greenNormal,
textColor: AppColor.greenDarkHover,
onTap: () async {
controller.rootLogic.currentPage.value = 0;
controller.rootLogic.currentPage.refresh();
await Future.delayed(Duration(milliseconds: 100));
Get.toNamed(ChickenRoutes.inspectionPoultryScience, id: 0);
Get.toNamed(ChickenRoutes.inspectionPoultryScience, id: poultryFirstKey);
},
),
@@ -244,9 +243,8 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
onTap: () async {
controller.rootLogic.currentPage.value = 0;
controller.rootLogic.currentPage.refresh();
await Future.delayed(Duration(milliseconds: 100));
//Get.toNamed(ChickenRoutes.inspectionPoultryScience, id: 0);
Get.toNamed(ChickenRoutes.inspectionPoultryScience, id: poultryFirstKey);
},
isOnEdit: false,
),
@@ -256,9 +254,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
isOnEdit: false,
onTap: () async {
controller.rootLogic.currentPage.value = 1;
controller.rootLogic.currentPage.refresh();
await Future.delayed(Duration(milliseconds: 100));
// Get.toNamed(ChickenRoutes.salesOutOfProvinceSteward, id: 1);
Get.toNamed(ChickenRoutes.salesOutOfProvinceSteward, id: poultryFirstKey);
},
),
@@ -268,9 +264,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
isOnEdit: false,
onTap: () async {
controller.rootLogic.currentPage.value = 1;
controller.rootLogic.currentPage.refresh();
await Future.delayed(Duration(milliseconds: 100));
// Get.toNamed(ChickenRoutes.salesInProvinceSteward, id: 1);
Get.toNamed(ChickenRoutes.salesInProvinceSteward, id: poultryFirstKey);
},
),
],

View File

@@ -16,7 +16,7 @@ class InspectionPoultryScienceLogic extends GetxController {
final RxBool isLoadingMoreAllocationsMade = false.obs;
RxInt currentPage = 1.obs;
RxList<int> isExpandedList = <int>[].obs;
RxInt expandedIndex = RxInt(-1);
RxList<XFile> pickedImages = <XFile>[].obs;
final List<MultipartFile> _multiPartPickedImages = <MultipartFile>[];
@@ -210,4 +210,8 @@ class InspectionPoultryScienceLogic extends GetxController {
return 0.0;
}
}
void toggleExpanded(int index) {
expandedIndex.value = expandedIndex.value == index ? -1 : index;
}
}

View File

@@ -42,15 +42,15 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
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.checkSquareSvg.path,
);
}, controller.isExpandedList);
}, controller.expandedIndex);
},
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
@@ -335,15 +335,15 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
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: itemListWidgetReport(item),
secondChild: itemListExpandedWidgetReport(item),
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.checkSquareSvg.path,
);
}, controller.isExpandedList);
}, controller.expandedIndex);
},
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),

View File

@@ -62,4 +62,5 @@ class PoultryActionPage extends GetView<PoultryActionLogic> {
);
}, controller.items);
}
}

View File

@@ -47,7 +47,7 @@ class RPaginatedListView<T> extends StatelessWidget {
}*/
if (resource.isLoading) {
return loadingWidget ?? const LoadingWidget();
return loadingWidget ?? LoadingWidget();
}
if (resource.isError) {

View File

@@ -23,7 +23,7 @@ export 'list_item/list_item2.dart';
export 'list_item/list_item_with_out_number.dart';
export 'list_row_item.dart';
export 'list_view/list_view.dart';
export 'loading_widget.dart';
export 'loading/loading_widget.dart';
// other
export 'logo_widget.dart';
export 'marquee/r_marquee.dart';