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 0000000..59e1d5b
Binary files /dev/null and b/assets/vec/close_circle.svg.vec differ
diff --git a/assets/vec/empty.svg.vec b/assets/vec/empty.svg.vec
index 37f9ed7..5fcf9c8 100644
Binary files a/assets/vec/empty.svg.vec and b/assets/vec/empty.svg.vec differ
diff --git a/packages/chicken/lib/presentation/pages/buy/view.dart b/packages/chicken/lib/presentation/pages/buy/view.dart
index bd04053..cbdef58 100644
--- a/packages/chicken/lib/presentation/pages/buy/view.dart
+++ b/packages/chicken/lib/presentation/pages/buy/view.dart
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
-import 'package:rasadyar_chicken/presentation/widget/app_bar.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_chicken/presentation/widget/sale_buy_card_item.dart';
import 'package:rasadyar_core/core.dart';
diff --git a/packages/chicken/lib/presentation/pages/buy_in_province/logic.dart b/packages/chicken/lib/presentation/pages/buy_in_province/logic.dart
index 6bc5f5b..9fdb789 100644
--- a/packages/chicken/lib/presentation/pages/buy_in_province/logic.dart
+++ b/packages/chicken/lib/presentation/pages/buy_in_province/logic.dart
@@ -31,7 +31,6 @@ class BuyInProvinceLogic extends GetxController {
ever(fromDateFilter, (callback) => _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