feat : new dashboard and inventory_widget

This commit is contained in:
2025-10-08 17:01:33 +03:30
parent 665ef9abf7
commit be6e16f54e
28 changed files with 1020 additions and 126 deletions

View File

@@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
import 'package:rasadyar_core/core.dart';
@@ -5,19 +6,74 @@ import 'package:rasadyar_core/core.dart';
Widget inventoryWidget(StewardRootLogic 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),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
padding: EdgeInsets.symmetric(horizontal: 8.w),
child: Row(
spacing: 8.w,
children: [
ObxValue((data) {
// بررسی مقدار null بودن و نشان دادن ActivityIndicator
final value = data.value?.totalRemainWeight?.separatedByCommaFa;
return _itemList(
title: 'موجودی انبار',
value: value ?? '', // در صورت نال بودن، رشته خالی نمایش داده شود
);
}, rootLogic.inventoryModel),
ObxValue((data) {
final value = data.value?.totalGovernmentalRemainWeight?.separatedByCommaFa;
return _itemList(title: 'مانده دولتی', value: value ?? '');
}, rootLogic.stewardSalesInfoDashboard),
ObxValue((data) {
final value = data.value?.totalFreeRemainWeight?.separatedByCommaFa;
return _itemList(title: 'مانده آزاد', value: value ?? '');
}, rootLogic.stewardSalesInfoDashboard),
],
),
),
);
}
Widget _itemList({required String title, required String? value, String? unit}) {
return Container(
width: 125.w,
height: 50.h,
clipBehavior: Clip.antiAlias,
decoration: ShapeDecoration(
color: Colors.white.withValues(alpha: 0.40),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
child: Column(
children: [
SizedBox(height: 4),
Text(
title,
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: const Color(0xFF5B5B5B)),
),
SizedBox(height: 4),
value == null
? Center(child: CupertinoActivityIndicator())
: Padding(
padding: EdgeInsets.symmetric(horizontal: 4.w),
child: Row(
spacing: 8,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
value!,
textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: const Color(0xFF5B5B5B)),
),
Text(
unit ?? 'کیلوگرم',
textAlign: TextAlign.center,
style: AppFonts.yekan10.copyWith(color: const Color(0xFF5B5B5B)),
),
],
),
),
],
),
alignment: Alignment.center,
child: ObxValue((data) {
return Text(
' موجودی انبار: ${data.value?.totalRemainWeight?.toInt().separatedByCommaFa ?? '0'} کیلوگرم',
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkHover),
);
}, rootLogic.inventoryModel),
);
}