From 0b921fa9177e5d029aa3006ea3625e22a05530e7 Mon Sep 17 00:00:00 2001 From: "mr.mojtaba" Date: Wed, 9 Jul 2025 14:54:28 +0330 Subject: [PATCH] fix : ui change's --- assets/icons/close_circle.svg | 8 + assets/icons/empty.svg | 77 ++- assets/vec/close_circle.svg.vec | Bin 0 -> 658 bytes assets/vec/empty.svg.vec | Bin 14 -> 12776 bytes .../lib/presentation/pages/buy/view.dart | 1 - .../pages/buy_in_province/logic.dart | 5 +- .../pages/buy_in_province/view.dart | 32 +- .../pages/buy_in_province_waiting/view.dart | 7 +- .../pages/buy_out_of_province/view.dart | 36 +- .../pages/entering_the_warehouse/logic.dart | 101 ---- .../pages/entering_the_warehouse/view.dart | 525 ------------------ .../pages/sales_in_province/view.dart | 33 +- .../pages/sales_out_of_province/logic.dart | 8 +- .../pages/sales_out_of_province/view.dart | 82 +-- .../sales_out_of_province_buyers/view.dart | 80 +-- .../view.dart | 37 +- .../lib/presentation/widget/app_bar.dart | 71 ++- .../presentation/widget/base_page/view.dart | 2 +- .../widget/filter_bottom_sheet.dart | 43 ++ .../presentation/widget/inventory_widget.dart | 23 + .../lib/presentation/widget/search/view.dart | 49 +- packages/chicken/pubspec.yaml | 3 +- .../lib/presentation/common/assets.gen.dart | 8 + .../widget/buttons/outline_elevated.dart | 152 ++--- .../lib/presentation/widget/empty_widget.dart | 2 +- .../presentation/widget/inputs/r_input.dart | 228 +++++--- pubspec.yaml | 2 +- 27 files changed, 611 insertions(+), 1004 deletions(-) create mode 100644 assets/icons/close_circle.svg create mode 100644 assets/vec/close_circle.svg.vec delete mode 100644 packages/chicken/lib/presentation/pages/entering_the_warehouse/logic.dart delete mode 100644 packages/chicken/lib/presentation/pages/entering_the_warehouse/view.dart create mode 100644 packages/chicken/lib/presentation/widget/filter_bottom_sheet.dart create mode 100644 packages/chicken/lib/presentation/widget/inventory_widget.dart diff --git a/assets/icons/close_circle.svg b/assets/icons/close_circle.svg new file mode 100644 index 0000000..ed5da34 --- /dev/null +++ b/assets/icons/close_circle.svg @@ -0,0 +1,8 @@ + + + + + diff --git a/assets/icons/empty.svg b/assets/icons/empty.svg index 910b77f..88665f2 100644 --- a/assets/icons/empty.svg +++ b/assets/icons/empty.svg @@ -1,9 +1,68 @@ - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/vec/close_circle.svg.vec b/assets/vec/close_circle.svg.vec new file mode 100644 index 0000000000000000000000000000000000000000..59e1d5b945a04998376fb83ae7aeb48c5559cdfe GIT binary patch literal 658 zcmXw%Pbh-|2n-{JlAd!Fa_e81l|t8I-`E72MgCAi*pj*G~)O+{2e z&M}zR>$~0q*L*(x2fLz8}01E{xv_&vtXtAKl5z zeCA2<`fxdqRe$L3Qex~`+^prz$Fv?hFon@V$p*Rd zAuCKJGaB{hiBp~3_H#++u@1~P2z#wMsTcQ{WRP1jA&c|#HRD1w?QUfFKQw&8{IAK# zh4=6QpU{O*=z`Ei9lD{eOAXzX*qso0QHL+&gJ0wWkq>q39jR#+9jnSOx48b4A!Q0IM literal 0 HcmV?d00001 diff --git a/assets/vec/empty.svg.vec b/assets/vec/empty.svg.vec index 37f9ed7eddcca19498ee72143e6a9f0cbabaeec3..5fcf9c8644ffc1b01bd2f506b9410f2256fa8abb 100644 GIT binary patch literal 12776 zcmc(md0%Kl+tfZ$Yg4TY z&jD1{xu`@9QIV|-vI!V)hZ&Ha0DYw{qpw<7A}*lheSYW81pBamzqHryJ?H$+@Ao^u z?VNk>aP!%ZS)ntnn!c`O9g^b@9z56_wyfsn#l#k+Pb@1$x)aU$~IFSje&>7JniB!ohz#Y1{h68JEl9`@eKb zKYH0|{Q2cF=3bF+FMm~jy(1x4u9_&haX&Fu{Km({^X?I=VWRkn3Xpc@GD)W%r5%jN zLZKg(baY-o_t5g2#5v)=J<1gG*?=0Ky&Ui0LS9XWC zmsr+`%>SAA(GIlxiEW3uAH@3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pt^Gf(}g-zxBX`4q;8gBs-5Xg_-ME1Nzv^jtFNVj{oXHoX`_sq_&~ADa-TD4UzhC8ZzZg6D=(X7Nd-c%O z&`vQw&Uh2!^-9k-wj}+P`fbgJW(m47o}|CYCkBXFYX)>nxn@AOl(o%(PHi^>I&51x z13Jd57>_JNF5?wyOZvS4t(s-bVH_VBG(Ka#jg6sKTPq*C8eiJb;cJx__+Is)ZS-1> z-_VoTQT-MDM1Z-Nva6>dXNA#U(deaZe!HMKmyTdRzHe|IMxOR##|ouadxG{e(BWhA zt>-oLrETHs#4}tf4~(J*{Tgd_HSH>0H{X=XHI_i^VO47yDm({7Zo! zqC7j{C(nD)pj8o|ALaX;e&fs3qbvSR)vY zU}qalVOLAX)xOU$XAylf8G99eF9h`UFR)JHtls%WBk0<_mkrw0vyDw`TYtBK4oQAf z5LMl2SE}xFj7|NjIc7W^pJUdRPSKxKo6j|CPFKz~eDqtp^5+@ZpdU>dv}ywMGRc6h za*^Rm*4 zwU=E@jZCN=bsck|*L|FJoElJ0o1C>Q>`m-@8TAJ_i60cLhB?MAUcLH@e)W^7F^pGg zZZgiibS2|9^c8cEtGPHpC!(UP5TGni%hnIQT=$B5xhZ@4!6q_Kw`epd39*j58-wLPdvk!6wUBvg&j8hb+UDJfp--pOuWD!Yv(gcN5#qz6ZDaR1aao1Ei3hEzeq)mP zw3|Rn?M-|VU+IX(X%<mFmy z&Kb=&&eRpUC#|L*dmGfVnVz-DH_qmkrS{kTIzaV@p566KWzO=f$DFZQpPu#osKy^> zeYL-N7Err$21l-WR^Uvf&kn&}$9kX(&Yo%?<*jk0vBNs-6>?rTt%%Ld-9ncB _setFromDateFilter(callback)); ever(toDateFilter, (callback) => _setToDateFilter(callback)); - } @override @@ -77,9 +76,9 @@ class BuyInProvinceLogic extends GetxController { searchedValue.value = data?.trim(); final isWaiting = selectedSegmentIndex.value == 0; if (isWaiting) { - buyWaitingLogic.searchedValue.value = searchedValue.value; + buyWaitingLogic.searchedValue.value = searchedValue.value; } else { - buyAllLogic.searchedValue.value = searchedValue.value; + buyAllLogic.searchedValue.value = searchedValue.value; } } } diff --git a/packages/chicken/lib/presentation/pages/buy_in_province/view.dart b/packages/chicken/lib/presentation/pages/buy_in_province/view.dart index 533c4c7..17ad848 100644 --- a/packages/chicken/lib/presentation/pages/buy_in_province/view.dart +++ b/packages/chicken/lib/presentation/pages/buy_in_province/view.dart @@ -1,7 +1,9 @@ import 'package:flutter/material.dart'; import 'package:rasadyar_chicken/presentation/pages/buy_in_province_all/view.dart'; import 'package:rasadyar_chicken/presentation/pages/buy_in_province_waiting/view.dart'; +import 'package:rasadyar_chicken/presentation/pages/root/logic.dart'; import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart'; +import 'package:rasadyar_chicken/presentation/widget/inventory_widget.dart'; import 'package:rasadyar_chicken/presentation/widget/page_route.dart'; import 'package:rasadyar_core/core.dart'; @@ -18,7 +20,7 @@ class BuyInProvincePage extends GetView { onSearchChanged: (data) => controller.setSearchValue(data), filteringWidget: filterBottomSheet(), widgets: [ - inventoryWidget(), + inventoryWidget(controller.rootLogic), segmentWidget(), ObxValue((index) { return Expanded( @@ -52,11 +54,11 @@ class BuyInProvincePage extends GetView { Widget filterBottomSheet() { return BaseBottomSheet( - height: 250, + height: 200, child: Column( spacing: 16, children: [ - Text('فیلترها', style: AppFonts.yekan16Bold.copyWith(color: AppColor.darkGreyDarkHover)), + Text('فیلترها', style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal)), Row( spacing: 8, children: [ @@ -75,9 +77,12 @@ class BuyInProvincePage extends GetView { ), ], ), - SizedBox(height: 2), + RElevated( text: 'اعمال فیلتر', + + isFullWidth: true, + backgroundColor: AppColor.greenNormal, onPressed: () { controller.submitFilter(); Get.back(); @@ -90,22 +95,5 @@ class BuyInProvincePage extends GetView { ); } - Widget inventoryWidget() { - return Container( - width: Get.width, - height: 39, - margin: EdgeInsets.symmetric(horizontal: 8, vertical: 4), - decoration: BoxDecoration( - color: AppColor.greenLight, - borderRadius: BorderRadius.circular(8), - ), - alignment: Alignment.center, - child: ObxValue((data) { - return Text( - ' موجودی انبار: ${data.value?.totalRemainWeight?.toInt().separatedByComma ?? '0'} کیلوگرم', - style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkHover), - ); - }, controller.rootLogic.inventoryModel), - ); - } + } diff --git a/packages/chicken/lib/presentation/pages/buy_in_province_waiting/view.dart b/packages/chicken/lib/presentation/pages/buy_in_province_waiting/view.dart index d68a287..e29bbba 100644 --- a/packages/chicken/lib/presentation/pages/buy_in_province_waiting/view.dart +++ b/packages/chicken/lib/presentation/pages/buy_in_province_waiting/view.dart @@ -18,7 +18,7 @@ class BuyInProvinceWaitingPage extends GetView { return RPaginatedListView( listType: ListType.separated, resource: data.value, - hasMore: data.value.data?.next!= null, + hasMore: data.value.data?.next != null, padding: EdgeInsets.fromLTRB(8, 8, 8, 80), itemBuilder: (context, index) { var item = data.value.data!.results![index]; @@ -130,7 +130,7 @@ class BuyInProvinceWaitingPage extends GetView { Container itemListExpandedWidget(WaitingArrivalModel item) { return Container( - padding: EdgeInsets.all(8), + padding: EdgeInsets.symmetric(horizontal: 8), decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)), child: Column( spacing: 8, @@ -155,7 +155,7 @@ class BuyInProvinceWaitingPage extends GetView { ), Container( height: 32, - padding: EdgeInsets.symmetric(horizontal: 4), + padding: EdgeInsets.symmetric(horizontal: 8), decoration: ShapeDecoration( color: AppColor.blueLight, shape: RoundedRectangleBorder( @@ -194,7 +194,6 @@ class BuyInProvinceWaitingPage extends GetView { ), ), - // buildRow(title: 'مشخصات فروشنده', value: item.killHouseName ?? 'N/A'), buildRow( title: 'نام و نام خانوادگی فروشنده', value: item.steward?.user?.fullname ?? 'N/A', diff --git a/packages/chicken/lib/presentation/pages/buy_out_of_province/view.dart b/packages/chicken/lib/presentation/pages/buy_out_of_province/view.dart index 17dc226..ca39b0a 100644 --- a/packages/chicken/lib/presentation/pages/buy_out_of_province/view.dart +++ b/packages/chicken/lib/presentation/pages/buy_out_of_province/view.dart @@ -7,6 +7,7 @@ import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_pr import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart'; import 'package:rasadyar_chicken/data/models/response/steward_free_bar/steward_free_bar.dart'; import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart'; +import 'package:rasadyar_chicken/presentation/widget/inventory_widget.dart'; import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart'; import 'package:rasadyar_chicken/presentation/widget/list_row_item.dart'; import 'package:rasadyar_core/core.dart'; @@ -24,7 +25,7 @@ class BuyOutOfProvincePage extends GetView { onSearchChanged: (data) => controller.setSearchValue(data), filteringWidget: filterBottomSheet(), widgets: [ - inventoryWidget(), + inventoryWidget(controller.rootLogic), Expanded( child: ObxValue((data) { return RPaginatedListView( @@ -68,7 +69,7 @@ class BuyOutOfProvincePage extends GetView { Container itemListExpandedWidget(StewardFreeBar item) { return Container( - padding: EdgeInsets.all(8), + padding: EdgeInsets.symmetric(horizontal: 8), decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)), child: Column( spacing: 8, @@ -85,7 +86,7 @@ class BuyOutOfProvincePage extends GetView { ), Container( height: 32, - padding: EdgeInsets.symmetric(horizontal: 4), + padding: EdgeInsets.symmetric(horizontal: 8), decoration: ShapeDecoration( color: AppColor.blueLight, shape: RoundedRectangleBorder( @@ -153,7 +154,7 @@ class BuyOutOfProvincePage extends GetView { children: [ Text( 'بارنامه', - style: AppFonts.yekan16Bold.copyWith(color: AppColor.darkGreyDarkHover), + style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal), ), Image.network( @@ -166,7 +167,6 @@ class BuyOutOfProvincePage extends GetView { }, loadingBuilder: (context, child, loadingProgress) { if (loadingProgress == null) return child; - print('Loading progress: $loadingProgress'); return CupertinoActivityIndicator(); }, ), @@ -300,7 +300,7 @@ class BuyOutOfProvincePage extends GetView { children: [ Text( isOnEdit ? 'ویرایش اطلاعات خرید' : 'ثبت اطلاعات خرید', - style: AppFonts.yekan16Bold.copyWith(color: AppColor.darkGreyDarkHover), + style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal), ), _productDropDown(), @@ -556,11 +556,11 @@ class BuyOutOfProvincePage extends GetView { Widget filterBottomSheet() { return BaseBottomSheet( - height: 250, + height: 200, child: Column( spacing: 16, children: [ - Text('فیلترها', style: AppFonts.yekan16Bold.copyWith(color: AppColor.darkGreyDarkHover)), + Text('فیلترها', style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal)), Row( spacing: 8, children: [ @@ -579,34 +579,20 @@ class BuyOutOfProvincePage extends GetView { ), ], ), - SizedBox(height: 2), RElevated( text: 'اعمال فیلتر', + isFullWidth: true, + backgroundColor: AppColor.greenNormal, onPressed: () { controller.getStewardPurchaseOutOfProvince(); Get.back(); }, height: 40, ), - SizedBox(height: 16), + ], ), ); } - Widget inventoryWidget() { - return Container( - width: Get.width, - height: 39, - margin: EdgeInsets.symmetric(horizontal: 8, vertical: 4), - decoration: BoxDecoration(color: AppColor.greenLight, borderRadius: BorderRadius.circular(8)), - alignment: Alignment.center, - child: ObxValue((data) { - return Text( - ' موجودی انبار: ${data.value?.totalRemainWeight?.toInt().separatedByComma ?? '0'} کیلوگرم', - style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkHover), - ); - }, controller.rootLogic.inventoryModel), - ); - } } diff --git a/packages/chicken/lib/presentation/pages/entering_the_warehouse/logic.dart b/packages/chicken/lib/presentation/pages/entering_the_warehouse/logic.dart deleted file mode 100644 index ab10e19..0000000 --- a/packages/chicken/lib/presentation/pages/entering_the_warehouse/logic.dart +++ /dev/null @@ -1,101 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:rasadyar_auth/data/utils/safe_call.dart'; -import 'package:rasadyar_chicken/chicken.dart'; -import 'package:rasadyar_chicken/data/models/request/steward_allocation/steward_allocation_request.dart'; -import 'package:rasadyar_chicken/data/models/response/bar_information/bar_information.dart'; -import 'package:rasadyar_chicken/data/models/response/imported_loads_model/imported_loads_model.dart'; -import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart'; -import 'package:rasadyar_core/core.dart'; - -class EnteringTheWarehouseLogic extends GetxController { - RootLogic rootLogic = Get.find(); - Rxn barInformation = Rxn(); - Rxn waitingForArrival = Rxn(); - Rxn importedLoads = Rxn(); - RxInt acceptType = 1.obs; - TextEditingController weightController = TextEditingController(); - TextEditingController volumeController = TextEditingController(); - TextEditingController weightLossController = TextEditingController(); - TextEditingController authenticationCodeController = TextEditingController(); - - final ScrollController scrollControllerImportedLoad = ScrollController(); - final RxInt currentPageImportedLoad = 1.obs; - final RxBool isLoadingMoreImportedLoad = false.obs; - final RxBool addPageImportedLoad = false.obs; - final RxBool hasMoreDataImportedLoad = true.obs; - - final ScrollController scrollControllerWaitingForArrival = ScrollController(); - final RxInt currentPageWaitingForArrival = 1.obs; - final RxBool isLoadingMoreWaitingForArrival = false.obs; - final RxBool addPageWaitingForArrival = false.obs; - final RxBool hasMoreDataWaitingForArrival = true.obs; - - @override - void onReady() { - super.onReady(); - getBarGeneralInformation(); - } - - Future getBarGeneralInformation() async { - safeCall( - call: () async => - await rootLogic.chickenRepository.getGeneralBarInformation( - token: rootLogic.tokenService.accessToken.value!, - ), - onError: (error, stackTrace) { - eLog(error); - }, - onSuccess: (result) { - if (result != null) { - barInformation.value = result; - } - }, - ); - } - - - - - Future getImportedEntried() async { - if (isLoadingMoreImportedLoad.value || !hasMoreDataImportedLoad.value) { - return; - } - - if (addPageImportedLoad.value) { - currentPageImportedLoad.value++; - } - -/* safeCall( - call: () async => await rootLogic.chickenRepository.getImportedLoadsModel( - token: rootLogic.tokenService.accessToken.value!, - page: currentPageImportedLoad.value, - ), - onError: (error, stackTrace) { - isLoadingMoreImportedLoad.value = false; - }, - onSuccess: (result) { - if (result != null) { - if (isLoadingMoreImportedLoad.value && result.results != null) { - importedLoads.value?.results?.addAll(result.results!); - } else { - importedLoads.value = result; - } - isLoadingMoreImportedLoad.value = false; - } - }, - );*/ - } - - clearControllers() { - weightController.clear(); - volumeController.clear(); - weightLossController.clear(); - authenticationCodeController.clear(); - } - @override - void dispose() { - rootLogic.inventoryExpandedList.clear(); - super.dispose(); - } - -} diff --git a/packages/chicken/lib/presentation/pages/entering_the_warehouse/view.dart b/packages/chicken/lib/presentation/pages/entering_the_warehouse/view.dart deleted file mode 100644 index aa99608..0000000 --- a/packages/chicken/lib/presentation/pages/entering_the_warehouse/view.dart +++ /dev/null @@ -1,525 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:rasadyar_chicken/data/models/response/bar_information/bar_information.dart'; -import 'package:rasadyar_chicken/data/models/response/inventory/inventory_model.dart'; -import 'package:rasadyar_core/core.dart'; - -import 'logic.dart'; - -class EnteringTheWarehousePage extends GetView { - EnteringTheWarehousePage({super.key}); - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: RAppBar(title: 'ورود به انبار'), - body: SingleChildScrollView( - child: Column( - children: [ - inventoryWidget(), - ObxValue((data) { - return generalBarInformation(data.value); - }, controller.barInformation), - - // importedLoads(), - ], - ), - ), - ); - } - - Widget inventoryWidget() { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: Column( - children: [ - const SizedBox(height: 20), - Align( - alignment: Alignment.centerRight, - child: Text( - 'موجودی انبار', - style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal), - ), - ), - SizedBox(height: 4), - /* ObxValue( - (data) => data.isEmpty - ? Container( - margin: const EdgeInsets.symmetric(vertical: 2), - height: 80, - padding: EdgeInsets.all(6), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: AppColor.blueNormal, width: 1), - ), - child: Center(child: CircularProgressIndicator()), - ) - : ListView.separated( - shrinkWrap: true, - itemCount: controller.rootLogic.inventoryList.length, - separatorBuilder: (context, index) => - const SizedBox(height: 8), - itemBuilder: (context, index) { - return ObxValue((expand) { - return GestureDetector( - onTap: () { - controller.rootLogic.toggleExpanded(index); - }, - behavior: HitTestBehavior.opaque, - child: AnimatedContainer( - onEnd: () { - controller - .rootLogic - .inventoryExpandedList[index] = !controller - .rootLogic - .inventoryExpandedList[index]!; - }, - margin: const EdgeInsets.symmetric(vertical: 2), - padding: EdgeInsets.all(6), - curve: Curves.easeInOut, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8), - border: Border.all( - color: AppColor.blueNormal, - width: 1, - ), - ), - duration: const Duration(seconds: 1), - height: expand.keys.contains(index) ? 250 : 80, - child: inventoryItem( - isExpanded: - expand.keys.contains(index) && expand[index]!, - index: index, - model: controller.rootLogic.inventoryList[index], - ), - ), - ); - }, controller.rootLogic.inventoryExpandedList); - }, - ), - controller.rootLogic.inventoryList, - ),*/ - ], - ), - ); - } - - Widget inventoryItem({ - required bool isExpanded, - required int index, - required InventoryModel model, - }) { - return Column( - mainAxisAlignment: MainAxisAlignment.center, - spacing: 8, - children: [ - buildRow('نام محصول', model.name ?? ''), - Visibility( - visible: isExpanded, - child: Column( - spacing: 8, - children: [ - buildRow('وزن خریدهای دولتی داخل استان (کیلوگرم)', '0'), - buildRow( - 'وزن خریدهای آزاد داخل استان (کیلوگرم)', - model.receiveFreeCarcassesWeight.toString(), - ), - buildRow( - 'وزن خریدهای خارج استان (کیلوگرم)', - model.freeBuyingCarcassesWeight.toString(), - ), - buildRow( - 'کل ورودی به انبار (کیلوگرم)', - model.totalFreeBarsCarcassesWeight.toString(), - ), - buildRow('کل فروش (کیلوگرم)', model.realAllocatedWeight.toString()), - buildRow('مانده انبار (کیلوگرم)', model.totalRemainWeight.toString()), - ], - ), - ), - ], - ); - } - - 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: 1, - child: Text( - value, - textAlign: TextAlign.left, - - style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), - ), - ), - ], - ), - ); - } - - Widget generalBarInformation(BarInformation? model) { - return Column( - children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: Align( - alignment: Alignment.centerRight, - child: Text( - 'اطلاعات کلی بارها', - style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal), - ), - ), - ), - Container( - height: 290, - margin: const EdgeInsets.all(8), - padding: const EdgeInsets.all(12), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: AppColor.blueNormal, width: 1), - ), - child: model != null - ? Column( - crossAxisAlignment: CrossAxisAlignment.start, - spacing: 8, - children: [ - buildRow('تعداد کل بارها', model.totalBars!.toInt().toString()), - buildRow('وزن کل بارها (کیلوگرم)', model.totalBarsWeight!.toInt().toString()), - buildRow( - 'تعداد کل بارهای وارد شده', - model.totalEnteredBars!.toInt().toString(), - ), - buildRow( - 'وزن کل بار وارد شده (کیلوگرم)', - model.totalEnteredBarsWeight!.toInt().toString(), - ), - buildRow( - 'تعداد کل بارهای وارد نشده', - model.totalNotEnteredBars!.toInt().toString(), - ), - buildRow( - 'وزن کل بار وارد نشده (کیلوگرم)', - model.totalNotEnteredKillHouseRequestsWeight!.toInt().toString(), - ), - buildRow('تعداد کل بارهای رد شده', model.totalRejectedBars!.toInt().toString()), - buildRow( - ' وزن کل بارهای رد شده', - model.totalRejectedBarsWeight!.toInt().toString(), - ), - ], - ) - : const Center(child: CircularProgressIndicator()), - ), - ], - ); - } - - /* Widget waitingForArrival() { - return Column( - children: [ - const SizedBox(height: 8), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: Align( - alignment: Alignment.centerRight, - child: Text( - 'موجودی انبار', - style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal), - ), - ), - ), - ObxValue((data) { - if (data.value == null) { - return Container( - height: 80, - margin: const EdgeInsets.all(8), - padding: const EdgeInsets.all(12), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: AppColor.blueNormal, width: 1), - ), - child: Center(child: CircularProgressIndicator()), - ); - } else if (data.value?.results.isEmpty ?? true) { - return Container( - height: 80, - margin: const EdgeInsets.all(8), - padding: const EdgeInsets.all(12), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: AppColor.blueNormal, width: 1), - ), - child: Center(child: Text('هیچ ورودی در انتظار نیست')), - ); - } else { - return Container( - margin: const EdgeInsets.symmetric(vertical: 2), - height: 700, - padding: const EdgeInsets.all(6), - child: ListView.separated( - controller: controller.scrollControllerWaitingForArrival, - padding: const EdgeInsets.all(8.0), - itemCount: data.value!.results.length + 1, - itemBuilder: (BuildContext context, int index) { - if (index == data.value!.results!.length) { - return Obx( - () => controller.isLoadingMoreWaitingForArrival.value - ? const Padding( - padding: EdgeInsets.symmetric(vertical: 16), - child: Center(child: CircularProgressIndicator()), - ) - : const SizedBox(), - ); - } - final result = data.value!.results[index]; - return Card( - margin: const EdgeInsets.symmetric(vertical: 4.0), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - side: const BorderSide( - color: AppColor.blueNormal, - width: 1, - ), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - buildRow('ردیف', '${index + 1}'), - buildRow( - 'تاریخ ثبت', - result.date!.formattedJalaliDate ?? 'N/A', - ), - buildRow( - 'نوع تخصیص', - result.allocationType?.faAllocationType ?? 'N/A', - ), - buildRow( - 'مشخصات خریدار', - result.toSteward?.user?.fullname ?? 'N/A', - ), - buildRow( - 'مشخصات فروشنده', - result.killHouse?.name ?? 'N/A', - ), - buildRow( - 'نوع فروش', - result.sellType?.faItem ?? 'N/A', - ), - buildRow( - 'قیمت هر کیلو', - '${result.amount ?? 0} تومان', - ), - buildRow( - 'قیمت کل', - '${result.totalAmount ?? 0} تومان', - ), - buildRow( - 'وزن تخصیصی', - '${result.weightOfCarcasses?.toInt() ?? 0} کیلوگرم', - ), - buildRow('وضعیت', result.state?.faItem ?? 'N/A'), - Row( - children: [ - Expanded( - child: RElevated( - text: 'تایید', - onPressed: () { - Get.bottomSheet(acceptBottomSheet(result)); - }, - height: 40, - ), - ), - SizedBox(width: 20), - Expanded( - child: RElevated( - text: 'رد', - onPressed: () { - controller.denyEntried(result.key!); - Get.back(); - }, - backgroundColor: AppColor.error, - height: 40, - ), - ), - ], - ), - ], - ), - ), - ); - }, - separatorBuilder: (BuildContext context, int index) => - SizedBox(height: 8), - ), - ); - } - }, controller.waitingForArrival), - ], - ); - }*/ - - /* Widget importedLoads() { - return Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - buildRow('ردیف', '${index + 1}'), - buildRow( - 'تاریخ ثبت', - result.date!.formattedJalaliDate ?? 'N/A', - ), - buildRow( - 'نوع تخصیص', - result.allocationType?.faAllocationType ?? 'N/A', - ), - buildRow( - 'مشخصات خریدار', - '${result.toSteward?.user?.fullname} - ${result.toSteward?.guildsName}' ?? - 'N/A', - ), - buildRow( - 'مشخصات فروشنده', - result.killHouse?.name ?? 'N/A', - ), - buildRow( - 'نوع فروش', - result.sellType?.faItem ?? 'N/A', - ), - buildRow( - 'قیمت هر کیلو', - '${result.amount ?? 0} ریال ', - ), - buildRow( - 'قیمت کل', - '${result.totalAmount ?? 0} ریال', - ), - buildRow( - 'وزن تخصیصی', - '${result.weightOfCarcasses?.toInt() ?? 0} کیلوگرم', - ), - buildRow( - 'کداحراز', - result.registrationCode?.toString() ?? 'N/A', - ), - buildRow( - 'وضعیت کد احراز', - result.systemRegistrationCode == true - ? "ارسال شده" - : "ارسال نشده" ?? 'N/A', - ), - buildRow( - 'افت وزن(کیلوگرم)', - result.weightLossOfCarcasses?.toInt().toString() ?? - 'N/A', - ), - buildRow( - 'وضعیت', - result.receiverState?.faItem ?? 'N/A', - ), - ], - ), - ); - }*/ - - /* Widget acceptBottomSheet(ResultModel resultModel) { - return BaseBottomSheet( - height: 500, - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - spacing: 8, - children: [ - RTextField( - controller: controller.weightController, - initText: resultModel.realWeightOfCarcasses?.toInt().toString(), - label: 'ورزن', - keyboardType: TextInputType.number, - ), - const SizedBox(height: 8), - RTextField( - controller: controller.volumeController, - label: 'حجم', - keyboardType: TextInputType.number, - ), - const SizedBox(height: 8), - RTextField( - controller: controller.weightLossController, - label: 'افت وزن(کیلوگرم)', - keyboardType: TextInputType.number, - ), - const SizedBox(height: 8), - - SizedBox( - height: 40, - child: ObxValue((data) { - return Row( - children: [ - Radio( - value: 1, - groupValue: controller.acceptType.value, - onChanged: (value) { - controller.acceptType.value = value!; - }, - ), - Text('با کد احراز', style: AppFonts.yekan14), - - SizedBox(width: 12), - Radio( - value: 2, - groupValue: controller.acceptType.value, - onChanged: (value) { - controller.acceptType.value = value!; - }, - ), - Text('با کد احراز', style: AppFonts.yekan14), - ], - ); - }, controller.acceptType), - ), - - const SizedBox(height: 8), - ObxValue( - (data) => Visibility( - visible: data.value == 1, - child: RTextField( - controller: controller.authenticationCodeController, - label: 'کد احراز', - keyboardType: TextInputType.number, - ), - ), - controller.acceptType, - ), - - RElevated( - text: 'تایید', - onPressed: () { - controller.acceptEntried(resultModel.key!); - Get.back(); - }, - ), - ], - ), - ); - }*/ -} diff --git a/packages/chicken/lib/presentation/pages/sales_in_province/view.dart b/packages/chicken/lib/presentation/pages/sales_in_province/view.dart index 965a3f8..d5607e9 100644 --- a/packages/chicken/lib/presentation/pages/sales_in_province/view.dart +++ b/packages/chicken/lib/presentation/pages/sales_in_province/view.dart @@ -6,6 +6,7 @@ import 'package:rasadyar_chicken/data/models/response/roles_products/roles_produ import 'package:rasadyar_chicken/presentation/routes/routes.dart'; import 'package:rasadyar_chicken/presentation/utils/string_utils.dart'; import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart'; +import 'package:rasadyar_chicken/presentation/widget/inventory_widget.dart'; import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart'; import 'package:rasadyar_chicken/presentation/widget/list_row_item.dart'; import 'package:rasadyar_chicken/presentation/widget/page_route.dart'; @@ -25,7 +26,7 @@ class SalesInProvincePage extends GetView { onSearchChanged: (data) => controller.setSearchValue(data), filteringWidget: filterBottomSheet(), widgets: [ - inventoryWidget(), + inventoryWidget(controller.rootLogic), Expanded( child: ObxValue((data) { return RPaginatedListView( @@ -99,22 +100,6 @@ class SalesInProvincePage extends GetView { ); } - Widget inventoryWidget() { - return Container( - width: Get.width, - height: 39, - margin: EdgeInsets.symmetric(horizontal: 8, vertical: 4), - decoration: BoxDecoration(color: AppColor.greenLight, borderRadius: BorderRadius.circular(8)), - alignment: Alignment.center, - child: ObxValue((data) { - return Text( - ' موجودی انبار: ${data.value?.totalRemainWeight?.toInt().separatedByComma ?? '0'} کیلوگرم', - style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkHover), - ); - }, controller.rootLogic.inventoryModel), - ); - } - itemListWidget(AllocatedMadeModel item) { return Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, @@ -193,7 +178,7 @@ class SalesInProvincePage extends GetView { itemListExpandedWidget(AllocatedMadeModel item, int index) { return Container( - padding: EdgeInsets.all(8), + padding: EdgeInsets.symmetric(horizontal: 8), decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)), child: Column( spacing: 8, @@ -218,7 +203,7 @@ class SalesInProvincePage extends GetView { ), Container( height: 32, - padding: EdgeInsets.symmetric(horizontal: 4), + padding: EdgeInsets.symmetric(horizontal: 8), decoration: ShapeDecoration( color: AppColor.blueLight, shape: RoundedRectangleBorder( @@ -338,7 +323,7 @@ class SalesInProvincePage extends GetView { children: [ Text( '${isEditMode ? 'ویرایش' : 'ثبت'} توزیع/ فروش', - style: AppFonts.yekan16Bold.copyWith(color: AppColor.textColor), + style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal), ), const SizedBox(height: 12), productDropDown(), @@ -576,11 +561,11 @@ class SalesInProvincePage extends GetView { Widget filterBottomSheet() { return BaseBottomSheet( - height: 250, + height: 200, child: Column( spacing: 16, children: [ - Text('فیلترها', style: AppFonts.yekan16Bold.copyWith(color: AppColor.darkGreyDarkHover)), + Text('فیلترها', style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal)), Row( spacing: 8, children: [ @@ -599,16 +584,16 @@ class SalesInProvincePage extends GetView { ), ], ), - SizedBox(height: 2), RElevated( text: 'اعمال فیلتر', + isFullWidth: true, + backgroundColor: AppColor.greenNormal, onPressed: () { controller.getAllocatedMade(); Get.back(); }, height: 40, ), - SizedBox(height: 16), ], ), ); 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 d3e9353..f1df06f 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 @@ -43,12 +43,12 @@ class SalesOutOfProvinceLogic extends GetxController { } - void setSearchValue(String value) { - searchedValue.value = value.trim(); + void setSearchValue(String? value) { + searchedValue.value = value?.trim(); if (selectedSegmentIndex.value == 0) { - saleListLogic.searchedValue.value = value.trim(); + saleListLogic.searchedValue.value = value?.trim(); } else { - buyersLogic.searchedValue.value = value.trim(); + buyersLogic.searchedValue.value = value?.trim(); } } 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 f03e7b6..a2ee38f 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 @@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; import 'package:rasadyar_chicken/presentation/pages/sales_out_of_province_buyers/view.dart'; import 'package:rasadyar_chicken/presentation/pages/sales_out_of_province_sales_list/view.dart'; import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart'; +import 'package:rasadyar_chicken/presentation/widget/filter_bottom_sheet.dart'; +import 'package:rasadyar_chicken/presentation/widget/inventory_widget.dart'; import 'package:rasadyar_chicken/presentation/widget/page_route.dart'; import 'package:rasadyar_core/core.dart'; @@ -13,15 +15,12 @@ class SalesOutOfProvincePage extends GetView { @override Widget build(BuildContext context) { return BasePage( - routesWidget: ObxValue( - (route) => buildPageRoute(route), - controller.routesName, - ), + routesWidget: ObxValue((route) => buildPageRoute(route), controller.routesName), onBackPressed: () => Get.back(id: 1), onSearchChanged: (data) => controller.setSearchValue(data), filteringWidget: filterBottomSheet(), widgets: [ - inventoryWidget(), + inventoryWidget(controller.rootLogic), segmentWidget(), Expanded( child: ObxValue((index) { @@ -46,8 +45,7 @@ class SalesOutOfProvincePage extends GetView { borderColor: const Color(0xFFB4B4B4), selectedBorderColor: AppColor.blueNormal, selectedBackgroundColor: AppColor.blueLight, - onSegmentSelected: (index) => - controller.selectedSegmentIndex.value = index, + onSegmentSelected: (index) => controller.selectedSegmentIndex.value = index, backgroundColor: AppColor.whiteGreyNormal, ), ), @@ -56,68 +54,12 @@ class SalesOutOfProvincePage extends GetView { ); } - Widget filterBottomSheet() { - return BaseBottomSheet( - height: 250, - child: Column( - spacing: 16, - children: [ - Text( - 'فیلترها', - style: AppFonts.yekan16Bold.copyWith( - color: AppColor.darkGreyDarkHover, - ), - ), - Row( - spacing: 8, - children: [ - Expanded( - child: dateFilterWidget( - date: controller.fromDateFilter, - onChanged: (jalali) => - controller.fromDateFilter.value = jalali, - ), - ), - Expanded( - child: dateFilterWidget( - isFrom: false, - date: controller.toDateFilter, - onChanged: (jalali) => controller.toDateFilter.value = jalali, - ), - ), - ], - ), - SizedBox(height: 2), - RElevated( - text: 'اعمال فیلتر', - onPressed: () { - controller.submitFilter(); - Get.back(); - }, - height: 40, - ), - SizedBox(height: 16), - ], - ), - ); - } + Widget filterBottomSheet() => filterBottomSheetWidget( + fromDate: controller.fromDateFilter, + onChangedFromDate: (jalali) => controller.fromDateFilter.value = jalali, + toDate: controller.toDateFilter, + onChangedToDate: (jalali) => controller.toDateFilter.value = jalali, + onSubmit: () => controller.submitFilter(), + ); - Widget inventoryWidget() { - return Container( - width: Get.width, - height: 39, - margin: EdgeInsets.symmetric(horizontal: 8, vertical: 4), - decoration: BoxDecoration( - color: AppColor.greenLight, - borderRadius: BorderRadius.circular(8), - ), - alignment: Alignment.center, - child: ObxValue((data) { - return Text( - ' موجودی انبار: ${data.value?.totalRemainWeight?.toInt().separatedByComma ?? '0'} کیلوگرم', - style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkHover), - ); - }, controller.rootLogic.inventoryModel), - ); - } } diff --git a/packages/chicken/lib/presentation/pages/sales_out_of_province_buyers/view.dart b/packages/chicken/lib/presentation/pages/sales_out_of_province_buyers/view.dart index d391b6e..0ec6714 100644 --- a/packages/chicken/lib/presentation/pages/sales_out_of_province_buyers/view.dart +++ b/packages/chicken/lib/presentation/pages/sales_out_of_province_buyers/view.dart @@ -62,7 +62,7 @@ class SalesOutOfProvinceBuyersPage extends GetView(); + return Visibility( + visible: controller.isFilterSelected.value, + child: Container( + width: 8, + height: 8, + decoration: const BoxDecoration( + color: Colors.red, + shape: BoxShape.circle, + ), + ), + ); + }), + ], ), ); } +GestureDetector searchWidget(GestureTapCallback? onSearchTap) { + return GestureDetector( + onTap: onSearchTap, + child: Stack( + alignment: Alignment.topRight, + children: [ + Assets.vec.searchSvg.svg( + width: 24, + height: 24, + colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn), + ), + Obx(() { + final controller = Get.find(); + return Visibility( + visible: controller.searchValue.value!=null, + child: Container( + width: 8, + height: 8, + decoration: const BoxDecoration( + color: Colors.red, + shape: BoxShape.circle, + ), + ), + ); + }), + ], + ), + ); +} \ No newline at end of file diff --git a/packages/chicken/lib/presentation/widget/base_page/view.dart b/packages/chicken/lib/presentation/widget/base_page/view.dart index 64eb9ac..b74db0f 100644 --- a/packages/chicken/lib/presentation/widget/base_page/view.dart +++ b/packages/chicken/lib/presentation/widget/base_page/view.dart @@ -35,7 +35,7 @@ class BasePage extends StatefulWidget { final FloatingActionButtonLocation? floatingActionButtonLocation; final Widget? floatingActionButton; final Widget? filteringWidget; - final void Function(String)? onSearchChanged; + final void Function(String?)? onSearchChanged; final bool hasBack; final bool hasFilter; final bool hasSearch; diff --git a/packages/chicken/lib/presentation/widget/filter_bottom_sheet.dart b/packages/chicken/lib/presentation/widget/filter_bottom_sheet.dart new file mode 100644 index 0000000..a2a2173 --- /dev/null +++ b/packages/chicken/lib/presentation/widget/filter_bottom_sheet.dart @@ -0,0 +1,43 @@ +import 'package:flutter/material.dart'; +import 'package:rasadyar_core/core.dart'; + +Widget filterBottomSheetWidget({ + required Rx fromDate, + required Function(Jalali jalali) onChangedFromDate, + required Rx toDate, + required Function(Jalali jalali) onChangedToDate, + required VoidCallback onSubmit, +}) { + return BaseBottomSheet( + height: 200, + child: Column( + spacing: 16, + children: [ + Text('فیلترها', style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal)), + Row( + spacing: 8, + children: [ + Expanded( + child: dateFilterWidget(date: fromDate, onChanged: onChangedFromDate), + ), + Expanded( + child: dateFilterWidget(isFrom: false, date: toDate, onChanged: onChangedToDate), + ), + ], + ), + + RElevated( + height: 40, + isFullWidth: true, + backgroundColor: AppColor.greenNormal, + text: 'اعمال فیلتر', + onPressed: () { + onSubmit(); + Get.back(); + }, + ), + + ], + ), + ); +} diff --git a/packages/chicken/lib/presentation/widget/inventory_widget.dart b/packages/chicken/lib/presentation/widget/inventory_widget.dart new file mode 100644 index 0000000..1d43026 --- /dev/null +++ b/packages/chicken/lib/presentation/widget/inventory_widget.dart @@ -0,0 +1,23 @@ +import 'package:flutter/material.dart'; +import 'package:rasadyar_chicken/presentation/pages/root/logic.dart'; +import 'package:rasadyar_core/core.dart'; + +Widget inventoryWidget(RootLogic rootLogic) { + return Container( + width: Get.width, + height: 39, + margin: EdgeInsets.symmetric(horizontal: 8, vertical: 4), + decoration: BoxDecoration( + color: AppColor.greenLight, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: AppColor.textColor, width: 0.5), + ), + alignment: Alignment.center, + child: ObxValue((data) { + return Text( + ' موجودی انبار: ${data.value?.totalRemainWeight?.toInt().separatedByComma ?? '0'} کیلوگرم', + style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkHover), + ); + }, rootLogic.inventoryModel), + ); +} diff --git a/packages/chicken/lib/presentation/widget/search/view.dart b/packages/chicken/lib/presentation/widget/search/view.dart index 14562b0..1e09056 100644 --- a/packages/chicken/lib/presentation/widget/search/view.dart +++ b/packages/chicken/lib/presentation/widget/search/view.dart @@ -6,7 +6,7 @@ import 'logic.dart'; class SearchWidget extends StatefulWidget { const SearchWidget({super.key, this.onSearchChanged}); - final void Function(String)? onSearchChanged; + final void Function(String?)? onSearchChanged; @override State createState() => _SearchWidgetState(); @@ -14,6 +14,7 @@ class SearchWidget extends StatefulWidget { class _SearchWidgetState extends State { late final SearchLogic controller; + final TextEditingController textEditingController = TextEditingController(); @override void initState() { @@ -26,26 +27,50 @@ class _SearchWidgetState extends State { Widget build(BuildContext context) { return ObxValue((data) { return AnimatedContainer( - margin: EdgeInsets.symmetric(vertical: 4), duration: const Duration(milliseconds: 300), - padding: const EdgeInsets.only(top: 5), curve: Curves.easeInOut, - height: data.value ? 50 : 0, + height: data.value ? 40 : 0, child: Visibility( visible: data.value, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 8), child: RTextField( - suffixIcon: Padding( - padding: const EdgeInsets.all(12.0), - child: Assets.vec.searchSvg.svg( - width: 10, - height: 10, - colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn), + height: 40, + borderColor: AppColor.blackLight, + suffixIcon: ObxValue( + (data) => Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: (data.value == null) + ? Assets.vec.searchSvg.svg( + width: 10, + height: 10, + colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn), + ) + : IconButton( + onPressed: () { + textEditingController.clear(); + controller.searchValue.value = null; + controller.isSearchSelected.value = false; + widget.onSearchChanged?.call(null); + }, + enableFeedback: true, + padding: EdgeInsets.zero, + iconSize: 24, + splashRadius: 50, + icon: Assets.vec.closeCircleSvg.svg( + width: 20, + height: 20, + colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn), + ), + ), ), + controller.searchValue, ), - hintText: 'جستجو', - controller: TextEditingController(), + hintText: 'جستجو کنید ...', + hintStyle: AppFonts.yekan16.copyWith(color: AppColor.blueNormal), + filledColor: Colors.white, + filled: true, + controller: textEditingController, onChanged: (val) => controller.searchValue.value = val, ), ), diff --git a/packages/chicken/pubspec.yaml b/packages/chicken/pubspec.yaml index 17cc275..d53f7e3 100644 --- a/packages/chicken/pubspec.yaml +++ b/packages/chicken/pubspec.yaml @@ -1,7 +1,6 @@ name: rasadyar_chicken description: A starting point for Dart libraries or applications. -version: 1.0.0 -# repository: https://github.com/my_org/my_repo +version: 1.0.1 environment: sdk: ^3.8.1 diff --git a/packages/core/lib/presentation/common/assets.gen.dart b/packages/core/lib/presentation/common/assets.gen.dart index eb40db8..07d012e 100644 --- a/packages/core/lib/presentation/common/assets.gen.dart +++ b/packages/core/lib/presentation/common/assets.gen.dart @@ -74,6 +74,9 @@ class $AssetsIconsGen { /// File path: assets/icons/clock.svg SvgGenImage get clock => const SvgGenImage('assets/icons/clock.svg'); + /// File path: assets/icons/close_circle.svg + SvgGenImage get closeCircle => const SvgGenImage('assets/icons/close_circle.svg'); + /// File path: assets/icons/close_square.svg SvgGenImage get closeSquare => const SvgGenImage('assets/icons/close_square.svg'); @@ -259,6 +262,7 @@ class $AssetsIconsGen { clipboardEye, clipboardTask, clock, + closeCircle, closeSquare, convertCube, cube, @@ -395,6 +399,9 @@ class $AssetsVecGen { /// File path: assets/vec/clock.svg.vec SvgGenImage get clockSvg => const SvgGenImage.vec('assets/vec/clock.svg.vec'); + /// File path: assets/vec/close_circle.svg.vec + SvgGenImage get closeCircleSvg => const SvgGenImage.vec('assets/vec/close_circle.svg.vec'); + /// File path: assets/vec/close_square.svg.vec SvgGenImage get closeSquareSvg => const SvgGenImage.vec('assets/vec/close_square.svg.vec'); @@ -580,6 +587,7 @@ class $AssetsVecGen { clipboardEyeSvg, clipboardTaskSvg, clockSvg, + closeCircleSvg, closeSquareSvg, convertCubeSvg, cubeSvg, diff --git a/packages/core/lib/presentation/widget/buttons/outline_elevated.dart b/packages/core/lib/presentation/widget/buttons/outline_elevated.dart index 3663161..92a109d 100644 --- a/packages/core/lib/presentation/widget/buttons/outline_elevated.dart +++ b/packages/core/lib/presentation/widget/buttons/outline_elevated.dart @@ -1,7 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:rasadyar_core/presentation/common/app_color.dart'; -import 'package:rasadyar_core/presentation/common/app_fonts.dart'; -import 'package:rasadyar_core/presentation/utils/color_utils.dart'; +import 'package:rasadyar_core/core.dart'; class ROutlinedElevated extends StatefulWidget { ROutlinedElevated({ @@ -16,19 +14,17 @@ class ROutlinedElevated extends StatefulWidget { this.radius, this.textStyle, this.child, - this.width = 150.0, - this.height = 56.0, + this.width, + this.height, }); final String? text; final VoidCallback? onPressed; - final double width; - final double height; + final double? width; + final double? height; Color? foregroundColor; Color? backgroundColor; - Color? borderColor; - Color? disabledBackgroundColor; Color? pressedBackgroundColor; double? radius; @@ -40,64 +36,92 @@ class ROutlinedElevated extends StatefulWidget { } class _ROutlinedElevatedState extends State { + final WidgetStatesController _statesController = WidgetStatesController(); + final GlobalKey _widgetKey = GlobalKey(); + + @override + void initState() { + super.initState(); + WidgetsBinding.instance.addPostFrameCallback((_) { + _getWidgetHeight(); + }); + } + + void _getWidgetHeight() { + final RenderBox? renderBox = _widgetKey.currentContext?.findRenderObject() as RenderBox?; + if (renderBox != null) { + final height = renderBox.size.height; + debugPrint('ارتفاع ویجت بعد از رندر شدن: $height'); + } else { + debugPrint('ویجت هنوز رندر نشده است'); + } + } + + @override + void dispose() { + _statesController.dispose(); + super.dispose(); + } + @override Widget build(BuildContext context) { - return OutlinedButton( - onPressed: widget.onPressed, - style: ButtonStyle( - side: WidgetStateProperty.resolveWith((states) { - if (states.contains(WidgetState.pressed)) { - return BorderSide( - color: widget.borderColor ?? AppColor.blueNormal, - width: 2, - ); - } else if (states.contains(WidgetState.disabled)) { - return BorderSide( - color: widget.borderColor ?? AppColor.blueNormal.withAlpha(38), - width: 2, - ); - } - return BorderSide( - color: widget.borderColor ?? AppColor.blueNormal, - width: 2, - ); - }), - backgroundColor: WidgetStateProperty.resolveWith((states) { - if (states.contains(WidgetState.pressed)) { - if (widget.pressedBackgroundColor != null) { - return widget.pressedBackgroundColor; - } - return widget.backgroundColor?.pressedColor ?? AppColor.blueNormal; - } else if (states.contains(WidgetState.hovered)) { - return widget.backgroundColor?.hoverColor ?? - AppColor.blueNormal.hoverColor; - } else if (states.contains(WidgetState.disabled)) { - return widget.backgroundColor?.disabledColor ?? Colors.transparent; - } - return widget.backgroundColor; - }), - foregroundColor: WidgetStateProperty.resolveWith((states) { - if (states.contains(WidgetState.pressed)) { - return Colors.white; - } else if (states.contains(WidgetState.disabled)) { - return AppColor.blueNormal.withAlpha(38); - } - return AppColor.blueNormal; - }), - - shape: WidgetStatePropertyAll( - RoundedRectangleBorder( - borderRadius: BorderRadius.circular(widget.radius ?? 8), - ), - ), - fixedSize: WidgetStatePropertyAll(Size(widget.width, widget.height)), - padding: WidgetStatePropertyAll(EdgeInsets.zero), - textStyle: WidgetStatePropertyAll( - widget.textStyle ?? - AppFonts.yekan24.copyWith(color: AppColor.blueNormal), - ), + return ConstrainedBox( + constraints: BoxConstraints.tightFor( + width: widget.width ?? 150.w, + height: widget.height ?? 40.h, + ), + child: OutlinedButton( + key: _widgetKey, + statesController: _statesController, + onPressed: widget.onPressed, + style: ButtonStyle( + side: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.pressed)) { + return BorderSide(color: widget.borderColor ?? AppColor.blueNormal, width: 2); + } else if (states.contains(WidgetState.disabled)) { + return BorderSide( + color: widget.borderColor ?? AppColor.blueNormal.withAlpha(38), + width: 2, + ); + } + return BorderSide(color: widget.borderColor ?? AppColor.blueNormal, width: 2); + }), + backgroundColor: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.pressed)) { + if (widget.pressedBackgroundColor != null) { + return widget.pressedBackgroundColor; + } + return widget.backgroundColor?.pressedColor ?? widget.borderColor?.pressedColor; + } else if (states.contains(WidgetState.hovered)) { + return widget.backgroundColor?.hoverColor ?? AppColor.blueNormal.hoverColor; + } else if (states.contains(WidgetState.disabled)) { + return widget.backgroundColor?.disabledColor ?? Colors.transparent; + } + return widget.backgroundColor; + }), + foregroundColor: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.pressed)) { + return Colors.white; + } else if (states.contains(WidgetState.disabled)) { + return AppColor.blueNormal.withAlpha(38); + } + return widget.foregroundColor ?? widget.borderColor ?? AppColor.blueNormal; + }), + shape: WidgetStatePropertyAll( + RoundedRectangleBorder(borderRadius: BorderRadius.circular(widget.radius ?? 8)), + ), + fixedSize: WidgetStatePropertyAll(Size(widget.width ?? 150.w, widget.height ?? 56.h)), + padding: WidgetStatePropertyAll(EdgeInsets.zero), + textStyle: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.pressed)) { + return widget.textStyle?.copyWith(color: Colors.white) ?? + AppFonts.yekan20.copyWith(color: Colors.white); + } + return widget.textStyle ?? AppFonts.yekan20.copyWith(color: AppColor.blueNormal); + }), + ), + child: Text(widget.text ?? ''), ), - child: widget.child ?? Text(widget.text!, style: widget.textStyle), ); } } diff --git a/packages/core/lib/presentation/widget/empty_widget.dart b/packages/core/lib/presentation/widget/empty_widget.dart index a9d3ad4..f07c421 100644 --- a/packages/core/lib/presentation/widget/empty_widget.dart +++ b/packages/core/lib/presentation/widget/empty_widget.dart @@ -11,7 +11,7 @@ class EmptyWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ Row(), - Assets.images.placeHolder.image(width: 170.w,height: 170.h), + Assets.vec.emptySvg.svg(width: 170.w,height: 170.h), Text('داده ای یافت نشد!', style: AppFonts.yekan20.copyWith(color: AppColor.textColor)), ], ); diff --git a/packages/core/lib/presentation/widget/inputs/r_input.dart b/packages/core/lib/presentation/widget/inputs/r_input.dart index 932e915..3ea8ba0 100644 --- a/packages/core/lib/presentation/widget/inputs/r_input.dart +++ b/packages/core/lib/presentation/widget/inputs/r_input.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -37,40 +39,69 @@ class RTextField extends StatefulWidget { final VoidCallback? onTap; final List? inputFormatters; final Widget? suffix; + final FocusNode? focusNode; + final AutovalidateMode? autoValidateMode; + final TextAlign? textAlign; + final TextCapitalization textCapitalization; + final Color? cursorColor; + final bool? autocorrect; + final bool? enableSuggestions; + final TextInputAction? textInputAction; + final double? height; const RTextField({ super.key, + // 🔹 Core required this.controller, this.label, this.hintText, this.initText, + this.onChanged, + this.onSubmitted, + this.onTap, + this.height, + + // 🔸 Behavior this.obscure = false, this.readonly = false, this.enabled = true, this.maxLength, this.minLines, this.maxLines = 1, - this.suffixIcon, - this.prefixIcon, - this.boxConstraints, - this.variant = RTextFieldVariant.normal, - this.filled = false, - this.filledColor, - this.showCounter = false, - this.isDense = false, + this.textInputAction, this.keyboardType, + this.focusNode, + + // ⚙️ Input styling + this.textAlign, + this.textCapitalization = TextCapitalization.none, + this.cursorColor, + this.autocorrect, + this.enableSuggestions, this.style, this.hintStyle, this.labelStyle, this.errorStyle, - this.padding, - this.validator, - this.onChanged, - this.onSubmitted, - this.borderColor, - this.inputFormatters, - this.onTap, + + // 🎨 Decorations + this.suffixIcon, + this.prefixIcon, this.suffix, + this.boxConstraints, + + // 📐 Layout & appearance + this.borderColor, + this.filled = false, + this.filledColor, + this.padding, + this.variant = RTextFieldVariant.normal, + + // 📋 Form validation + this.validator, + this.autoValidateMode, + this.inputFormatters, + this.showCounter = false, + this.isDense = false, }); @override @@ -92,6 +123,27 @@ class RTextField extends StatefulWidget { class _RTextFieldState extends State { late bool obscure; + late TextDirection textDirection; + + Timer? _debounceTimer; + + TextDirection _detectDirection(String text) { + final isPersian = RegExp(r'[\u0600-\u06FF]').hasMatch(text); + return isPersian ? TextDirection.rtl : TextDirection.ltr; + } + + void _debouncedUpdateTextDirection() { + if (_debounceTimer?.isActive ?? false) _debounceTimer!.cancel(); + + _debounceTimer = Timer(const Duration(milliseconds: 300), () { + final newDirection = _detectDirection(widget.controller.text); + if (newDirection != textDirection) { + setState(() { + textDirection = newDirection; + }); + } + }); + } @override void initState() { @@ -100,82 +152,106 @@ class _RTextFieldState extends State { widget.controller.text = widget.initText!; } obscure = widget.obscure; + + textDirection = _detectDirection( + widget.controller.text.isNotEmpty ? widget.controller.text : widget.initText ?? 'سلام', + ); + + widget.controller.addListener(_debouncedUpdateTextDirection); } @override void didUpdateWidget(covariant RTextField oldWidget) { super.didUpdateWidget(oldWidget); - if (widget.initText != null && widget.initText != oldWidget.initText) { + if (widget.initText != null && widget.controller.text != widget.initText) { widget.controller.text = widget.initText!; } } - Widget _buildSuffixIcon() { - if (widget.suffixIcon != null) return widget.suffixIcon!; - if (!widget._isPassword) return const SizedBox.shrink(); + Widget? _buildSuffixIcon() { + if (widget._isPassword || widget._passwordNoBorder) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: GestureDetector( + onTap: () { + setState(() { + obscure = !obscure; + }); + }, + child: Icon( + obscure ? CupertinoIcons.eye : CupertinoIcons.eye_slash, + color: AppColor.darkGreyDarkActive, + ), + ), + ); + } + return widget.suffixIcon; + } - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), - child: GestureDetector( - onTap: () { - setState(() { - obscure = !obscure; - }); - }, - child: Icon( - obscure ? CupertinoIcons.eye : CupertinoIcons.eye_slash, - color: AppColor.darkGreyDarkActive, + @override + Widget build(BuildContext context) { + return SizedBox( + height: widget.height, + child: Padding( + padding: widget.padding ?? EdgeInsets.zero, + child: TextFormField( + controller: widget.controller, + focusNode: widget.focusNode, + textAlign: widget.textAlign ?? TextAlign.start, + readOnly: widget.readonly, + minLines: widget.minLines, + maxLines: widget.maxLines, + onChanged: widget.onChanged, + validator: widget.validator, + inputFormatters: widget.inputFormatters, + enabled: widget.enabled, + obscureText: obscure, + onTap: widget.onTap, + onTapOutside: (_) => FocusScope.of(context).unfocus(), + onFieldSubmitted: widget.onSubmitted, + maxLength: widget.maxLength, + textDirection: textDirection, + style: widget.style, + keyboardType: widget.keyboardType, + autovalidateMode: widget.autoValidateMode ?? AutovalidateMode.disabled, + cursorColor: widget.cursorColor, + textCapitalization: widget.textCapitalization, + autocorrect: widget.autocorrect ?? true, + enableSuggestions: widget.enableSuggestions ?? true, + textInputAction: widget.textInputAction, + decoration: InputDecoration( + contentPadding: const EdgeInsets.symmetric(horizontal: 16), + errorStyle: widget.errorStyle, + errorMaxLines: 1, + isDense: widget.isDense, + suffix: widget.suffix, + suffixIcon: _buildSuffixIcon(), + suffixIconConstraints: widget.boxConstraints, + prefixIcon: widget.prefixIcon, + prefixIconConstraints: widget.boxConstraints, + hintText: widget.hintText, + labelText: widget.label, + alignLabelWithHint: true, + labelStyle: AppFonts.yekan14 + .copyWith(color: AppColor.lightGreyDarkActive) + .merge(widget.labelStyle), + filled: widget.filled || widget._noBorder || widget._passwordNoBorder, + fillColor: widget.filledColor, + counter: widget.showCounter ? null : const SizedBox(), + hintStyle: widget.hintStyle, + enabledBorder: widget._inputBorder, + focusedBorder: widget._inputBorder, + border: widget._inputBorder, + ), ), ), ); } @override - Widget build(BuildContext context) { - return Padding( - padding: widget.padding ?? EdgeInsets.zero, - child: TextFormField( - controller: widget.controller, - readOnly: widget.readonly, - minLines: widget.minLines, - maxLines: widget.maxLines, - onChanged: widget.onChanged, - validator: widget.validator, - inputFormatters: widget.inputFormatters, - enabled: widget.enabled, - obscureText: obscure, - onTap: widget.onTap, - onTapOutside: (_) => FocusScope.of(context).unfocus(), - onFieldSubmitted: widget.onSubmitted, - maxLength: widget.maxLength, - textDirection: TextDirection.rtl, - style: widget.style, - keyboardType: widget.keyboardType, - decoration: InputDecoration( - contentPadding: const EdgeInsets.symmetric(horizontal: 16), - errorStyle: widget.errorStyle, - errorMaxLines: 1, - isDense: widget.isDense, - suffix: widget.suffix, - suffixIcon: _buildSuffixIcon(), - suffixIconConstraints: widget.boxConstraints, - prefixIcon: widget.prefixIcon, - prefixIconConstraints: widget.boxConstraints, - hintText: widget.hintText, - labelText: widget.label, - alignLabelWithHint: true, - labelStyle: AppFonts.yekan14 - .copyWith(color: AppColor.lightGreyDarkActive) - .merge(widget.labelStyle), - filled: widget.filled || widget._noBorder || widget._passwordNoBorder, - fillColor: widget.filledColor, - counter: widget.showCounter ? null : const SizedBox(), - hintStyle: widget.hintStyle, - enabledBorder: widget._inputBorder, - focusedBorder: widget._inputBorder, - border: widget._inputBorder, - ), - ), - ); + void dispose() { + _debounceTimer?.cancel(); + widget.controller.removeListener(_debouncedUpdateTextDirection); + super.dispose(); } } diff --git a/pubspec.yaml b/pubspec.yaml index fc33edc..33a89a4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: rasadyar_app description: "A new Flutter project." publish_to: 'none' -version: 1.2.0+2 +version: 1.3.0+2 environment: sdk: ^3.8.1