feat : search and filter in buyer out of the province

This commit is contained in:
MrM
2025-06-24 09:29:11 +03:30
parent 078fe9a022
commit d4f1e86295
5 changed files with 131 additions and 89 deletions

View File

@@ -1,14 +0,0 @@
// Generated file. Do not edit.
// This file is generated by the iFlutter
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
class AssetsRes {
AssetsRes._();
static const String PROJECT_NAME = 'rasadyar_app';
static const String PROJECT_VERSION = '1.2.0+2';
static const String INSIDE = 'assets/icons/inside.svg';
static const String OUTSIDE = 'assets/icons/outside.svg';
static const String WHARE_HOUSE = 'assets/icons/whare_house.svg';
}

View File

@@ -1,12 +0,0 @@
// Generated file. Do not edit.
// This file is generated by the iFlutter
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
class FontRes {
FontRes._();
static const String PROJECT_NAME = 'rasadyar_app';
static const String PROJECT_VERSION = '1.2.0+2';
static const String IRANYEKANREGULARFANUM = 'iranyekanregularfanum';
}

View File

@@ -52,14 +52,17 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
),
),
SizedBox(width: 8),
GestureDetector(
onTap: () {
// Get.bottomSheet(filterBottomSheet());
},
child: Assets.vec.filterOutlineSvg.svg(
width: 20,
height: 20,
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
Visibility(
visible: controller.currentIndex.value==0,
child: GestureDetector(
onTap: () {
// Get.bottomSheet(filterBottomSheet());
},
child: Assets.vec.filterOutlineSvg.svg(
width: 20,
height: 20,
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
),
),
),
SizedBox(width: 8),
@@ -800,35 +803,5 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
);
}
ObxValue<RxBool> _buildSearchWidget() {
return ObxValue((data) {
return AnimatedContainer(
duration: Duration(milliseconds: 300),
padding: EdgeInsets.only(top: 5),
curve: Curves.easeInOut,
height: data.value ? 50 : 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),
),
),
hintText: 'جستجو',
onChanged: (value) {
controller.searchedValue.value = value;
},
controller: TextEditingController(),
),
),
),
);
}, controller.searchIsSelected);
}
}

View File

@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
import 'package:rasadyar_chicken/presentation/pages/sales_out_of_province/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/sales_out_of_province/widgets/search_widget.dart';
import 'package:rasadyar_core/core.dart';
import 'empty_widget.dart';
@@ -13,10 +14,22 @@ class BuyersPage extends GetView<SalesOutOfProvinceLogic> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: buyerListWidget(),
body: Column(
children: [
searchWidget(controller.searchIsSelected, (data) {
controller.searchedValue.value = data;
controller.getOutProvinceCarcassesBuyer();
}),
buyerListWidget(),
],
),
floatingActionButton: RFab.add(
onPressed: () {
Get.bottomSheet(addOrEditBuyerBottomSheet(), isScrollControlled: true);
Get.bottomSheet(
addOrEditBuyerBottomSheet(),
isScrollControlled: true,
);
},
),
floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
@@ -36,7 +49,11 @@ class BuyersPage extends GetView<SalesOutOfProvinceLogic> {
padding: EdgeInsets.fromLTRB(8, 8, 18, 80),
itemBuilder: (context, index) {
return ObxValue(
(expandList) => buyerListItem(expandList: expandList, index: index, item: data.value.data![index]),
(expandList) => buyerListItem(
expandList: expandList,
index: index,
item: data.value.data![index],
),
controller.isExpandedList,
);
},
@@ -84,7 +101,10 @@ class BuyersPage extends GetView<SalesOutOfProvinceLogic> {
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 0.5, color: AppColor.darkGreyNormal),
border: Border.all(
width: 0.5,
color: AppColor.darkGreyNormal,
),
),
child: AnimatedCrossFade(
alignment: Alignment.center,
@@ -102,14 +122,18 @@ class BuyersPage extends GetView<SalesOutOfProvinceLogic> {
Text(
item.buyer?.fullname ?? 'N/A',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
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),
style: AppFonts.yekan14.copyWith(
color: AppColor.bgDark,
),
),
],
),
@@ -121,7 +145,9 @@ class BuyersPage extends GetView<SalesOutOfProvinceLogic> {
child: Text(
'${item.unitName}',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
style: AppFonts.yekan12.copyWith(
color: AppColor.bgDark,
),
),
),
Expanded(
@@ -129,7 +155,9 @@ class BuyersPage extends GetView<SalesOutOfProvinceLogic> {
child: Text(
'${item.buyer?.province}\n${item.buyer?.city}',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDark),
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDark,
),
),
),
@@ -141,7 +169,10 @@ class BuyersPage extends GetView<SalesOutOfProvinceLogic> {
secondChild: Container(
padding: EdgeInsets.fromLTRB(8, 12, 14, 12),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
child: Column(
spacing: 8,
children: [
@@ -151,23 +182,29 @@ class BuyersPage extends GetView<SalesOutOfProvinceLogic> {
GestureDetector(
onTap: () {
controller.setEditData(item);
Get.bottomSheet(addOrEditBuyerBottomSheet(true), isScrollControlled: true).whenComplete(
() {
controller.resetSubmitForm();
},
);
Get.bottomSheet(
addOrEditBuyerBottomSheet(true),
isScrollControlled: true,
).whenComplete(() {
controller.resetSubmitForm();
});
},
child: Assets.vec.editSvg.svg(
width: 20,
height: 20,
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
colorFilter: ColorFilter.mode(
AppColor.blueNormal,
BlendMode.srcIn,
),
),
),
Text(
'${item.province}-${item.city}',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
style: AppFonts.yekan16.copyWith(
color: AppColor.greenDark,
),
),
SizedBox(),
@@ -176,12 +213,20 @@ class BuyersPage extends GetView<SalesOutOfProvinceLogic> {
buildRow('مشخصات خریدار', item.fullname ?? 'N/A'),
buildRow('نام واحد', item.unitName ?? 'N/A'),
buildRow('تعداد درخواست ها', '${item.requestsInfo?.numberOfRequests.separatedByComma}'),
buildRow('وزن', '${item.requestsInfo?.totalWeight.separatedByComma}'),
buildRow(
'تعداد درخواست ها',
'${item.requestsInfo?.numberOfRequests.separatedByComma}',
),
buildRow(
'وزن',
'${item.requestsInfo?.totalWeight.separatedByComma}',
),
],
),
),
crossFadeState: expandList.contains(index) ? CrossFadeState.showSecond : CrossFadeState.showFirst,
crossFadeState: expandList.contains(index)
? CrossFadeState.showSecond
: CrossFadeState.showFirst,
duration: Duration(milliseconds: 300),
),
),
@@ -195,10 +240,16 @@ class BuyersPage extends GetView<SalesOutOfProvinceLogic> {
decoration: BoxDecoration(
color: AppColor.greenLightHover,
borderRadius: BorderRadius.circular(4),
border: Border.all(width: 0.50, color: AppColor.greenDarkActive),
border: Border.all(
width: 0.50,
color: AppColor.greenDarkActive,
),
),
alignment: Alignment.center,
child: Text((index + 1).toString(), style: AppFonts.yekan12.copyWith(color: Colors.black)),
child: Text(
(index + 1).toString(),
style: AppFonts.yekan12.copyWith(color: Colors.black),
),
),
),
],
@@ -218,7 +269,9 @@ class BuyersPage extends GetView<SalesOutOfProvinceLogic> {
child: Text(
title,
textAlign: TextAlign.right,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
),
Flexible(
@@ -227,7 +280,9 @@ class BuyersPage extends GetView<SalesOutOfProvinceLogic> {
value,
textAlign: TextAlign.left,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
),
],
@@ -246,7 +301,9 @@ class BuyersPage extends GetView<SalesOutOfProvinceLogic> {
children: [
Text(
isOnEdit ? 'ویرایش خریدار' : 'افزودن خریدار',
style: AppFonts.yekan16Bold.copyWith(color: AppColor.darkGreyDarkHover),
style: AppFonts.yekan16Bold.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
RTextField(

View File

@@ -0,0 +1,38 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
ObxValue<RxBool> searchWidget(
RxBool searchIsSelected,
void Function(String) onChanged,
) {
return ObxValue((data) {
return AnimatedContainer(
duration: Duration(milliseconds: 300),
padding: EdgeInsets.only(top: 5),
curve: Curves.easeInOut,
height: data.value ? 50 : 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,
),
),
),
hintText: 'جستجو',
onChanged: onChanged,
controller: TextEditingController(),
),
),
),
);
}, searchIsSelected);
}