feat: warehouse_and_distribution in killhouse module

This commit is contained in:
2025-12-01 15:25:19 +03:30
parent 6861e873ba
commit c42ee069e6
57 changed files with 11246 additions and 208 deletions

View File

@@ -0,0 +1,98 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/inventory/inventory_model.dart';
import 'package:rasadyar_core/core.dart';
class InventoryWidget extends StatelessWidget {
final InventoryModel? inventoryModel;
const InventoryWidget({super.key, required this.inventoryModel});
@override
Widget build(BuildContext context) {
return Container(
width: Get.width,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
padding: EdgeInsets.symmetric(horizontal: 8.w),
child: Row(
spacing: 8.w,
children: [
_itemList(
title: 'موجودی انبار',
value: inventoryModel?.totalRemainWeight?.separatedByCommaFa,
color: const Color(0xFFEAFBFC),
),
_itemList(
title: 'مانده دولتی',
value: inventoryModel
?.totalGovernmentalRemainWeight
?.separatedByCommaFa,
color: const Color(0xFFF5ECEE),
),
_itemList(
title: 'مانده آزاد',
value: inventoryModel?.totalFreeRemainWeight?.separatedByCommaFa,
color: const Color(0xFFF1E7FF),
),
],
),
),
);
}
Widget _itemList({
required String title,
required String? value,
String? unit,
Color? color,
}) {
return Container(
width: 125.w,
height: 50.h,
clipBehavior: Clip.antiAlias,
decoration: ShapeDecoration(
color: 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 || value.isEmpty
? const 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),
),
),
],
),
),
],
),
);
}
}

View File

@@ -1,80 +0,0 @@
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';
Widget inventoryWidget(StewardRootLogic rootLogic) {
return Container(
width: Get.width,
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 ?? '', // در صورت نال بودن، رشته خالی نمایش داده شود
color: const Color(0xFFEAFBFC),
);
}, rootLogic.inventoryModel),
ObxValue((data) {
final value = data.value?.totalGovernmentalRemainWeight?.separatedByCommaFa;
return _itemList(title: 'مانده دولتی', value: value ?? '',color: const Color(0xFFF5ECEE),);
}, rootLogic.stewardSalesInfoDashboard),
ObxValue((data) {
final value = data.value?.totalFreeRemainWeight?.separatedByCommaFa;
return _itemList(title: 'مانده آزاد', value: value ?? '',color: const Color(0xFFF1E7FF));
}, rootLogic.stewardSalesInfoDashboard),
],
),
),
);
}
Widget _itemList({required String title, required String? value, String? unit,Color? color}) {
return Container(
width: 125.w,
height: 50.h,
clipBehavior: Clip.antiAlias,
decoration: ShapeDecoration(
color: 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)),
),
],
),
),
],
),
);
}