fix: ui changes steward

This commit is contained in:
2025-09-29 15:00:31 +03:30
parent 2750f81308
commit e8a32d5648
22 changed files with 319 additions and 166 deletions

View File

@@ -26,11 +26,10 @@ class ActiveHatchingLogic extends GetxController {
@override
void onClose() {
super.onClose();
baseLogic.searchValue.value = null;
baseLogic.isSearchSelected.value = false;
baseLogic.textEditingController.clear();
baseLogic.clearSearch();
}
Future<void> getHatchingList([bool isLoadingMore = false]) async {
if (isLoadingMore) {
isLoadingMoreList.value = true;

View File

@@ -27,37 +27,35 @@ class ActiveHatchingPage extends GetView<ActiveHatchingLogic> {
}
Widget hatchingWidget() {
return Expanded(
child: ObxValue((data) {
return RPaginatedListView(
listType: ListType.separated,
resource: data.value,
hasMore: data.value.data?.next != null,
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
itemBuilder: (context, index) {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ExpandableListItem2(
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.expandedIndex);
},
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
onLoadMore: () async => controller.getHatchingList(true),
onRefresh: () async {
controller.currentPage.value = 1;
await controller.getHatchingList();
},
);
}, controller.activeHatchingList),
);
return ObxValue((data) {
return RPaginatedListView(
listType: ListType.separated,
resource: data.value,
hasMore: data.value.data?.next != null,
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
itemBuilder: (context, index) {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ExpandableListItem2(
selected: val.value.isEqual(index),
onTap: () => controller.toggleExpanded(index),
index: index,
child: itemListWidget(item),
secondChild: itemListExpandedWidget(item),
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.activeFramSvg.path,
);
}, controller.expandedIndex);
},
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
onLoadMore: () async => controller.getHatchingList(true),
onRefresh: () async {
controller.currentPage.value = 1;
await controller.getHatchingList();
},
);
}, controller.activeHatchingList);
}
Container itemListExpandedWidget(HatchingModel item) {

View File

@@ -7,7 +7,7 @@ import 'package:rasadyar_core/core.dart';
class FarmLogic extends GetxController {
List<String> routes = ['اقدام', 'فارم ها'];
PoultryScienceRootLogic rootLogic = Get.find<PoultryScienceRootLogic>();
BaseLogic baseLogic = Get.find<BaseLogic>();
BasePageLogic baseLogic = Get.find<BasePageLogic>();
final PoultryScienceHomeLogic _homeLogic = Get.find<PoultryScienceHomeLogic>();
RxList<InformationTagData> tagInfo = <InformationTagData>[
InformationTagData(
@@ -65,9 +65,7 @@ class FarmLogic extends GetxController {
@override
void onClose() {
super.onClose();
baseLogic.searchValue.value = null;
baseLogic.isSearchSelected.value = false;
baseLogic.textEditingController.clear();
baseLogic.clearSearch();
}
Future<void> getFarmList([bool isLoadingMore = false]) async {

View File

@@ -67,7 +67,7 @@ class FarmPage extends GetView<FarmLogic> {
onTap: () => controller.toggleExpanded(index),
index: index,
child: itemListWidget(item),
secondChild: itemListExpandedWidget2(item),
secondChild: itemListExpandedWidget(item),
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.cubeScanSvg.path,
);
@@ -85,7 +85,7 @@ class FarmPage extends GetView<FarmLogic> {
);
}
Container itemListExpandedWidget2(PoultryFarm item) {
Container itemListExpandedWidget(PoultryFarm item) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
@@ -93,13 +93,14 @@ class FarmPage extends GetView<FarmLogic> {
spacing: 8,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
item.unitName ?? 'N/A',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
),
Spacer(),
Visibility(
child: Text(
@@ -108,63 +109,77 @@ class FarmPage extends GetView<FarmLogic> {
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
),
GestureDetector(
onTap: () {
Get.bottomSheet(BaseBottomSheet(
child: Container(
color: AppColor.blueDark,
),
));
},
child: Row(
children: [
Text(
'جزئیات',
style: AppFonts.yekan10.copyWith(color: AppColor.iconColor),
),
SizedBox(width: 4.w),
Assets.vec.arrowLeftSvg.svg(
width: 10.w,
height: 10.h,
colorFilter: ColorFilter.mode(AppColor.iconColor, BlendMode.srcIn),
),
],
],
),
Container(
height: 32,
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: ShapeDecoration(
color: AppColor.blueLight,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1, color: AppColor.blueLightHover),
borderRadius: BorderRadius.circular(8),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'تعاونی : ${item.cityOperator ?? 'ندارد'}',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
),
],
),
Wrap(
spacing: 8,
runSpacing: 8,
children: [
labelItem(label: 'تعاونی', value: item.cityOperator ?? 'ندارد'),
labelItem(label: 'تعداد سالن ', value: item.numberOfHalls?.toString() ?? 'ندارد'),
labelItem(
label: 'مالک/ تلفن',
value: '${item.user?.fullname} (${item.user?.mobile})',
),
labelItem(label: 'شناسه یکتا', value: item.breedingUniqueId ?? 'N/A'),
labelItem(label: 'کد اپیدمیولوژیک', value: item.epidemiologicalCode ?? 'N/A'),
labelItem(label: 'کد بهداشتی', value: item.healthCertificateNumber ?? 'N/A'),
labelItem(
label: 'دامپزشک فارم',
value: '${item.vetFarm?.fullName} (${item.vetFarm?.mobile ?? '-'})',
),
labelItem(
label: 'ظرفیت فارم',
value: item.totalCapacity.separatedByCommaFa,
unit: 'قطعه',
),
labelItem(
label: 'جوجه ریزی فعال (تعداد دوره)',
value:
'${(item.hatchingInfo?.activeHatching ?? false) ? 'دارد' : 'ندارد'} (${item.hatchingInfo?.period ?? 0})',
),
],
Text(
' تعداد سالن : ${item.numberOfHalls}',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
],
),
),
buildRow(title: 'مالک/ تلفن', value: '${item.user?.fullname} (${item.user?.mobile})'),
buildRow(title: 'شناسه یکتا', value: item.breedingUniqueId ?? 'N/A'),
buildRow(title: 'کد اپیدمیولوژیک', value: item.epidemiologicalCode ?? 'N/A'),
buildRow(title: 'کد بهداشتی', value: item.healthCertificateNumber ?? 'N/A'),
buildRow(
title: 'دامپزشک فارم',
value: '${item.vetFarm?.fullName} (${item.vetFarm?.mobile ?? '-'})',
),
buildUnitRow(
title: 'ظرفیت فارم',
value: item.totalCapacity.separatedByCommaFa,
unit: '(قطعه)',
),
buildRow(
title: 'جوجه ریزی فعال (تعداد دوره) ',
value:
'${(item.hatchingInfo?.activeHatching ?? false) ? 'دارد' : 'ندارد'} (${item.hatchingInfo?.period ?? 0})',
),
/* buildRow(
title: 'شرح بازرسی',
value: item.reportInfo?.image == false ? 'ارسال تصویر جوجه ریزی فارم ' : 'تکمیل شده',
titleStyle: AppFonts.yekan14.copyWith(
color: (item.reportInfo?.image ?? false) ? AppColor.greenNormal : AppColor.redDark,
),
valueStyle: AppFonts.yekan14.copyWith(
color: (item.reportInfo?.image ?? false) ? AppColor.greenNormal : AppColor.redDark,
),
),*/
/* Visibility(
visible: (item.reportInfo?.image == false),
child: RElevated(
text: 'ثبت بازرسی',
isFullWidth: true,
width: 150.w,
height: 40.h,
onPressed: () {
cameraBottomSheet(item.id!);
},
textStyle: AppFonts.yekan20.copyWith(color: Colors.white),
backgroundColor: AppColor.greenNormal,
),
),*/
],
),
);

View File

@@ -36,11 +36,8 @@ class GenocideLogic extends GetxController {
@override
void onClose() {
// TODO: implement onClose
super.onClose();
baseLogic.searchValue.value = null;
baseLogic.isSearchSelected.value = false;
baseLogic.textEditingController.clear();
baseLogic.clearSearch();
}
Future<void> getPoultryOrderList([bool loadingMore = false]) async {

View File

@@ -67,12 +67,11 @@ class InspectionPoultryScienceLogic extends GetxController {
@override
void onClose() {
baseLogic.isSearchSelected.value=false;
baseLogic.textEditingController.clear();
baseLogic.searchValue.value=null;
super.onClose();
baseLogic.clearSearch();
}
Future<void> getHatchingList([bool isLoadingMore = false]) async {
if (isLoadingMore) {
isLoadingMoreAllocationsMade.value = true;

View File

@@ -349,7 +349,7 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
child: itemListWidgetReport(item),
secondChild: itemListExpandedWidgetReport(item),
labelColor: item.state == 'rejected' ? AppColor.redLight : AppColor.greenLight,
labelIcon: Assets.vec.checkSquareSvg.path,
labelIcon: Assets.vec.cubeSearchSvg.path,
);
}, controller.expandedIndex);
},

View File

@@ -21,7 +21,7 @@ class BuyPage extends GetView<BuyLogic> {
children: [
GlassMorphismCardIcon(
title: 'خرید داخل استان',
vecIcon: Assets.vec.cubeSvg.path,
vecIcon: Assets.vec.map1Svg.path,
gradient: LinearGradient(
colors: [Color(0xFF00E096), Color(0xFF007D5E)],
stops: [0.0, 0.95],
@@ -34,7 +34,7 @@ class BuyPage extends GetView<BuyLogic> {
),
GlassMorphismCardIcon(
title: 'خرید خارج استان',
vecIcon: Assets.vec.truckFastSvg.path,
vecIcon: Assets.vec.buyOutProvinceSvg.path,
gradient: LinearGradient(
colors: [Color(0xFF00E096), Color(0xFF007D5E)],
stops: [0.0, 0.95],

View File

@@ -24,14 +24,14 @@ class SalePage extends GetView<SaleLogic> {
GlassMorphismCardIcon(
title: 'فروش داخل استان',
vecIcon: Assets.vec.cubeSvg.path,
vecIcon: Assets.vec.map2Svg.path,
onTap: () {
Get.toNamed(ChickenRoutes.salesInProvinceSteward, id: stewardSecondKey);
},
),
GlassMorphismCardIcon(
title: 'فروش خارج استان',
vecIcon: Assets.vec.truckFastSvg.path,
vecIcon: Assets.vec.saleOutProvinceSvg.path,
onTap: () {
Get.toNamed(ChickenRoutes.salesOutOfProvinceSteward, id: stewardSecondKey);
},

View File

@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
Widget labelItem({required String label, String? value, String? unit}) {
Widget labelItem({required String label, String? value, String? unit, VoidCallback? onTap}) {
String getLabelText(String? value, String? unit) {
if (value != null && unit != null) {
return '$value ($unit)';
@@ -12,44 +12,47 @@ Widget labelItem({required String label, String? value, String? unit}) {
}
}
return Container(
height: 49.h,
clipBehavior: Clip.antiAlias,
padding: EdgeInsets.fromLTRB(8.w, 7.h, 8.w, 7.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1, color: const Color(0xFFB9B9B9)),
),
child: Column(
spacing: 6,
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisSize: MainAxisSize.min,
spacing: 4,
children: [
Text(
label,
textAlign: TextAlign.right,
style: AppFonts.yekan10.copyWith(color: AppColor.unselectTextColor),
),
return GestureDetector(
onTap: onTap,
child: Container(
height: 49.h,
clipBehavior: Clip.antiAlias,
padding: EdgeInsets.fromLTRB(8.w, 7.h, 8.w, 7.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1, color: const Color(0xFFB9B9B9)),
),
child: Column(
spacing: 6,
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisSize: MainAxisSize.min,
spacing: 4,
children: [
Text(
label,
textAlign: TextAlign.right,
style: AppFonts.yekan10.copyWith(color: AppColor.unselectTextColor),
),
Assets.vec.arrowLeftSvg.svg(
width: 10.w,
height: 10.h,
colorFilter: ColorFilter.mode(AppColor.unselectTextColor, BlendMode.srcIn),
),
],
),
Text(
getLabelText(value, unit),
textAlign: TextAlign.right,
style: AppFonts.yekan10.copyWith(color: AppColor.iconColor),
),
],
Assets.vec.arrowLeftSvg.svg(
width: 10.w,
height: 10.h,
colorFilter: ColorFilter.mode(AppColor.unselectTextColor, BlendMode.srcIn),
),
],
),
Text(
getLabelText(value, unit),
textAlign: TextAlign.right,
style: AppFonts.yekan10.copyWith(color: AppColor.iconColor),
),
],
),
),
);
}

View File

@@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart';
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_core/core.dart';
import 'logic.dart';
@@ -30,60 +31,57 @@ class WidelyUsedWidget extends StatelessWidget {
children: [
widelyUsed(
title: 'خرید خارج استان',
iconPath: Assets.vec.truckFastSvg.path,
iconPath: Assets.vec.map1Svg.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.buysOutOfProvinceSteward, id: 0);
Get.toNamed(ChickenRoutes.buysOutOfProvinceSteward, id: stewardFirstKey);
},
),
widelyUsed(
title: 'خرید داخل استان',
iconPath: Assets.vec.cubeSvg.path,
iconPath: Assets.vec.buyOutProvinceSvg.path,
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.buysInProvinceSteward, id: 0);
Get.toNamed(ChickenRoutes.buysInProvinceSteward, id: stewardFirstKey);
},
isOnEdit: false,
),
widelyUsed(
title: 'فروش خارج استان',
iconPath: Assets.vec.truckFastSvg.path,
iconPath: Assets.vec.map2Svg.path,
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: stewardSecondKey);
},
),
widelyUsed(
title: 'فروش داخل استان',
iconPath: Assets.vec.cubeSvg.path,
iconPath: Assets.vec.saleOutProvinceSvg.path,
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: stewardSecondKey);
},
),
],
)
),
),
Positioned(
top: -17,
@@ -123,23 +121,24 @@ class WidelyUsedWidget extends StatelessWidget {
clipBehavior: Clip.none,
children: [
Container(
width: 48,
height: 48,
width: 48.w,
height: 48.h,
padding: EdgeInsets.all(4),
decoration: ShapeDecoration(
color: cardColor ?? Color(0xFFBECDFF),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
child: Container(
width: 40,
height: 40,
width: 40.w,
height: 40.h,
decoration: ShapeDecoration(
color: labelColor ?? AppColor.blueNormal,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
padding: EdgeInsets.all(4),
child: SvgGenImage.vec(iconPath).svg(
width: 24,
height: 24,
width: 24.w,
height: 24.h,
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
fit: BoxFit.cover,
),
@@ -184,7 +183,7 @@ class WidelyUsedWidget extends StatelessWidget {
),
],
),
Text(title, style: AppFonts.yekan10.copyWith(color: textColor ?? AppColor.blueNormal)),
Text(title, style: AppFonts.yekan10.copyWith(color: textColor ?? AppColor.textColor)),
],
),
);

View File

@@ -62,6 +62,9 @@ class $AssetsIconsGen {
/// File path: assets/icons/buy.svg
SvgGenImage get buy => const SvgGenImage('assets/icons/buy.svg');
/// File path: assets/icons/buy_out_province.svg
SvgGenImage get buyOutProvince => const SvgGenImage('assets/icons/buy_out_province.svg');
/// File path: assets/icons/calendar.svg
SvgGenImage get calendar => const SvgGenImage('assets/icons/calendar.svg');
@@ -224,6 +227,12 @@ class $AssetsIconsGen {
/// File path: assets/icons/map.svg
SvgGenImage get map => const SvgGenImage('assets/icons/map.svg');
/// File path: assets/icons/map_1.svg
SvgGenImage get map1 => const SvgGenImage('assets/icons/map_1.svg');
/// File path: assets/icons/map_2.svg
SvgGenImage get map2 => const SvgGenImage('assets/icons/map_2.svg');
/// File path: assets/icons/map_marker.svg
SvgGenImage get mapMarker => const SvgGenImage('assets/icons/map_marker.svg');
@@ -287,6 +296,9 @@ class $AssetsIconsGen {
/// File path: assets/icons/sale.svg
SvgGenImage get sale => const SvgGenImage('assets/icons/sale.svg');
/// File path: assets/icons/sale_out_province.svg
SvgGenImage get saleOutProvince => const SvgGenImage('assets/icons/sale_out_province.svg');
/// File path: assets/icons/scan.svg
SvgGenImage get scan => const SvgGenImage('assets/icons/scan.svg');
@@ -359,6 +371,7 @@ class $AssetsIconsGen {
boxRemove,
boxTick,
buy,
buyOutProvince,
calendar,
calendarSearch,
calendarSearchOutline,
@@ -413,6 +426,8 @@ class $AssetsIconsGen {
lock,
logout,
map,
map1,
map2,
mapMarker,
messageAdd,
noteRemove,
@@ -434,6 +449,7 @@ class $AssetsIconsGen {
receiptDiscount,
registerKill,
sale,
saleOutProvince,
scan,
scanBarcode,
search,
@@ -532,6 +548,9 @@ class $AssetsVecGen {
/// File path: assets/vec/buy.svg.vec
SvgGenImage get buySvg => const SvgGenImage.vec('assets/vec/buy.svg.vec');
/// File path: assets/vec/buy_out_province.svg.vec
SvgGenImage get buyOutProvinceSvg => const SvgGenImage.vec('assets/vec/buy_out_province.svg.vec');
/// File path: assets/vec/calendar.svg.vec
SvgGenImage get calendarSvg => const SvgGenImage.vec('assets/vec/calendar.svg.vec');
@@ -694,6 +713,12 @@ class $AssetsVecGen {
/// File path: assets/vec/map.svg.vec
SvgGenImage get mapSvg => const SvgGenImage.vec('assets/vec/map.svg.vec');
/// File path: assets/vec/map_1.svg.vec
SvgGenImage get map1Svg => const SvgGenImage.vec('assets/vec/map_1.svg.vec');
/// File path: assets/vec/map_2.svg.vec
SvgGenImage get map2Svg => const SvgGenImage.vec('assets/vec/map_2.svg.vec');
/// File path: assets/vec/map_marker.svg.vec
SvgGenImage get mapMarkerSvg => const SvgGenImage.vec('assets/vec/map_marker.svg.vec');
@@ -757,6 +782,9 @@ class $AssetsVecGen {
/// File path: assets/vec/sale.svg.vec
SvgGenImage get saleSvg => const SvgGenImage.vec('assets/vec/sale.svg.vec');
/// File path: assets/vec/sale_out_province.svg.vec
SvgGenImage get saleOutProvinceSvg => const SvgGenImage.vec('assets/vec/sale_out_province.svg.vec');
/// File path: assets/vec/scan.svg.vec
SvgGenImage get scanSvg => const SvgGenImage.vec('assets/vec/scan.svg.vec');
@@ -829,6 +857,7 @@ class $AssetsVecGen {
boxRemoveSvg,
boxTickSvg,
buySvg,
buyOutProvinceSvg,
calendarSvg,
calendarSearchSvg,
calendarSearchOutlineSvg,
@@ -883,6 +912,8 @@ class $AssetsVecGen {
lockSvg,
logoutSvg,
mapSvg,
map1Svg,
map2Svg,
mapMarkerSvg,
messageAddSvg,
noteRemoveSvg,
@@ -904,6 +935,7 @@ class $AssetsVecGen {
receiptDiscountSvg,
registerKillSvg,
saleSvg,
saleOutProvinceSvg,
scanSvg,
scanBarcodeSvg,
searchSvg,

View File

@@ -49,7 +49,7 @@ class SearchWidget extends GetView<BaseLogic> {
hintStyle: AppFonts.yekan16.copyWith(color: AppColor.blueNormal),
filledColor: Colors.white,
filled: true,
controller: controller.textEditingController,
controller: controller.searchTextController,
onChanged: (val) => controller.searchValue.value = val,
),
),

View File

@@ -239,7 +239,7 @@ class CoreButton extends StatelessWidget {
);
case CoreButtonVariant.secondary:
return _ButtonTheme(
backgroundColor: backgroundColor ?? AppColor.greyNormal,
backgroundColor: backgroundColor ?? AppColor.darkGreyNormal,
foregroundColor: foregroundColor ?? AppColor.textColor,
borderColor: null,
);