From 4c40bfa43e6324bb695d7c57b2cf891001e58fd3 Mon Sep 17 00:00:00 2001 From: "mr.mojtaba" Date: Mon, 16 Jun 2025 12:54:28 +0330 Subject: [PATCH] feat : sale out province --- .../pages/sales_out_of_province/logic.dart | 2 + .../pages/sales_out_of_province/view.dart | 180 +++++++++++++++++- .../lib/presentation/routes/pages.dart | 16 ++ 3 files changed, 196 insertions(+), 2 deletions(-) diff --git a/packages/chicken/lib/presentation/pages/sales_out_of_province/logic.dart b/packages/chicken/lib/presentation/pages/sales_out_of_province/logic.dart index a580de0..aaadad3 100644 --- a/packages/chicken/lib/presentation/pages/sales_out_of_province/logic.dart +++ b/packages/chicken/lib/presentation/pages/sales_out_of_province/logic.dart @@ -1,6 +1,8 @@ import 'package:rasadyar_core/core.dart'; class SalesOutOfProvinceLogic extends GetxController { + RxBool isExpanded = false.obs; + RxList isExpandedList = [].obs; @override void onReady() { // TODO: implement onReady diff --git a/packages/chicken/lib/presentation/pages/sales_out_of_province/view.dart b/packages/chicken/lib/presentation/pages/sales_out_of_province/view.dart index d4a82a3..7d36522 100644 --- a/packages/chicken/lib/presentation/pages/sales_out_of_province/view.dart +++ b/packages/chicken/lib/presentation/pages/sales_out_of_province/view.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:rasadyar_core/core.dart'; @@ -14,7 +15,10 @@ class SalesOutOfProvincePage extends GetView { iconTitle: Assets.vec.chickenSvg.path, titleTextStyle: AppFonts.yekan16Bold.copyWith(color: Colors.white), centerTitle: true, - hasBack: false, + hasBack: true, + onBackPressed: () { + Get.back(id: 1); + }, leadingWidth: 155, leading: Row( mainAxisSize: MainAxisSize.min, @@ -43,9 +47,181 @@ class SalesOutOfProvincePage extends GetView { SizedBox(width: 8), ], ), - body: Container(color: Colors.amber), + body: ListView.separated( + padding: EdgeInsets.fromLTRB(8, 8, 18, 80), + itemBuilder: (context, index) { + return ObxValue( + (data) => GestureDetector( + onTap: () { + if(data.contains(index)){ + controller.isExpandedList.remove(index); + }else{ + controller.isExpandedList.add(index); + } + + }, + child: AnimatedContainer( + duration: Duration(milliseconds: 400), + alignment: Alignment.center, + height: data.contains(index)? 210 : 56, + child: Stack( + clipBehavior: Clip.none, + alignment: Alignment.centerRight, + children: [ + AnimatedContainer( + width: Get.width - 30, + duration: Duration(milliseconds: 400), + height: data.contains(index) ? 210 : 56, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.transparent, + borderRadius: BorderRadius.circular(8), + border: Border.all(width: 0.5, color: AppColor.darkGreyNormal), + ), + child: AnimatedCrossFade( + alignment: Alignment.center, + firstChild: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text( + '1403/5/5', + textAlign: TextAlign.center, + style: AppFonts.yekan14.copyWith(color: AppColor.bgDark), + ), + Text( + 'افلاک', + textAlign: TextAlign.center, + style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal), + ), + Text( + 'kg 200 مرغ گرم ', + textAlign: TextAlign.center, + style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal), + ), + + Text( + 'لرستان-خرم آباد', + textAlign: TextAlign.center, + style: AppFonts.yekan14.copyWith(color: AppColor.bgDark), + ), + + Icon(CupertinoIcons.chevron_down,size: 12,) + ], + ), + secondChild: Container( + padding: EdgeInsets.fromLTRB(8, 12, 14, 12), + + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)), + child: Column( + spacing: 8, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Assets.vec.editSvg.svg( + width: 20, + height: 20, + colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn), + ), + + Text( + 'لرستان - خرم آباد', + textAlign: TextAlign.center, + style: AppFonts.yekan16.copyWith(color: AppColor.greenDark), + ), + + Assets.vec.trashSvg.svg( + width: 20, + height: 20, + colorFilter: ColorFilter.mode(AppColor.error, BlendMode.srcIn), + ), + ], + ), + Container( + height: 32, + padding: EdgeInsets.symmetric(horizontal: 4), + decoration: ShapeDecoration( + color: AppColor.blueLight, + shape: RoundedRectangleBorder( + side: BorderSide(width: 1, color: AppColor.blueLightHover), + borderRadius: BorderRadius.circular(8), + ), + ), + child: buildRow('تاریخ', '07:15:00 - 1402/07/01'), + ), + + buildRow('مشخصات فروشنده', 'افلاک - 09203659874'), + buildRow('وزن خریداری شده', '200 کیلوگرم'), + buildRow('لاشه خریداری شده', '200 عدد'), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Icon(CupertinoIcons.chevron_up,size: 12,) + ], + ) + ], + ), + ), + crossFadeState: data.contains(index)?CrossFadeState.showSecond:CrossFadeState.showFirst, + duration: Duration(milliseconds: 200), + ), + ), + Positioned( + right: -12, + child: Container( + width: index < 999 ? 24 : null, + height: index < 999 ? 24 : null, + padding: EdgeInsets.all(2), + decoration: BoxDecoration( + color: AppColor.greenLightHover, + borderRadius: BorderRadius.circular(4), + border: Border.all(width: 0.50, color: AppColor.greenDarkActive), + ), + alignment: Alignment.center, + child: Text((index + 1).toString(), style: AppFonts.yekan12.copyWith(color: Colors.black)), + ), + ), + ], + ), + ), + ), + controller.isExpandedList, + ); + }, + separatorBuilder: (context, index) => SizedBox(height: 8), + itemCount: 5, + ), floatingActionButton: RFab.add(onPressed: () {}), floatingActionButtonLocation: FloatingActionButtonLocation.startFloat, ); } + + Widget buildRow(String title, String value) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 4.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Flexible( + flex: 2, + child: Text( + title, + textAlign: TextAlign.right, + style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), + ), + ), + Flexible( + flex: 2, + child: Text( + value, + textAlign: TextAlign.left, + style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), + ), + ), + ], + ), + ); + } + + } diff --git a/packages/chicken/lib/presentation/routes/pages.dart b/packages/chicken/lib/presentation/routes/pages.dart index a226f5e..f86a54f 100644 --- a/packages/chicken/lib/presentation/routes/pages.dart +++ b/packages/chicken/lib/presentation/routes/pages.dart @@ -6,6 +6,7 @@ import 'package:rasadyar_chicken/presentation/pages/entering_the_warehouse/view. import 'package:rasadyar_chicken/presentation/pages/home/logic.dart'; import 'package:rasadyar_chicken/presentation/pages/home/view.dart'; import 'package:rasadyar_chicken/presentation/pages/out_of_province/logic.dart'; +import 'package:rasadyar_chicken/presentation/pages/out_of_province/view.dart'; import 'package:rasadyar_chicken/presentation/pages/root/logic.dart'; import 'package:rasadyar_chicken/presentation/pages/root/view.dart'; import 'package:rasadyar_chicken/presentation/pages/sales_in_province/logic.dart'; @@ -28,6 +29,7 @@ sealed class ChickenPages { Get.lazyPut(()=>HomeLogic()); Get.lazyPut(()=>SalesInProvinceLogic()); Get.lazyPut(()=>OutOfProvinceLogic()); + Get.lazyPut(()=>SalesOutOfProvinceLogic()); }), ), @@ -59,6 +61,20 @@ sealed class ChickenPages { Get.put(RootLogic()); }), ), + + + + GetPage( + name: ChickenRoutes.outOfProvince, + page: () => OutOfProvincePage(), + middlewares: [AuthMiddleware()], + binding: BindingsBuilder(() { + Get.put(OutOfProvinceLogic()); + Get.put(SalesOutOfProvinceLogic()); + Get.put(RootLogic()); + }), + ), + GetPage( name: ChickenRoutes.salesOutOfProvince, page: () => SalesOutOfProvincePage(),