fix : ui fix after release 1.3.3

This commit is contained in:
2025-07-17 15:44:40 +03:30
parent c28a0e6630
commit 7790a4017e
18 changed files with 898 additions and 207 deletions

View File

@@ -1,41 +1,56 @@
import 'package:rasadyar_auth/data/utils/safe_call.dart';
import 'package:rasadyar_chicken/chicken.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_chicken/data/models/response/kill_house_distribution_info/kill_house_distribution_info.dart';
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
import 'package:rasadyar_core/core.dart';
class HomeLogic extends GetxController {
RootLogic rootLogic = Get.find<RootLogic>();
RxnInt totalWeightTodayBars = RxnInt();
Rxn<KillHouseDistributionInfo> killHouseDistributionInfo = Rxn<KillHouseDistributionInfo>();
Rxn<BarInformation> barInformation = Rxn();
RxBool isExpanded = false.obs;
@override
void onReady() {
super.onReady();
getGeneralBarsInformation();
getTodayBars();
getDistributionInformation();
}
Future<void> getGeneralBarsInformation() async {
await safeCall<BarInformation?>(
call: () async => await rootLogic.chickenRepository.getGeneralBarInformation(
token: rootLogic.tokenService.accessToken.value!,
queryParameters: buildQueryParams(role: 'Steward'),
),
onSuccess: (result) {
if (result != null) {
barInformation.value = result;
}
},
onError: (error, stackTrace) {},
);
}
Future<void> getTodayBars() async {
await safeCall<BarInformation?>(
call: () async => await rootLogic.chickenRepository.getGeneralBarInformation(
token: rootLogic.tokenService.accessToken.value!,
queryParameters: buildQueryParams(fromDate: DateTime.now(), toDate: DateTime.now()),
queryParameters: buildQueryParams(
fromDate: DateTime.now(),
toDate: DateTime.now(),
role: 'Steward',
),
),
onSuccess: (result) {
if (result != null) {
totalWeightTodayBars.value = result.totalBarsWeight?.toInt();
}
},
onError: (error, stackTrace) {
},
onError: (error, stackTrace) {},
);
}
@@ -52,7 +67,4 @@ class HomeLogic extends GetxController {
onError: (error, stackTrace) {},
);
}
}

View File

@@ -280,61 +280,44 @@ class HomePage extends GetView<HomeLogic> {
}
Widget _todayShipmentWidget() {
return ObxValue((data) {
return Container(
height: 70,
width: Get.width / 2,
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
clipBehavior: Clip.hardEdge,
child: Row(
children: [
Expanded(
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [const Color(0xFFEAEFFF), Colors.white],
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 4,
children: [
Assets.icons.cubeScan.svg(width: 30, height: 30),
Text(
'بارهای امروز',
textAlign: TextAlign.right,
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
],
),
return Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 13),
child: Row(
spacing: 8,
children: [
Expanded(
child: ObxValue(
(data) => _informationLabelCard(
title: 'بارهای امروز',
isLoading: data.value == null,
description: data.value?.separatedByComma ?? '0',
iconPath: Assets.vec.cubeSearchSvg.path,
iconColor: AppColor.blueNormal,
bgDescriptionColor: Colors.white,
bgLabelColor: Color(0xFFEAEFFF),
),
controller.totalWeightTodayBars,
),
Expanded(
child: data.value == null
? CupertinoActivityIndicator()
: Column(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 4,
children: [
Text(
data.value.separatedByComma,
textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: AppColor.textColor),
),
Text(
'کیلوگرم',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.textColor),
),
],
),
),
],
),
);
}, controller.totalWeightTodayBars);
),
Expanded(
child: ObxValue((data) {
return _informationLabelCard(
title: 'درانتظار تایید',
isLoading: data.value == null,
description: '(${data.value?.totalNotEnteredBars.separatedByComma ?? '0'})',
unit: '(${data.value?.totalNotEnteredKillHouseRequestsWeight.separatedByComma})کیلوگرم',
iconPath: Assets.vec.cubeRotateSvg.path,
iconColor: Color(0xFF8F4124),
bgLabelColor: Color(0xFFF59770),
bgDescriptionColor: Color(0xFFF6DFD8),
);
}, controller.barInformation),
),
],
),
);
}
Container _informationLabelCard({