diff --git a/packages/chicken/lib/presentation/pages/home/logic.dart b/packages/chicken/lib/presentation/pages/home/logic.dart index bcfe78b..d544079 100644 --- a/packages/chicken/lib/presentation/pages/home/logic.dart +++ b/packages/chicken/lib/presentation/pages/home/logic.dart @@ -12,6 +12,8 @@ class HomeLogic extends GetxController { Rxn inventoryModel = Rxn(); Rxn killHouseDistributionInfo = Rxn(); + RxBool isExpanded = false.obs; + @override void onInit() { diff --git a/packages/chicken/lib/presentation/pages/home/view.dart b/packages/chicken/lib/presentation/pages/home/view.dart index a3df02f..f0707c3 100644 --- a/packages/chicken/lib/presentation/pages/home/view.dart +++ b/packages/chicken/lib/presentation/pages/home/view.dart @@ -16,74 +16,116 @@ class HomePage extends GetView { return Scaffold( backgroundColor: AppColor.bgLight, appBar: chickenAppBar( - hasBack: false, - hasFilter: false, - hasSearch: false - + hasBack: false, + hasFilter: false, + hasSearch: false ), body: Column( spacing: 8, children: [ - Card( - margin: EdgeInsetsGeometry.all(6), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - side: BorderSide(width: 0.50, color: const Color(0xFFA9A9A9)), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Row( - spacing: 8, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: 40, - height: 40, - decoration: ShapeDecoration( - image: DecorationImage(image: AssetImage(Assets.images.chicken.path), fit: BoxFit.cover), - shape: RoundedRectangleBorder( - side: BorderSide(width: 0.25, color: const Color(0xFFB0B0B0)), - borderRadius: BorderRadius.circular(4), + InkWell( + onTap: () { + controller.isExpanded.value = !controller.isExpanded.value; + }, + child: Card( + margin: EdgeInsetsGeometry.all(6), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + side: BorderSide(width: 0.50, color: const Color(0xFFA9A9A9)), + ), + + child: ObxValue((data) { + return AnimatedSize(duration: Duration(milliseconds: 300), + child: data.value ? Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + spacing: 8, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: 40, + height: 40, + decoration: ShapeDecoration( + image: DecorationImage( + image: AssetImage(Assets.images.chicken.path), fit: BoxFit.cover), + shape: RoundedRectangleBorder( + side: BorderSide(width: 0.25, color: const Color(0xFFB0B0B0)), + borderRadius: BorderRadius.circular(4), + ), + ), + ), + Text( + 'مرغ گرم', + textAlign: TextAlign.right, + style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDarkActive), + ), + Spacer(), + AnimatedRotation( + turns: 180, + duration: Duration(milliseconds: 3000), + child: Icon(CupertinoIcons.chevron_up, size: 18), + ), + ], ), - ), + SizedBox(height: 8), + _todayShipmentWidget(), + + _inventoryWidget(), + + Row( + children: [Text('اطلاعات بارها', textAlign: TextAlign.right, style: AppFonts.yekan16)], + ), + + _informationShipment(), + + Row( + children: [Text('اطلاعات توزیع', textAlign: TextAlign.right, style: AppFonts.yekan16)], + ), + + distributionInformationWidget(), + ], ), - Text( - 'مرغ گرم', - textAlign: TextAlign.right, - style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDarkActive), + ) : Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + spacing: 8, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: 40, + height: 40, + decoration: ShapeDecoration( + image: DecorationImage( + image: AssetImage(Assets.images.chicken.path), fit: BoxFit.cover), + shape: RoundedRectangleBorder( + side: BorderSide(width: 0.25, color: const Color(0xFFB0B0B0)), + borderRadius: BorderRadius.circular(4), + ), + ), + ), + Text( + 'مرغ گرم', + textAlign: TextAlign.right, + style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDarkActive), + ), + Spacer(), + Icon(CupertinoIcons.chevron_down, size: 18), + ], + ), + ], ), - Spacer(), - AnimatedRotation( - turns: 180, - duration: Duration(milliseconds: 3000), - child: Icon(CupertinoIcons.chevron_up, size: 18), - ), - ], - ), - SizedBox(height: 8), - _todayShipmentWidget(), + ), - _inventoryWidget(), - - Row( - children: [Text('اطلاعات بارها', textAlign: TextAlign.right, style: AppFonts.yekan16)], - ), - - _informationShipment(), - - Row( - children: [Text('اطلاعات توزیع', textAlign: TextAlign.right, style: AppFonts.yekan16)], - ), - - distributionInformationWidget(), - ], - ), - ), - ), + ); + }, controller.isExpanded), + )), Padding( padding: EdgeInsetsGeometry.all(6), @@ -102,9 +144,9 @@ class HomePage extends GetView { widelyUsed( title: 'خرید خارج استان', iconPath: Assets.vec.cubeSearchSvg.path, - onTap:() async{ + onTap: () async { iLog('on tap :خرید خارج استان '); - controller.rootLogic.currentPage.value =1; + controller.rootLogic.currentPage.value = 1; controller.rootLogic.currentPage.refresh(); await Future.delayed(Duration(milliseconds: 100)); Get.toNamed(ChickenRoutes.salesOutOfProvince, id: 1);