fix : ui fix after release 1.3.3

This commit is contained in:
2025-07-16 18:31:47 +03:30
parent 3566e5820d
commit c28a0e6630
22 changed files with 229 additions and 203 deletions

View File

@@ -4,13 +4,12 @@ import 'package:rasadyar_chicken/data/models/local/widely_used_local_model.dart'
import 'package:rasadyar_core/core.dart';
class ChickenLocalDataSourceImp implements ChickenLocalDataSource {
HiveLocalStorage local =diCore.get<HiveLocalStorage>();
HiveLocalStorage local = diCore.get<HiveLocalStorage>();
final String boxName = 'Chicken_Widley_Box';
@override
Future<void> openBox() async {
await local.openBox(boxName);
await local.openBox<WidelyUsedLocalModel>(boxName);
}
@override
@@ -53,7 +52,6 @@ class ChickenLocalDataSourceImp implements ChickenLocalDataSource {
@override
WidelyUsedLocalModel? getAllWidely() {
var res = local.readBox<WidelyUsedLocalModel>(boxName: boxName);
fLog(res.toString());
return res;
return res?.first;
}
}

View File

@@ -44,7 +44,7 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
);
}, controller.waitingProduct),
),
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
/* floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
floatingActionButton: ObxValue((data) {
if ((data.value.data?.results?.length ?? 0) > 1) {
return AnimatedFab(
@@ -58,7 +58,7 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
} else {
return SizedBox.shrink();
}
}, controller.waitingProduct),
}, controller.waitingProduct),*/
);
}

View File

@@ -17,6 +17,7 @@ class BuyOutOfProvinceLogic extends GetxController {
RxList<int> isExpandedList = <int>[].obs;
final RxInt currentPage = 1.obs;
final RxBool isLoadingMoreAllocationsMade = false.obs;
final RxBool isOnLoadingSubmitOrEdit = false.obs;
//TODO add this to Di
ImagePicker imagePicker = ImagePicker();
@@ -170,6 +171,7 @@ class BuyOutOfProvinceLogic extends GetxController {
Future<bool> createStewardPurchaseOutOfProvince() async {
bool res = false;
isOnLoadingSubmitOrEdit.value = true;
if (!(formKey.currentState?.validate() ?? false)) {
return res;
}
@@ -196,6 +198,7 @@ class BuyOutOfProvinceLogic extends GetxController {
res = true;
},
);
isOnLoadingSubmitOrEdit.value = false;
return res;
}
@@ -205,7 +208,6 @@ class BuyOutOfProvinceLogic extends GetxController {
carcassWeightController.clear();
selectedProvince.value = null;
selectedCity.value = null;
selectedProduct.value = null;
selectedImage.value = null;
_base64Image.value = null;
editImageUrl.value = null;

View File

@@ -379,12 +379,13 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
}
Widget submitButtonWidget(bool isOnEdit) {
return ObxValue((data) {
return Obx(() {
return RElevated(
text: isOnEdit ? 'ویرایش' : 'ثبت',
width: Get.width,
backgroundColor: AppColor.greenNormal,
onPressed: data.value
isLoading: controller.isOnLoadingSubmitOrEdit.value,
onPressed: controller.isSubmitButtonEnabled.value
? () async {
var res = await controller.createStewardPurchaseOutOfProvince();
if (res) {
@@ -394,7 +395,7 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
: null,
height: 40,
);
}, controller.isSubmitButtonEnabled);
});
}
Widget _productDropDown() {

View File

@@ -57,59 +57,32 @@ class ProfilePage extends GetView<ProfileLogic> {
),
),
ObxValue((data) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Wrap(
spacing: 20,
runSpacing: 10,
children: [
cardActionWidget(
title: 'اطلاعات کاربری',
onPressed: () {
data.value = 0;
},
icon: Assets.vec.profileUserSvg.path,
selected: data.value == 0,
),
Center(
child: Wrap(
alignment: WrapAlignment.center,
spacing: 20,
runSpacing: 10,
children: [
cardActionWidget(
title: 'تغییر رمز عبور',
selected: true,
onPressed: () {
Get.bottomSheet(changePasswordBottomSheet(), isScrollControlled: true);
},
icon: Assets.vec.lockSvg.path,
),
cardActionWidget(
title: 'خروج',
selected: true,
onPressed: () {
Get.bottomSheet(exitBottomSheet(), isScrollControlled: true);
},
icon: Assets.vec.logoutSvg.path,
),
],
),
),
cardActionWidget(
title: 'تغییر رمز عبور',
selected: true,
onPressed: () {
Get.bottomSheet(changePasswordBottomSheet(), isScrollControlled: true);
},
icon: Assets.vec.lockSvg.path,
),
cardActionWidget(
title: 'خروج',
selected: true,
onPressed: () {
Get.bottomSheet(exitBottomSheet(), isScrollControlled: true);
},
icon: Assets.vec.logoutSvg.path,
),
/*cardActionWidget(
title: 'اطلاعات بانکی',
onPressed: () {
data.value = 1;
},
icon: Assets.vec.informationSvg.path,
selected: data.value == 1,
),
cardActionWidget(
title: 'اطلاعات \nصدور فاکتور',
onPressed: () {
data.value = 2;
},
icon: Assets.vec.receiptDiscountSvg.path,
selected: data.value == 2,
),*/
],
),
);
}, controller.selectedInformationType),
SizedBox(height: 100),
],

View File

@@ -49,10 +49,11 @@ class RootLogic extends GetxController {
super.onInit();
localDatasource = diChicken.get<ChickenLocalDataSourceImp>();
chickenRepository = diChicken.get<ChickenRepositoryImp>();
localDatasource.openBox().then((value) async {
widelyUsedList.value = localDatasource.getAllWidely();
});
widelyUsedList.value = localDatasource.getAllWidely();
//getKillHouseDistributionInfo();
}
@override
@@ -70,9 +71,7 @@ class RootLogic extends GetxController {
}
if (widelyUsedList.value?.hasInit != true) {
localDatasource.initWidleyUsed().then(
(value) => localDatasource.getAllWidely(),
);
localDatasource.initWidleyUsed().then((value) => localDatasource.getAllWidely());
}
}

View File

@@ -86,13 +86,20 @@ class RootPage extends GetView<RootLogic> {
label: 'خرید',
icon: Assets.vec.buySvg.path,
isSelected: controller.currentPage.value == 0,
onTap: () => controller.changePage(0),
onTap: () {
Get.nestedKey(1)?.currentState?.popUntil((route) => route.isFirst);
controller.changePage(0);
},
),
RBottomNavigationItem(
label: 'فروش',
icon: Assets.vec.saleSvg.path,
isSelected: controller.currentPage.value == 1,
onTap: () => controller.changePage(1),
onTap: () {
Get.nestedKey(0)?.currentState?.popUntil((route) => route.isFirst);
controller.changePage(1);
},
),
RBottomNavigationItem(
label: 'خانه',

View File

@@ -3,7 +3,6 @@ import 'package:flutter/services.dart';
import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart';
import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart';
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
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';
@@ -743,7 +742,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
Widget show2StepAddBottomSheet() {
return BaseBottomSheet(
height: Get.height * .35,
height: Get.height * .39,
child: Column(
spacing: 8,
children: [
@@ -808,7 +807,9 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
text: ' بازگشت',
textStyle: AppFonts.yekan18.copyWith(color: AppColor.error),
onPressed: () {
Get.until((route) => route.settings.name == ChickenRoutes.salesInProvince);
Get
..back()
..back();
},
),
),

View File

@@ -1,5 +1,4 @@
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';
@@ -21,14 +20,8 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
filteringWidget: filterBottomSheet(),
widgets: [
inventoryWidget(controller.rootLogic),
segmentWidget(),
Expanded(
child: ObxValue((index) {
return index.value == 0
? SalesOutOfProvinceSalesListPage()
: SalesOutOfProvinceBuyersPage();
}, controller.selectedSegmentIndex),
),
Expanded(child: SalesOutOfProvinceSalesListPage()),
],
);
}
@@ -61,5 +54,4 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
onChangedToDate: (jalali) => controller.toDateFilter.value = jalali,
onSubmit: () => controller.submitFilter(),
);
}

View File

@@ -1,8 +1,10 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart';
import 'package:rasadyar_chicken/presentation/routes/routes.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';
@@ -44,10 +46,23 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
separatorBuilder: (context, index) => SizedBox(height: 8.h),
);
}, controller.salesList),
floatingActionButton: RFab.add(
onPressed: () {
Get.bottomSheet(addOrEditSaleBottomSheet(), isScrollControlled: true);
},
floatingActionButton: Row(
children: [
RFab.add(
onPressed: () {
Get.bottomSheet(addOrEditSaleBottomSheet(), isScrollControlled: true);
},
),
Spacer(),
RFab(
icon: Icon(CupertinoIcons.person_add_solid, color: Colors.white, size: 35.w),
backgroundColor: AppColor.blueNormal,
onPressed: () {
Get.toNamed(ChickenRoutes.salesOutOfProvinceBuyer, id: 1);
},
),
SizedBox(width: 25),
],
),
floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
);

View File

@@ -77,17 +77,15 @@ class SegmentationLogic extends GetxController {
void clearForm() {
weightController.text = '0';
selectedSegment.value = null;
}
void validateForm() {
isSubmitButtonEnabled = RxBool(
var weight = int.tryParse(weightController.text.clearComma.trim());
isSubmitButtonEnabled.value =
selectedProduct.value != null &&
selectedSegment.value != null &&
weightController.text.isNotEmpty &&
int.tryParse(weightController.text) != null &&
int.tryParse(weightController.text)! > 0,
);
weight! > 0
;
}
Future<void> getAllSegmentation([bool isLoadingMore = false]) async {

View File

@@ -19,6 +19,7 @@ import 'package:rasadyar_chicken/presentation/pages/sales_in_province/view.dart'
import 'package:rasadyar_chicken/presentation/pages/sales_out_of_province/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/sales_out_of_province/view.dart';
import 'package:rasadyar_chicken/presentation/pages/sales_out_of_province_buyers/logic.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/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/segmentation/logic.dart';
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
@@ -79,6 +80,17 @@ sealed class ChickenPages {
Get.lazyPut(() => SalesOutOfProvinceSalesListLogic());
}),
),
GetPage(
name: ChickenRoutes.salesOutOfProvinceBuyer,
page: () => SalesOutOfProvinceBuyersPage(),
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.lazyPut(() => SearchLogic());
Get.lazyPut(() => SalesOutOfProvinceLogic());
Get.lazyPut(() => SalesOutOfProvinceBuyersLogic());
Get.lazyPut(() => SalesOutOfProvinceSalesListLogic());
}),
),
GetPage(
name: ChickenRoutes.salesInProvince,
page: () => SalesInProvincePage(),

View File

@@ -15,6 +15,7 @@ sealed class ChickenRoutes {
//sales
static const salesInProvince = '$sale/SalesInProvince';
static const salesOutOfProvince = '$sale/saleOutOfProvince';
static const salesOutOfProvinceBuyer = '$sale/saleOutOfProvinceBuyer ';
}

View File

@@ -20,7 +20,7 @@ class WidelyUsedWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('پر کاربرد ها', textAlign: TextAlign.right, style: AppFonts.yekan16),
ObxValue((data) {
/* ObxValue((data) {
return GestureDetector(
onTap: () {
controller.toggleType();
@@ -37,32 +37,73 @@ class WidelyUsedWidget extends StatelessWidget {
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
),
);
}, controller.type),
}, controller.type)*/
],
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 2.0, vertical: 2),
child: ObxValue((data) {
return Wrap(
spacing: 4,
runSpacing: 18,
children: [
widelyUsed(
title: 'خرید خارج استان',
isOnEdit: controller.type.value == WidelyUsedType.edit,
iconPath: Assets.vec.truckFastSvg.path,
onTap: () async {
controller.rootLogic.currentPage.value = 0;
controller.rootLogic.currentPage.refresh();
await Future.delayed(Duration(milliseconds: 100));
Get.toNamed(ChickenRoutes.buysOutOfProvince, id: 0);
},
),
],
);
}, controller.type),
child: Wrap(
spacing: 15,
runSpacing: 8,
children: [
widelyUsed(
title: 'خرید خارج استان',
iconPath: Assets.vec.truckFastSvg.path,
isOnEdit: false,
cardColor: AppColor.greenLightActive,
labelColor: AppColor.greenNormal,
textColor: AppColor.greenDarkHover,
onTap: () async {
controller.rootLogic.currentPage.value = 0;
controller.rootLogic.currentPage.refresh();
await Future.delayed(Duration(milliseconds: 100));
Get.toNamed(ChickenRoutes.buysOutOfProvince, id: 0);
},
),
widelyUsed(
title: 'خرید داخل استان',
iconPath: Assets.vec.cubeSvg.path,
cardColor: AppColor.greenLightActive,
labelColor: AppColor.greenNormal,
textColor: AppColor.greenDarkHover,
onTap: () async {
controller.rootLogic.currentPage.value = 0;
controller.rootLogic.currentPage.refresh();
await Future.delayed(Duration(milliseconds: 100));
Get.toNamed(ChickenRoutes.buysInProvince, id: 0);
},
isOnEdit: false,
),
widelyUsed(
title: 'فروش خارج استان',
iconPath: Assets.vec.truckFastSvg.path,
isOnEdit: false,
onTap: () async {
controller.rootLogic.currentPage.value = 1;
controller.rootLogic.currentPage.refresh();
await Future.delayed(Duration(milliseconds: 100));
Get.toNamed(ChickenRoutes.salesOutOfProvince, id: 1);
},
),
widelyUsed(
title: 'فروش داخل استان',
iconPath: Assets.vec.cubeSvg.path,
isOnEdit: false,
onTap: () async {
controller.rootLogic.currentPage.value = 1;
controller.rootLogic.currentPage.refresh();
await Future.delayed(Duration(milliseconds: 100));
Get.toNamed(ChickenRoutes.salesInProvince, id: 1);
},
),
],
),
),
],
);
@@ -73,6 +114,9 @@ class WidelyUsedWidget extends StatelessWidget {
required String iconPath,
required VoidCallback onTap,
required bool isOnEdit,
Color? cardColor,
Color? labelColor,
Color? textColor,
}) {
return GestureDetector(
onTap: !isOnEdit ? onTap : null,
@@ -89,14 +133,14 @@ class WidelyUsedWidget extends StatelessWidget {
height: 48,
padding: EdgeInsets.all(4),
decoration: ShapeDecoration(
color: Color(0xFFBECDFF),
color: cardColor ?? Color(0xFFBECDFF),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
child: Container(
width: 40,
height: 40,
decoration: ShapeDecoration(
color: AppColor.blueNormal,
color: labelColor ?? AppColor.blueNormal,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
child: SvgGenImage.vec(iconPath).svg(
@@ -146,7 +190,7 @@ class WidelyUsedWidget extends StatelessWidget {
),
],
),
Text(title, style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)),
Text(title, style: AppFonts.yekan10.copyWith(color: textColor ?? AppColor.blueNormal)),
],
),
);