fix : ui change's

This commit is contained in:
2025-07-09 14:54:28 +03:30
parent d51e0240bb
commit 0b921fa917
27 changed files with 611 additions and 1004 deletions

View File

@@ -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';

View File

@@ -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;
}
}
}

View File

@@ -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<BuyInProvinceLogic> {
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<BuyInProvinceLogic> {
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<BuyInProvinceLogic> {
),
],
),
SizedBox(height: 2),
RElevated(
text: 'اعمال فیلتر',
isFullWidth: true,
backgroundColor: AppColor.greenNormal,
onPressed: () {
controller.submitFilter();
Get.back();
@@ -90,22 +95,5 @@ class BuyInProvincePage extends GetView<BuyInProvinceLogic> {
);
}
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),
);
}
}

View File

@@ -18,7 +18,7 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
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<BuyInProvinceWaitingLogic> {
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<BuyInProvinceWaitingLogic> {
),
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<BuyInProvinceWaitingLogic> {
),
),
// buildRow(title: 'مشخصات فروشنده', value: item.killHouseName ?? 'N/A'),
buildRow(
title: 'نام و نام خانوادگی فروشنده',
value: item.steward?.user?.fullname ?? 'N/A',

View File

@@ -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<BuyOutOfProvinceLogic> {
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<BuyOutOfProvinceLogic> {
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<BuyOutOfProvinceLogic> {
),
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<BuyOutOfProvinceLogic> {
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<BuyOutOfProvinceLogic> {
},
loadingBuilder: (context, child, loadingProgress) {
if (loadingProgress == null) return child;
print('Loading progress: $loadingProgress');
return CupertinoActivityIndicator();
},
),
@@ -300,7 +300,7 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
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<BuyOutOfProvinceLogic> {
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<BuyOutOfProvinceLogic> {
),
],
),
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),
);
}
}

View File

@@ -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<RootLogic>();
Rxn<BarInformation> barInformation = Rxn<BarInformation>();
Rxn<WaitingArrivalModel> waitingForArrival = Rxn<WaitingArrivalModel>();
Rxn<ImportedLoadsModel> importedLoads = Rxn<ImportedLoadsModel>();
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<void> 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<void> 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();
}
}

View File

@@ -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<EnteringTheWarehouseLogic> {
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();
},
),
],
),
);
}*/
}

View File

@@ -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<SalesInProvinceLogic> {
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<SalesInProvinceLogic> {
);
}
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<SalesInProvinceLogic> {
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<SalesInProvinceLogic> {
),
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<SalesInProvinceLogic> {
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<SalesInProvinceLogic> {
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<SalesInProvinceLogic> {
),
],
),
SizedBox(height: 2),
RElevated(
text: 'اعمال فیلتر',
isFullWidth: true,
backgroundColor: AppColor.greenNormal,
onPressed: () {
controller.getAllocatedMade();
Get.back();
},
height: 40,
),
SizedBox(height: 16),
],
),
);

View File

@@ -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();
}
}

View File

@@ -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<SalesOutOfProvinceLogic> {
@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<SalesOutOfProvinceLogic> {
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<SalesOutOfProvinceLogic> {
);
}
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),
);
}
}

View File

@@ -62,7 +62,7 @@ class SalesOutOfProvinceBuyersPage extends GetView<SalesOutOfProvinceBuyersLogic
children: [
Text(
isOnEdit ? 'ویرایش خریدار' : 'افزودن خریدار',
style: AppFonts.yekan16Bold.copyWith(color: AppColor.darkGreyDarkHover),
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
),
Container(
@@ -192,54 +192,58 @@ class SalesOutOfProvinceBuyersPage extends GetView<SalesOutOfProvinceBuyersLogic
}
itemListWidget(OutProvinceCarcassesBuyer item) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
SizedBox(width: 12),
return Padding(
padding: const EdgeInsets.only(right: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
SizedBox(width: 8),
Expanded(
flex: 2,
child: Column(
children: [
Text(
item.buyer?.fullname ?? 'N/A',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
Expanded(
flex: 2,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
item.buyer?.fullname ?? 'N/A',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
SizedBox(height: 2),
Text(
item.buyer?.mobile ?? 'N/A',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
),
],
SizedBox(height: 2),
Text(
item.buyer?.mobile ?? 'N/A',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
),
],
),
),
),
Expanded(
flex: 2,
child: Text(
'${item.unitName}',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
Expanded(
flex: 2,
child: Text(
'${item.unitName}',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
),
),
),
Expanded(
flex: 2,
child: Text(
'${item.buyer?.province}\n${item.buyer?.city}',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDark),
Expanded(
flex: 2,
child: Text(
'${item.buyer?.province}\n${item.buyer?.city}',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDark),
),
),
),
],
],
),
);
}
itemListExpandedWidget(OutProvinceCarcassesBuyer item) {
return Container(
padding: EdgeInsets.fromLTRB(8, 12, 14, 12),
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
child: Column(

View File

@@ -121,8 +121,7 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
itemListExpandedWidget(StewardFreeSaleBar item, int index) {
return Container(
padding: EdgeInsets.fromLTRB(8, 12, 14, 12),
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
child: Column(
spacing: 8,
@@ -139,7 +138,7 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
),
Container(
height: 32,
padding: EdgeInsets.symmetric(horizontal: 4),
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: ShapeDecoration(
color: AppColor.blueLight,
shape: RoundedRectangleBorder(
@@ -147,7 +146,35 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
borderRadius: BorderRadius.circular(8),
),
),
child: buildRow(title: 'تاریخ', value: item.date?.formattedJalaliDateYHMS ?? 'N/A'),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
spacing: 3,
children: [
Text(
item.date?.toJalali.formatter.wN ?? 'N/A',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
Text(
'${item.date?.toJalali.formatter.d} ${item.date?.toJalali.formatter.mN ?? 'N/A'}',
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
],
),
Text(
'${item.date?.toJalali.formatter.y}',
style: AppFonts.yekan20.copyWith(color: AppColor.textColor),
),
Text(
'${item.date?.toJalali.formatter.tHH}:${item.date?.toJalali.formatter.tMM ?? 'N/A'}',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
],
),
),
buildRow(title: 'مشخصات خریدار', value: item.buyer?.fullname ?? 'N/A'),
buildRow(title: 'تلفن خریدار', value: item.buyer?.mobile ?? 'N/A'),
@@ -208,7 +235,7 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
children: [
Text(
isOnEdit ? 'ویرایش فروش' : 'افزودن فروش',
style: AppFonts.yekan16Bold.copyWith(color: AppColor.darkGreyDarkHover),
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
),
_productDropDown(),

View File

@@ -1,4 +1,6 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/logic.dart';
import 'package:rasadyar_chicken/presentation/widget/search/logic.dart';
import 'package:rasadyar_core/core.dart';
RAppBar chickenAppBar({
@@ -22,7 +24,6 @@ RAppBar chickenAppBar({
Assets.vec.chickenSvg.svg(
width: 24,
height: 24,
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
),
],
),
@@ -35,24 +36,62 @@ RAppBar chickenAppBar({
);
}
GestureDetector filterWidget(GestureTapCallback? onSearchTap) {
return GestureDetector(
onTap: onSearchTap,
child: Assets.vec.filterOutlineSvg.svg(
width: 20,
height: 20,
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
),
);
}
GestureDetector searchWidget(GestureTapCallback? onFilterTap) {
GestureDetector filterWidget(GestureTapCallback? onFilterTap) {
return GestureDetector(
onTap: onFilterTap,
child: Assets.vec.searchSvg.svg(
width: 24,
height: 24,
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
child: Stack(
alignment: Alignment.topRight,
children: [
Assets.vec.filterOutlineSvg.svg(
width: 20,
height: 20,
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
),
Obx(() {
final controller = Get.find<BaseLogic>();
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<SearchLogic>();
return Visibility(
visible: controller.searchValue.value!=null,
child: Container(
width: 8,
height: 8,
decoration: const BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
),
);
}),
],
),
);
}

View File

@@ -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;

View File

@@ -0,0 +1,43 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
Widget filterBottomSheetWidget({
required Rx<Jalali> fromDate,
required Function(Jalali jalali) onChangedFromDate,
required Rx<Jalali> 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();
},
),
],
),
);
}

View File

@@ -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),
);
}

View File

@@ -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<SearchWidget> createState() => _SearchWidgetState();
@@ -14,6 +14,7 @@ class SearchWidget extends StatefulWidget {
class _SearchWidgetState extends State<SearchWidget> {
late final SearchLogic controller;
final TextEditingController textEditingController = TextEditingController();
@override
void initState() {
@@ -26,26 +27,50 @@ class _SearchWidgetState extends State<SearchWidget> {
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,
),
),

View File

@@ -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