refactor : inspection

This commit is contained in:
2025-09-27 09:35:00 +03:30
parent a7c7442b49
commit d9a18c968b
14 changed files with 85 additions and 51 deletions

View File

@@ -96,7 +96,7 @@ abstract class Poultry with _$Poultry {
String? key,
String? fullname,
String? mobile,
String? city,
int? city,
String? unitName,
int? killingAveAge,
int? activeLeftOver,

View File

@@ -1619,7 +1619,7 @@ as String?,
/// @nodoc
mixin _$Poultry {
String? get key; String? get fullname; String? get mobile; String? get city; String? get unitName; int? get killingAveAge; int? get activeLeftOver; int? get killingAveCount; double? get realKillingAveWeight; double? get realKillingLiveWeight; double? get realKillingCarcassesWeight; double? get realKillingLossWeightPercent;
String? get key; String? get fullname; String? get mobile; int? get city; String? get unitName; int? get killingAveAge; int? get activeLeftOver; int? get killingAveCount; double? get realKillingAveWeight; double? get realKillingLiveWeight; double? get realKillingCarcassesWeight; double? get realKillingLossWeightPercent;
/// Create a copy of Poultry
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -1652,7 +1652,7 @@ abstract mixin class $PoultryCopyWith<$Res> {
factory $PoultryCopyWith(Poultry value, $Res Function(Poultry) _then) = _$PoultryCopyWithImpl;
@useResult
$Res call({
String? key, String? fullname, String? mobile, String? city, String? unitName, int? killingAveAge, int? activeLeftOver, int? killingAveCount, double? realKillingAveWeight, double? realKillingLiveWeight, double? realKillingCarcassesWeight, double? realKillingLossWeightPercent
String? key, String? fullname, String? mobile, int? city, String? unitName, int? killingAveAge, int? activeLeftOver, int? killingAveCount, double? realKillingAveWeight, double? realKillingLiveWeight, double? realKillingCarcassesWeight, double? realKillingLossWeightPercent
});
@@ -1675,7 +1675,7 @@ key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,fullname: freezed == fullname ? _self.fullname : fullname // ignore: cast_nullable_to_non_nullable
as String?,mobile: freezed == mobile ? _self.mobile : mobile // ignore: cast_nullable_to_non_nullable
as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
as String?,unitName: freezed == unitName ? _self.unitName : unitName // ignore: cast_nullable_to_non_nullable
as int?,unitName: freezed == unitName ? _self.unitName : unitName // ignore: cast_nullable_to_non_nullable
as String?,killingAveAge: freezed == killingAveAge ? _self.killingAveAge : killingAveAge // ignore: cast_nullable_to_non_nullable
as int?,activeLeftOver: freezed == activeLeftOver ? _self.activeLeftOver : activeLeftOver // ignore: cast_nullable_to_non_nullable
as int?,killingAveCount: freezed == killingAveCount ? _self.killingAveCount : killingAveCount // ignore: cast_nullable_to_non_nullable
@@ -1768,7 +1768,7 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? key, String? fullname, String? mobile, String? city, String? unitName, int? killingAveAge, int? activeLeftOver, int? killingAveCount, double? realKillingAveWeight, double? realKillingLiveWeight, double? realKillingCarcassesWeight, double? realKillingLossWeightPercent)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? key, String? fullname, String? mobile, int? city, String? unitName, int? killingAveAge, int? activeLeftOver, int? killingAveCount, double? realKillingAveWeight, double? realKillingLiveWeight, double? realKillingCarcassesWeight, double? realKillingLossWeightPercent)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _Poultry() when $default != null:
return $default(_that.key,_that.fullname,_that.mobile,_that.city,_that.unitName,_that.killingAveAge,_that.activeLeftOver,_that.killingAveCount,_that.realKillingAveWeight,_that.realKillingLiveWeight,_that.realKillingCarcassesWeight,_that.realKillingLossWeightPercent);case _:
@@ -1789,7 +1789,7 @@ return $default(_that.key,_that.fullname,_that.mobile,_that.city,_that.unitName,
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? key, String? fullname, String? mobile, String? city, String? unitName, int? killingAveAge, int? activeLeftOver, int? killingAveCount, double? realKillingAveWeight, double? realKillingLiveWeight, double? realKillingCarcassesWeight, double? realKillingLossWeightPercent) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? key, String? fullname, String? mobile, int? city, String? unitName, int? killingAveAge, int? activeLeftOver, int? killingAveCount, double? realKillingAveWeight, double? realKillingLiveWeight, double? realKillingCarcassesWeight, double? realKillingLossWeightPercent) $default,) {final _that = this;
switch (_that) {
case _Poultry():
return $default(_that.key,_that.fullname,_that.mobile,_that.city,_that.unitName,_that.killingAveAge,_that.activeLeftOver,_that.killingAveCount,_that.realKillingAveWeight,_that.realKillingLiveWeight,_that.realKillingCarcassesWeight,_that.realKillingLossWeightPercent);case _:
@@ -1809,7 +1809,7 @@ return $default(_that.key,_that.fullname,_that.mobile,_that.city,_that.unitName,
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? key, String? fullname, String? mobile, String? city, String? unitName, int? killingAveAge, int? activeLeftOver, int? killingAveCount, double? realKillingAveWeight, double? realKillingLiveWeight, double? realKillingCarcassesWeight, double? realKillingLossWeightPercent)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? key, String? fullname, String? mobile, int? city, String? unitName, int? killingAveAge, int? activeLeftOver, int? killingAveCount, double? realKillingAveWeight, double? realKillingLiveWeight, double? realKillingCarcassesWeight, double? realKillingLossWeightPercent)? $default,) {final _that = this;
switch (_that) {
case _Poultry() when $default != null:
return $default(_that.key,_that.fullname,_that.mobile,_that.city,_that.unitName,_that.killingAveAge,_that.activeLeftOver,_that.killingAveCount,_that.realKillingAveWeight,_that.realKillingLiveWeight,_that.realKillingCarcassesWeight,_that.realKillingLossWeightPercent);case _:
@@ -1830,7 +1830,7 @@ class _Poultry implements Poultry {
@override final String? key;
@override final String? fullname;
@override final String? mobile;
@override final String? city;
@override final int? city;
@override final String? unitName;
@override final int? killingAveAge;
@override final int? activeLeftOver;
@@ -1873,7 +1873,7 @@ abstract mixin class _$PoultryCopyWith<$Res> implements $PoultryCopyWith<$Res> {
factory _$PoultryCopyWith(_Poultry value, $Res Function(_Poultry) _then) = __$PoultryCopyWithImpl;
@override @useResult
$Res call({
String? key, String? fullname, String? mobile, String? city, String? unitName, int? killingAveAge, int? activeLeftOver, int? killingAveCount, double? realKillingAveWeight, double? realKillingLiveWeight, double? realKillingCarcassesWeight, double? realKillingLossWeightPercent
String? key, String? fullname, String? mobile, int? city, String? unitName, int? killingAveAge, int? activeLeftOver, int? killingAveCount, double? realKillingAveWeight, double? realKillingLiveWeight, double? realKillingCarcassesWeight, double? realKillingLossWeightPercent
});
@@ -1896,7 +1896,7 @@ key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,fullname: freezed == fullname ? _self.fullname : fullname // ignore: cast_nullable_to_non_nullable
as String?,mobile: freezed == mobile ? _self.mobile : mobile // ignore: cast_nullable_to_non_nullable
as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
as String?,unitName: freezed == unitName ? _self.unitName : unitName // ignore: cast_nullable_to_non_nullable
as int?,unitName: freezed == unitName ? _self.unitName : unitName // ignore: cast_nullable_to_non_nullable
as String?,killingAveAge: freezed == killingAveAge ? _self.killingAveAge : killingAveAge // ignore: cast_nullable_to_non_nullable
as int?,activeLeftOver: freezed == activeLeftOver ? _self.activeLeftOver : activeLeftOver // ignore: cast_nullable_to_non_nullable
as int?,killingAveCount: freezed == killingAveCount ? _self.killingAveCount : killingAveCount // ignore: cast_nullable_to_non_nullable

View File

@@ -158,7 +158,7 @@ _Poultry _$PoultryFromJson(Map<String, dynamic> json) => _Poultry(
key: json['key'] as String?,
fullname: json['fullname'] as String?,
mobile: json['mobile'] as String?,
city: json['city'] as String?,
city: (json['city'] as num?)?.toInt(),
unitName: json['unit_name'] as String?,
killingAveAge: (json['killing_ave_age'] as num?)?.toInt(),
activeLeftOver: (json['active_left_over'] as num?)?.toInt(),

View File

@@ -2,9 +2,11 @@ import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/hatching/hatching_models.dart';
import 'package:rasadyar_chicken/data/models/response/hatching_report/hatching_report.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/logic.dart';
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
import 'package:rasadyar_core/core.dart';
class InspectionPoultryScienceLogic extends GetxController {
BaseLogic baseLogic = Get.find<BaseLogic>();
Rx<Resource<PaginationModel<HatchingModel>>> hatchingList =
Resource<PaginationModel<HatchingModel>>.loading().obs;
@@ -41,6 +43,8 @@ class InspectionPoultryScienceLogic extends GetxController {
routesName.removeLast();
routesName.add(callback == 0 ? 'بازرسی' : 'بایگانی');
});
}
@override
@@ -63,7 +67,9 @@ class InspectionPoultryScienceLogic extends GetxController {
@override
void onClose() {
// TODO: implement onClose
baseLogic.isSearchSelected.value=false;
baseLogic.textEditingController.clear();
baseLogic.searchValue.value=null;
super.onClose();
}
@@ -247,8 +253,9 @@ class InspectionPoultryScienceLogic extends GetxController {
}
void setSearchValue(String? data) {
dLog('Search Value: $data');
searchedValue.value = data?.trim();
final isReporter = selectedSegmentIndex.value == 0;
final isReporter = selectedSegmentIndex.value == 1;
if (isReporter) {
getHatchingReport();
} else {
@@ -256,3 +263,4 @@ class InspectionPoultryScienceLogic extends GetxController {
}
}
}

View File

@@ -18,12 +18,12 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
hasBack: true,
hasFilter: true,
hasSearch: true,
filteringWidget: filterBottomSheet(),
onFilterTap: () {
Get.bottomSheet(filterBottomSheet());
},
onSearchChanged: (data) => controller.setSearchValue(data),
backId: poultryFirstKey,
routes: controller.routesName,
//routesWidget: ObxValue((route) => buildContainerPageRoute(route), controller.routesName),
widgets: [
SizedBox(height: 50, child: segmentWidget()),
ObxValue((data) {

View File

@@ -24,6 +24,7 @@ RAppBar chickenAppBar({
isBase: isBase,
backId: backId,
hasFilter: hasFilter,
onFilterTap: onFilterTap,
onSearchTap: onSearchTap,
onBackTap: onBackTap,
onNotificationTap: onNotificationTap,

View File

@@ -84,6 +84,7 @@ class ChickenBasePage extends GetView<BaseLogic> {
widgets: widgets,
child: child,
scrollable: scrollable,
onSearchChanged: onSearchChanged,
floatingActionButtonLocation: floatingActionButtonLocation,
floatingActionButton: floatingActionButton,
backGroundWidget: backGroundWidget ?? chickenBackground(),
@@ -100,8 +101,8 @@ class ChickenBasePage extends GetView<BaseLogic> {
onBackTap: onBackTap,
hasNotification: hasNotification,
onNotificationTap: onNotificationTap,
onFilterTap: hasFilter ? _onFilterTap : null,
//onSearchTap: widget.hasSearch ? controller.toggleSearch : null,
onFilterTap: onFilterTap ?? _onFilterTap,
onSearchTap: hasSearch ? controller.toggleSearch : null,
),
);
}