From d51e0240bba34fb0c4a22caa882f0ee12cd81fa3 Mon Sep 17 00:00:00 2001 From: "mr.mojtaba" Date: Tue, 8 Jul 2025 16:20:55 +0330 Subject: [PATCH] feat : home page widely usage --- .../lib/presentation/pages/home/view.dart | 139 ++++++++++++++---- 1 file changed, 111 insertions(+), 28 deletions(-) diff --git a/packages/chicken/lib/presentation/pages/home/view.dart b/packages/chicken/lib/presentation/pages/home/view.dart index cf417a7..11e40f6 100644 --- a/packages/chicken/lib/presentation/pages/home/view.dart +++ b/packages/chicken/lib/presentation/pages/home/view.dart @@ -52,7 +52,10 @@ class HomePage extends GetView { fit: BoxFit.cover, ), shape: RoundedRectangleBorder( - side: BorderSide(width: 0.25, color: const Color(0xFFB0B0B0)), + side: BorderSide( + width: 0.25, + color: const Color(0xFFB0B0B0), + ), borderRadius: BorderRadius.circular(4), ), ), @@ -60,7 +63,9 @@ class HomePage extends GetView { Text( 'مرغ گرم', textAlign: TextAlign.right, - style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDarkActive), + style: AppFonts.yekan16.copyWith( + color: AppColor.darkGreyDarkActive, + ), ), Spacer(), AnimatedRotation( @@ -76,13 +81,25 @@ class HomePage extends GetView { _inventoryWidget(), Row( - children: [Text('اطلاعات بارها', textAlign: TextAlign.right, style: AppFonts.yekan16)], + children: [ + Text( + 'اطلاعات بارها', + textAlign: TextAlign.right, + style: AppFonts.yekan16, + ), + ], ), _informationShipment(), Row( - children: [Text('اطلاعات توزیع', textAlign: TextAlign.right, style: AppFonts.yekan16)], + children: [ + Text( + 'اطلاعات توزیع', + textAlign: TextAlign.right, + style: AppFonts.yekan16, + ), + ], ), distributionInformationWidget(), @@ -107,7 +124,10 @@ class HomePage extends GetView { fit: BoxFit.cover, ), shape: RoundedRectangleBorder( - side: BorderSide(width: 0.25, color: const Color(0xFFB0B0B0)), + side: BorderSide( + width: 0.25, + color: const Color(0xFFB0B0B0), + ), borderRadius: BorderRadius.circular(4), ), ), @@ -115,7 +135,9 @@ class HomePage extends GetView { Text( 'مرغ گرم', textAlign: TextAlign.right, - style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDarkActive), + style: AppFonts.yekan16.copyWith( + color: AppColor.darkGreyDarkActive, + ), ), Spacer(), Icon(CupertinoIcons.chevron_down, size: 18), @@ -147,9 +169,30 @@ class HomePage extends GetView { children: [ widelyUsed( title: 'خرید خارج استان', - iconPath: Assets.vec.cubeSearchSvg.path, + iconPath: Assets.vec.truckFastSvg.path, + onTap: () async { + controller.rootLogic.currentPage.value = 0; + controller.rootLogic.currentPage.refresh(); + await Future.delayed(Duration(milliseconds: 100)); + Get.toNamed(ChickenRoutes.buysOutOfProvince, id: 0); + }, + ), + SizedBox(width: 15), + widelyUsed( + title: 'خرید داخل استان', + iconPath: Assets.vec.cubeSvg.path, + onTap: () async { + controller.rootLogic.currentPage.value = 0; + controller.rootLogic.currentPage.refresh(); + await Future.delayed(Duration(milliseconds: 100)); + Get.toNamed(ChickenRoutes.buysInProvince, id: 0); + }, + ), + SizedBox(width: 15), + widelyUsed( + title: 'فروش خارج استان', + iconPath: Assets.vec.truckFastSvg.path, onTap: () async { - iLog('on tap :خرید خارج استان '); controller.rootLogic.currentPage.value = 1; controller.rootLogic.currentPage.refresh(); await Future.delayed(Duration(milliseconds: 100)); @@ -158,10 +201,13 @@ class HomePage extends GetView { ), SizedBox(width: 15), widelyUsed( - title: 'عمده فروشی', - iconPath: Assets.vec.truckFastSvg.path, - onTap: () { - //Get.toNamed(ChickenRoutes.salesWithinProvince); + title: 'فروش داخل استان', + iconPath: Assets.vec.cubeSvg.path, + onTap: () async{ + controller.rootLogic.currentPage.value = 1; + controller.rootLogic.currentPage.refresh(); + await Future.delayed(Duration(milliseconds: 100)); + Get.toNamed(ChickenRoutes.salesInProvince, id: 1); }, ), SizedBox(width: 15), @@ -382,15 +428,20 @@ class HomePage extends GetView { height: 82, decoration: BoxDecoration( color: bgLabelColor, - borderRadius: BorderRadius.only(topRight: Radius.circular(8), bottomRight: Radius.circular(8)), + borderRadius: BorderRadius.only( + topRight: Radius.circular(8), + bottomRight: Radius.circular(8), + ), ), child: Column( mainAxisAlignment: MainAxisAlignment.center, spacing: 4, children: [ - SvgGenImage.vec( - iconPath, - ).svg(width: 24, height: 24, colorFilter: ColorFilter.mode(iconColor, BlendMode.srcIn)), + SvgGenImage.vec(iconPath).svg( + width: 24, + height: 24, + colorFilter: ColorFilter.mode(iconColor, BlendMode.srcIn), + ), Text( title, textAlign: TextAlign.right, @@ -405,7 +456,10 @@ class HomePage extends GetView { child: Container( decoration: BoxDecoration( color: bgDescriptionColor, - borderRadius: BorderRadius.only(topLeft: Radius.circular(8), bottomLeft: Radius.circular(8)), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + bottomLeft: Radius.circular(8), + ), ), child: isLoading ? Center(child: CupertinoActivityIndicator()) @@ -499,9 +553,11 @@ class HomePage extends GetView { ), ), child: Center( - child: SvgGenImage.vec( - iconPath, - ).svg(width: 24, height: 24, colorFilter: ColorFilter.mode(iconColor, BlendMode.srcIn)), + child: SvgGenImage.vec(iconPath).svg( + width: 24, + height: 24, + colorFilter: ColorFilter.mode(iconColor, BlendMode.srcIn), + ), ), ), ), @@ -510,7 +566,11 @@ class HomePage extends GetView { ); } - Widget widelyUsed({required String title, required String iconPath, required VoidCallback onTap}) { + Widget widelyUsed({ + required String title, + required String iconPath, + required VoidCallback onTap, + }) { return GestureDetector( onTap: onTap, child: Column( @@ -573,7 +633,11 @@ class HomePage extends GetView { ); } - Widget inventoryItem({required bool isExpanded, required int index, required InventoryModel model}) { + Widget inventoryItem({ + required bool isExpanded, + required int index, + required InventoryModel model, + }) { return Column( mainAxisAlignment: MainAxisAlignment.center, spacing: 8, @@ -585,9 +649,18 @@ class HomePage extends GetView { spacing: 8, children: [ buildRow('وزن خریدهای دولتی داخل استان (کیلوگرم)', '0326598653'), - buildRow('وزن خریدهای آزاد داخل استان (کیلوگرم)', model.receiveFreeCarcassesWeight.toString()), - buildRow('وزن خریدهای خارج استان (کیلوگرم)', model.freeBuyingCarcassesWeight.toString()), - buildRow('کل ورودی به انبار (کیلوگرم)', model.totalFreeBarsCarcassesWeight.toString()), + buildRow( + 'وزن خریدهای آزاد داخل استان (کیلوگرم)', + model.receiveFreeCarcassesWeight.toString(), + ), + buildRow( + 'وزن خریدهای خارج استان (کیلوگرم)', + model.freeBuyingCarcassesWeight.toString(), + ), + buildRow( + 'کل ورودی به انبار (کیلوگرم)', + model.totalFreeBarsCarcassesWeight.toString(), + ), buildRow('کل فروش (کیلوگرم)', model.realAllocatedWeight.toString()), buildRow('مانده انبار (کیلوگرم)', model.totalRemainWeight.toString()), ], @@ -645,15 +718,25 @@ class HomePage extends GetView { style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal), ), const SizedBox(height: 12), - buildRow('فروش و توزیع داخل استان (کیلوگرم)', model.stewardAllocationsWeight!.toInt().toString()), - buildRow('فروش و توزیع خارج استان (کیلوگرم)', model.freeSalesWeight!.toInt().toString()), + buildRow( + 'فروش و توزیع داخل استان (کیلوگرم)', + model.stewardAllocationsWeight!.toInt().toString(), + ), + buildRow( + 'فروش و توزیع خارج استان (کیلوگرم)', + model.freeSalesWeight!.toInt().toString(), + ), ], ) : const Center(child: CircularProgressIndicator()), ); } - Widget cardWidget({required String title, required String iconPath, required VoidCallback onTap}) { + Widget cardWidget({ + required String title, + required String iconPath, + required VoidCallback onTap, + }) { return Container( width: Get.width / 4, height: 130,