refactor: update data source and repository structure by removing unused files, enhancing model integration, and adjusting import paths for better organization

This commit is contained in:
2025-12-07 12:33:39 +03:30
parent c28a4a3177
commit 02686115cb
129 changed files with 5269 additions and 545 deletions

View File

@@ -2,7 +2,7 @@ import 'dart:math';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/presentation/pages/common/auth/logic.dart';
import 'package:rasadyar_chicken/features/common/auth/logic.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';

View File

@@ -1,10 +1,57 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
import 'package:rasadyar_core/core.dart';
class InventoryItemData {
final String title;
final String? value;
final String? unit;
final Color? color;
const InventoryItemData({
required this.title,
required this.value,
this.unit,
this.color,
});
InventoryItemData copyWith({
String? title,
String? value,
String? unit,
Color? color,
}) {
return InventoryItemData(
title: title ?? this.title,
value: value ?? this.value,
unit: unit ?? this.unit,
color: color ?? this.color,
);
}
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
return other is InventoryItemData &&
other.title == title &&
other.value == value &&
other.unit == unit &&
other.color == color;
}
@override
int get hashCode {
return title.hashCode ^ value.hashCode ^ unit.hashCode ^ color.hashCode;
}
@override
String toString() {
return 'InventoryItemData(title: $title, value: $value, unit: $unit, color: $color)';
}
}
class InventoryWidget extends StatelessWidget {
final ProductModel? inventoryModel;
final List<InventoryItemData> inventoryModel;
const InventoryWidget({super.key, required this.inventoryModel});
@@ -17,54 +64,31 @@ class InventoryWidget extends StatelessWidget {
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),
),
],
children: inventoryModel.map((item) => _item(item)).toList(),
),
),
);
}
Widget _itemList({
required String title,
required String? value,
String? unit,
Color? color,
}) {
Widget _item(InventoryItemData item) {
return Container(
width: 125.w,
height: 50.h,
clipBehavior: Clip.antiAlias,
decoration: ShapeDecoration(
color: color ?? Colors.white.withValues(alpha: 0.40),
color: item.color ?? Colors.white.withValues(alpha: 0.40),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
child: Column(
children: [
SizedBox(height: 4),
Text(
title,
item.title,
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: const Color(0xFF5B5B5B)),
),
SizedBox(height: 4),
value == null || value.isEmpty
item.value == null || item.value!.isEmpty
? const Center(child: CupertinoActivityIndicator())
: Padding(
padding: EdgeInsets.symmetric(horizontal: 4.w),
@@ -73,14 +97,14 @@ class InventoryWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
value,
item.value!,
textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(
color: const Color(0xFF5B5B5B),
),
),
Text(
unit ?? 'کیلوگرم',
item.unit ?? 'کیلوگرم',
textAlign: TextAlign.center,
style: AppFonts.yekan10.copyWith(
color: const Color(0xFF5B5B5B),

View File

@@ -1,5 +1,5 @@
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
import 'package:rasadyar_chicken/features/steward/root/logic.dart';
import 'package:rasadyar_core/core.dart';
enum WidelyUsedType { edit, normal }