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; final RxBool isLoadingMoreList = false.obs;
RxInt currentPage = 1.obs; RxInt currentPage = 1.obs;
RxList<int> isExpandedList = <int>[].obs; RxInt expandedIndex = RxInt(-1);
List<String> routesName = ['اقدام', 'جوجه ریزی فعال']; List<String> routesName = ['اقدام', 'جوجه ریزی فعال'];
@override @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]; var item = data.value.data!.results![index];
return ObxValue((val) { return ObxValue((val) {
return ExpandableListItem2( return ExpandableListItem2(
selected: val.contains(index), selected: val.value.isEqual(index),
onTap: () => controller.isExpandedList.toggle(index), onTap: () => controller.toggleExpanded(index),
index: index, index: index,
child: itemListWidget(item), child: itemListWidget(item),
secondChild: itemListExpandedWidget(item), secondChild: itemListExpandedWidget(item),
labelColor: AppColor.blueLight, labelColor: AppColor.blueLight,
labelIcon: Assets.vec.checkSquareSvg.path, labelIcon: Assets.vec.checkSquareSvg.path,
); );
}, controller.isExpandedList); }, controller.expandedIndex);
}, },
itemCount: data.value.data?.results?.length ?? 0, itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h), separatorBuilder: (context, index) => SizedBox(height: 8.h),

View File

@@ -41,7 +41,7 @@ class FarmLogic extends GetxController {
RxInt currentPage = 1.obs; RxInt currentPage = 1.obs;
final RxBool isLoadingMoreList = false.obs; final RxBool isLoadingMoreList = false.obs;
RxList<int> isExpandedList = <int>[].obs; RxInt expandedIndex = RxInt(-1);
@override @override
void onReady() { void onReady() {
@@ -92,7 +92,7 @@ class FarmLogic extends GetxController {
previous: res?.previous, previous: res?.previous,
results: [ results: [
...(farmList.value.data?.results ?? []), ...(farmList.value.data?.results ?? []),
...?(res?.results as List<PoultryFarm>?), ...?res?.results,
], ],
), ),
); );
@@ -101,4 +101,7 @@ class FarmLogic extends GetxController {
onError: (error, stackTrace) {}, 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]; var item = data.value.data!.results![index];
return ObxValue((val) { return ObxValue((val) {
return ExpandableListItem2( return ExpandableListItem2(
selected: val.contains(index), selected: val.value.isEqual(index),
onTap: () => controller.isExpandedList.toggle(index), onTap: () => controller.toggleExpanded(index),
index: index, index: index,
child: itemListWidget(item), child: itemListWidget(item),
secondChild: itemListExpandedWidget(item), secondChild: itemListExpandedWidget(item),
labelColor: AppColor.blueLight, labelColor: AppColor.blueLight,
labelIcon: Assets.vec.cubeScanSvg.path, labelIcon: Assets.vec.cubeScanSvg.path,
); );
}, controller.isExpandedList); }, controller.expandedIndex);
}, },
itemCount: data.value.data?.results?.length ?? 0, itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h), separatorBuilder: (context, index) => SizedBox(height: 8.h),

View File

@@ -11,7 +11,7 @@ class GenocideLogic extends GetxController {
Rx<Resource<PaginationModel<PoultryOrder>>> poultryOrderList = Rx<Resource<PaginationModel<PoultryOrder>>> poultryOrderList =
Resource<PaginationModel<PoultryOrder>>.loading().obs; Resource<PaginationModel<PoultryOrder>>.loading().obs;
RxList<int> isExpandedList = <int>[].obs; RxInt expandedIndex = RxInt(-1);
final RxInt currentPage = 1.obs; final RxInt currentPage = 1.obs;
final RxBool isLoadingMore = false.obs; final RxBool isLoadingMore = false.obs;
@@ -84,7 +84,7 @@ class GenocideLogic extends GetxController {
Future<void> deletePoultryOrder(int id) async { Future<void> deletePoultryOrder(int id) async {
isExpandedList.clear(); toggleExpanded(-1);
await safeCall( await safeCall(
call: () async => await rootLogic.poultryRepository.deletePoultryOder( call: () async => await rootLogic.poultryRepository.deletePoultryOder(
token: rootLogic.tokenService.accessToken.value!, 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]; var item = data.value.data!.results![index];
return ObxValue((val) { return ObxValue((val) {
return ExpandableListItem2( return ExpandableListItem2(
selected: val.contains(index), selected: val.value.isEqual(index),
onTap: () => controller.isExpandedList.toggle(index), onTap: () => controller.toggleExpanded(index),
index: index, index: index,
child: itemListWidget(item), child: itemListWidget(item),
secondChild: itemListExpandedWidget(item), secondChild: itemListExpandedWidget(item),
labelColor: AppColor.blueLight, labelColor: AppColor.blueLight,
labelIcon: Assets.vec.cubeScanSvg.path, labelIcon: Assets.vec.cubeScanSvg.path,
); );
}, controller.isExpandedList); }, controller.expandedIndex);
}, },
itemCount: data.value.data?.results?.length ?? 0, itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h), separatorBuilder: (context, index) => SizedBox(height: 8.h),

View File

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

View File

@@ -16,7 +16,7 @@ class InspectionPoultryScienceLogic extends GetxController {
final RxBool isLoadingMoreAllocationsMade = false.obs; final RxBool isLoadingMoreAllocationsMade = false.obs;
RxInt currentPage = 1.obs; RxInt currentPage = 1.obs;
RxList<int> isExpandedList = <int>[].obs; RxInt expandedIndex = RxInt(-1);
RxList<XFile> pickedImages = <XFile>[].obs; RxList<XFile> pickedImages = <XFile>[].obs;
final List<MultipartFile> _multiPartPickedImages = <MultipartFile>[]; final List<MultipartFile> _multiPartPickedImages = <MultipartFile>[];
@@ -210,4 +210,8 @@ class InspectionPoultryScienceLogic extends GetxController {
return 0.0; 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]; var item = data.value.data!.results![index];
return ObxValue((val) { return ObxValue((val) {
return ExpandableListItem2( return ExpandableListItem2(
selected: val.contains(index), selected: val.value.isEqual(index),
onTap: () => controller.isExpandedList.toggle(index), onTap: () => controller.toggleExpanded(index),
index: index, index: index,
child: itemListWidget(item), child: itemListWidget(item),
secondChild: itemListExpandedWidget(item), secondChild: itemListExpandedWidget(item),
labelColor: AppColor.blueLight, labelColor: AppColor.blueLight,
labelIcon: Assets.vec.checkSquareSvg.path, labelIcon: Assets.vec.checkSquareSvg.path,
); );
}, controller.isExpandedList); }, controller.expandedIndex);
}, },
itemCount: data.value.data?.results?.length ?? 0, itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h), separatorBuilder: (context, index) => SizedBox(height: 8.h),
@@ -335,15 +335,15 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
var item = data.value.data!.results![index]; var item = data.value.data!.results![index];
return ObxValue((val) { return ObxValue((val) {
return ExpandableListItem2( return ExpandableListItem2(
selected: val.contains(index), selected: val.value.isEqual(index),
onTap: () => controller.isExpandedList.toggle(index), onTap: () => controller.toggleExpanded(index),
index: index, index: index,
child: itemListWidgetReport(item), child: itemListWidgetReport(item),
secondChild: itemListExpandedWidgetReport(item), secondChild: itemListExpandedWidgetReport(item),
labelColor: AppColor.blueLight, labelColor: AppColor.blueLight,
labelIcon: Assets.vec.checkSquareSvg.path, labelIcon: Assets.vec.checkSquareSvg.path,
); );
}, controller.isExpandedList); }, controller.expandedIndex);
}, },
itemCount: data.value.data?.results?.length ?? 0, itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h), separatorBuilder: (context, index) => SizedBox(height: 8.h),

View File

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

View File

@@ -47,7 +47,7 @@ class RPaginatedListView<T> extends StatelessWidget {
}*/ }*/
if (resource.isLoading) { if (resource.isLoading) {
return loadingWidget ?? const LoadingWidget(); return loadingWidget ?? LoadingWidget();
} }
if (resource.isError) { 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_item/list_item_with_out_number.dart';
export 'list_row_item.dart'; export 'list_row_item.dart';
export 'list_view/list_view.dart'; export 'list_view/list_view.dart';
export 'loading_widget.dart'; export 'loading/loading_widget.dart';
// other // other
export 'logo_widget.dart'; export 'logo_widget.dart';
export 'marquee/r_marquee.dart'; export 'marquee/r_marquee.dart';