diff --git a/android/local.properties b/android/local.properties index 8e5f928..e0cd233 100644 --- a/android/local.properties +++ b/android/local.properties @@ -1,5 +1,5 @@ sdk.dir=C:/Users/Housh11/AppData/Local/Android/Sdk flutter.sdk=C:\\src\\flutter -flutter.buildMode=release +flutter.buildMode=debug flutter.versionName=1.3.18 flutter.versionCode=15 \ No newline at end of file diff --git a/assets/images/pattern_chicken.webp b/assets/images/pattern_chicken.webp new file mode 100644 index 0000000..d6f8257 Binary files /dev/null and b/assets/images/pattern_chicken.webp differ diff --git a/packages/chicken/lib/data/models/request/submit_steward_allocation/submit_steward_allocation.dart b/packages/chicken/lib/data/models/request/submit_steward_allocation/submit_steward_allocation.dart index 8833933..064005e 100644 --- a/packages/chicken/lib/data/models/request/submit_steward_allocation/submit_steward_allocation.dart +++ b/packages/chicken/lib/data/models/request/submit_steward_allocation/submit_steward_allocation.dart @@ -16,6 +16,7 @@ abstract class SubmitStewardAllocation with _$SubmitStewardAllocation { int? weightOfCarcasses, String? sellType, int? amount, + String? quota, int? totalAmount, bool? approvedPriceStatus, String? date, diff --git a/packages/chicken/lib/data/models/request/submit_steward_allocation/submit_steward_allocation.freezed.dart b/packages/chicken/lib/data/models/request/submit_steward_allocation/submit_steward_allocation.freezed.dart index 0ff2933..12ceed4 100644 --- a/packages/chicken/lib/data/models/request/submit_steward_allocation/submit_steward_allocation.freezed.dart +++ b/packages/chicken/lib/data/models/request/submit_steward_allocation/submit_steward_allocation.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$SubmitStewardAllocation { - String? get sellerType; String? get buyerType; String? get guildKey; String? get productKey; String? get type; String? get allocationType; int? get numberOfCarcasses; int? get weightOfCarcasses; String? get sellType; int? get amount; int? get totalAmount; bool? get approvedPriceStatus; String? get date; + String? get sellerType; String? get buyerType; String? get guildKey; String? get productKey; String? get type; String? get allocationType; int? get numberOfCarcasses; int? get weightOfCarcasses; String? get sellType; int? get amount; String? get quota; int? get totalAmount; bool? get approvedPriceStatus; String? get date; /// Create a copy of SubmitStewardAllocation /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -28,16 +28,16 @@ $SubmitStewardAllocationCopyWith get copyWith => _$Subm @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is SubmitStewardAllocation&&(identical(other.sellerType, sellerType) || other.sellerType == sellerType)&&(identical(other.buyerType, buyerType) || other.buyerType == buyerType)&&(identical(other.guildKey, guildKey) || other.guildKey == guildKey)&&(identical(other.productKey, productKey) || other.productKey == productKey)&&(identical(other.type, type) || other.type == type)&&(identical(other.allocationType, allocationType) || other.allocationType == allocationType)&&(identical(other.numberOfCarcasses, numberOfCarcasses) || other.numberOfCarcasses == numberOfCarcasses)&&(identical(other.weightOfCarcasses, weightOfCarcasses) || other.weightOfCarcasses == weightOfCarcasses)&&(identical(other.sellType, sellType) || other.sellType == sellType)&&(identical(other.amount, amount) || other.amount == amount)&&(identical(other.totalAmount, totalAmount) || other.totalAmount == totalAmount)&&(identical(other.approvedPriceStatus, approvedPriceStatus) || other.approvedPriceStatus == approvedPriceStatus)&&(identical(other.date, date) || other.date == date)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is SubmitStewardAllocation&&(identical(other.sellerType, sellerType) || other.sellerType == sellerType)&&(identical(other.buyerType, buyerType) || other.buyerType == buyerType)&&(identical(other.guildKey, guildKey) || other.guildKey == guildKey)&&(identical(other.productKey, productKey) || other.productKey == productKey)&&(identical(other.type, type) || other.type == type)&&(identical(other.allocationType, allocationType) || other.allocationType == allocationType)&&(identical(other.numberOfCarcasses, numberOfCarcasses) || other.numberOfCarcasses == numberOfCarcasses)&&(identical(other.weightOfCarcasses, weightOfCarcasses) || other.weightOfCarcasses == weightOfCarcasses)&&(identical(other.sellType, sellType) || other.sellType == sellType)&&(identical(other.amount, amount) || other.amount == amount)&&(identical(other.quota, quota) || other.quota == quota)&&(identical(other.totalAmount, totalAmount) || other.totalAmount == totalAmount)&&(identical(other.approvedPriceStatus, approvedPriceStatus) || other.approvedPriceStatus == approvedPriceStatus)&&(identical(other.date, date) || other.date == date)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,sellerType,buyerType,guildKey,productKey,type,allocationType,numberOfCarcasses,weightOfCarcasses,sellType,amount,totalAmount,approvedPriceStatus,date); +int get hashCode => Object.hash(runtimeType,sellerType,buyerType,guildKey,productKey,type,allocationType,numberOfCarcasses,weightOfCarcasses,sellType,amount,quota,totalAmount,approvedPriceStatus,date); @override String toString() { - return 'SubmitStewardAllocation(sellerType: $sellerType, buyerType: $buyerType, guildKey: $guildKey, productKey: $productKey, type: $type, allocationType: $allocationType, numberOfCarcasses: $numberOfCarcasses, weightOfCarcasses: $weightOfCarcasses, sellType: $sellType, amount: $amount, totalAmount: $totalAmount, approvedPriceStatus: $approvedPriceStatus, date: $date)'; + return 'SubmitStewardAllocation(sellerType: $sellerType, buyerType: $buyerType, guildKey: $guildKey, productKey: $productKey, type: $type, allocationType: $allocationType, numberOfCarcasses: $numberOfCarcasses, weightOfCarcasses: $weightOfCarcasses, sellType: $sellType, amount: $amount, quota: $quota, totalAmount: $totalAmount, approvedPriceStatus: $approvedPriceStatus, date: $date)'; } @@ -48,7 +48,7 @@ abstract mixin class $SubmitStewardAllocationCopyWith<$Res> { factory $SubmitStewardAllocationCopyWith(SubmitStewardAllocation value, $Res Function(SubmitStewardAllocation) _then) = _$SubmitStewardAllocationCopyWithImpl; @useResult $Res call({ - String? sellerType, String? buyerType, String? guildKey, String? productKey, String? type, String? allocationType, int? numberOfCarcasses, int? weightOfCarcasses, String? sellType, int? amount, int? totalAmount, bool? approvedPriceStatus, String? date + String? sellerType, String? buyerType, String? guildKey, String? productKey, String? type, String? allocationType, int? numberOfCarcasses, int? weightOfCarcasses, String? sellType, int? amount, String? quota, int? totalAmount, bool? approvedPriceStatus, String? date }); @@ -65,7 +65,7 @@ class _$SubmitStewardAllocationCopyWithImpl<$Res> /// Create a copy of SubmitStewardAllocation /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? sellerType = freezed,Object? buyerType = freezed,Object? guildKey = freezed,Object? productKey = freezed,Object? type = freezed,Object? allocationType = freezed,Object? numberOfCarcasses = freezed,Object? weightOfCarcasses = freezed,Object? sellType = freezed,Object? amount = freezed,Object? totalAmount = freezed,Object? approvedPriceStatus = freezed,Object? date = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? sellerType = freezed,Object? buyerType = freezed,Object? guildKey = freezed,Object? productKey = freezed,Object? type = freezed,Object? allocationType = freezed,Object? numberOfCarcasses = freezed,Object? weightOfCarcasses = freezed,Object? sellType = freezed,Object? amount = freezed,Object? quota = freezed,Object? totalAmount = freezed,Object? approvedPriceStatus = freezed,Object? date = freezed,}) { return _then(_self.copyWith( sellerType: freezed == sellerType ? _self.sellerType : sellerType // ignore: cast_nullable_to_non_nullable as String?,buyerType: freezed == buyerType ? _self.buyerType : buyerType // ignore: cast_nullable_to_non_nullable @@ -77,7 +77,8 @@ as String?,numberOfCarcasses: freezed == numberOfCarcasses ? _self.numberOfCarca as int?,weightOfCarcasses: freezed == weightOfCarcasses ? _self.weightOfCarcasses : weightOfCarcasses // ignore: cast_nullable_to_non_nullable as int?,sellType: freezed == sellType ? _self.sellType : sellType // ignore: cast_nullable_to_non_nullable as String?,amount: freezed == amount ? _self.amount : amount // ignore: cast_nullable_to_non_nullable -as int?,totalAmount: freezed == totalAmount ? _self.totalAmount : totalAmount // ignore: cast_nullable_to_non_nullable +as int?,quota: freezed == quota ? _self.quota : quota // ignore: cast_nullable_to_non_nullable +as String?,totalAmount: freezed == totalAmount ? _self.totalAmount : totalAmount // ignore: cast_nullable_to_non_nullable as int?,approvedPriceStatus: freezed == approvedPriceStatus ? _self.approvedPriceStatus : approvedPriceStatus // ignore: cast_nullable_to_non_nullable as bool?,date: freezed == date ? _self.date : date // ignore: cast_nullable_to_non_nullable as String?, @@ -165,10 +166,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String? sellerType, String? buyerType, String? guildKey, String? productKey, String? type, String? allocationType, int? numberOfCarcasses, int? weightOfCarcasses, String? sellType, int? amount, int? totalAmount, bool? approvedPriceStatus, String? date)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String? sellerType, String? buyerType, String? guildKey, String? productKey, String? type, String? allocationType, int? numberOfCarcasses, int? weightOfCarcasses, String? sellType, int? amount, String? quota, int? totalAmount, bool? approvedPriceStatus, String? date)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _SubmitStewardAllocation() when $default != null: -return $default(_that.sellerType,_that.buyerType,_that.guildKey,_that.productKey,_that.type,_that.allocationType,_that.numberOfCarcasses,_that.weightOfCarcasses,_that.sellType,_that.amount,_that.totalAmount,_that.approvedPriceStatus,_that.date);case _: +return $default(_that.sellerType,_that.buyerType,_that.guildKey,_that.productKey,_that.type,_that.allocationType,_that.numberOfCarcasses,_that.weightOfCarcasses,_that.sellType,_that.amount,_that.quota,_that.totalAmount,_that.approvedPriceStatus,_that.date);case _: return orElse(); } @@ -186,10 +187,10 @@ return $default(_that.sellerType,_that.buyerType,_that.guildKey,_that.productKey /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String? sellerType, String? buyerType, String? guildKey, String? productKey, String? type, String? allocationType, int? numberOfCarcasses, int? weightOfCarcasses, String? sellType, int? amount, int? totalAmount, bool? approvedPriceStatus, String? date) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String? sellerType, String? buyerType, String? guildKey, String? productKey, String? type, String? allocationType, int? numberOfCarcasses, int? weightOfCarcasses, String? sellType, int? amount, String? quota, int? totalAmount, bool? approvedPriceStatus, String? date) $default,) {final _that = this; switch (_that) { case _SubmitStewardAllocation(): -return $default(_that.sellerType,_that.buyerType,_that.guildKey,_that.productKey,_that.type,_that.allocationType,_that.numberOfCarcasses,_that.weightOfCarcasses,_that.sellType,_that.amount,_that.totalAmount,_that.approvedPriceStatus,_that.date);case _: +return $default(_that.sellerType,_that.buyerType,_that.guildKey,_that.productKey,_that.type,_that.allocationType,_that.numberOfCarcasses,_that.weightOfCarcasses,_that.sellType,_that.amount,_that.quota,_that.totalAmount,_that.approvedPriceStatus,_that.date);case _: throw StateError('Unexpected subclass'); } @@ -206,10 +207,10 @@ return $default(_that.sellerType,_that.buyerType,_that.guildKey,_that.productKey /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String? sellerType, String? buyerType, String? guildKey, String? productKey, String? type, String? allocationType, int? numberOfCarcasses, int? weightOfCarcasses, String? sellType, int? amount, int? totalAmount, bool? approvedPriceStatus, String? date)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String? sellerType, String? buyerType, String? guildKey, String? productKey, String? type, String? allocationType, int? numberOfCarcasses, int? weightOfCarcasses, String? sellType, int? amount, String? quota, int? totalAmount, bool? approvedPriceStatus, String? date)? $default,) {final _that = this; switch (_that) { case _SubmitStewardAllocation() when $default != null: -return $default(_that.sellerType,_that.buyerType,_that.guildKey,_that.productKey,_that.type,_that.allocationType,_that.numberOfCarcasses,_that.weightOfCarcasses,_that.sellType,_that.amount,_that.totalAmount,_that.approvedPriceStatus,_that.date);case _: +return $default(_that.sellerType,_that.buyerType,_that.guildKey,_that.productKey,_that.type,_that.allocationType,_that.numberOfCarcasses,_that.weightOfCarcasses,_that.sellType,_that.amount,_that.quota,_that.totalAmount,_that.approvedPriceStatus,_that.date);case _: return null; } @@ -221,7 +222,7 @@ return $default(_that.sellerType,_that.buyerType,_that.guildKey,_that.productKey @JsonSerializable() class _SubmitStewardAllocation implements SubmitStewardAllocation { - const _SubmitStewardAllocation({this.sellerType, this.buyerType, this.guildKey, this.productKey, this.type, this.allocationType, this.numberOfCarcasses, this.weightOfCarcasses, this.sellType, this.amount, this.totalAmount, this.approvedPriceStatus, this.date}); + const _SubmitStewardAllocation({this.sellerType, this.buyerType, this.guildKey, this.productKey, this.type, this.allocationType, this.numberOfCarcasses, this.weightOfCarcasses, this.sellType, this.amount, this.quota, this.totalAmount, this.approvedPriceStatus, this.date}); factory _SubmitStewardAllocation.fromJson(Map json) => _$SubmitStewardAllocationFromJson(json); @override final String? sellerType; @@ -234,6 +235,7 @@ class _SubmitStewardAllocation implements SubmitStewardAllocation { @override final int? weightOfCarcasses; @override final String? sellType; @override final int? amount; +@override final String? quota; @override final int? totalAmount; @override final bool? approvedPriceStatus; @override final String? date; @@ -251,16 +253,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _SubmitStewardAllocation&&(identical(other.sellerType, sellerType) || other.sellerType == sellerType)&&(identical(other.buyerType, buyerType) || other.buyerType == buyerType)&&(identical(other.guildKey, guildKey) || other.guildKey == guildKey)&&(identical(other.productKey, productKey) || other.productKey == productKey)&&(identical(other.type, type) || other.type == type)&&(identical(other.allocationType, allocationType) || other.allocationType == allocationType)&&(identical(other.numberOfCarcasses, numberOfCarcasses) || other.numberOfCarcasses == numberOfCarcasses)&&(identical(other.weightOfCarcasses, weightOfCarcasses) || other.weightOfCarcasses == weightOfCarcasses)&&(identical(other.sellType, sellType) || other.sellType == sellType)&&(identical(other.amount, amount) || other.amount == amount)&&(identical(other.totalAmount, totalAmount) || other.totalAmount == totalAmount)&&(identical(other.approvedPriceStatus, approvedPriceStatus) || other.approvedPriceStatus == approvedPriceStatus)&&(identical(other.date, date) || other.date == date)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SubmitStewardAllocation&&(identical(other.sellerType, sellerType) || other.sellerType == sellerType)&&(identical(other.buyerType, buyerType) || other.buyerType == buyerType)&&(identical(other.guildKey, guildKey) || other.guildKey == guildKey)&&(identical(other.productKey, productKey) || other.productKey == productKey)&&(identical(other.type, type) || other.type == type)&&(identical(other.allocationType, allocationType) || other.allocationType == allocationType)&&(identical(other.numberOfCarcasses, numberOfCarcasses) || other.numberOfCarcasses == numberOfCarcasses)&&(identical(other.weightOfCarcasses, weightOfCarcasses) || other.weightOfCarcasses == weightOfCarcasses)&&(identical(other.sellType, sellType) || other.sellType == sellType)&&(identical(other.amount, amount) || other.amount == amount)&&(identical(other.quota, quota) || other.quota == quota)&&(identical(other.totalAmount, totalAmount) || other.totalAmount == totalAmount)&&(identical(other.approvedPriceStatus, approvedPriceStatus) || other.approvedPriceStatus == approvedPriceStatus)&&(identical(other.date, date) || other.date == date)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,sellerType,buyerType,guildKey,productKey,type,allocationType,numberOfCarcasses,weightOfCarcasses,sellType,amount,totalAmount,approvedPriceStatus,date); +int get hashCode => Object.hash(runtimeType,sellerType,buyerType,guildKey,productKey,type,allocationType,numberOfCarcasses,weightOfCarcasses,sellType,amount,quota,totalAmount,approvedPriceStatus,date); @override String toString() { - return 'SubmitStewardAllocation(sellerType: $sellerType, buyerType: $buyerType, guildKey: $guildKey, productKey: $productKey, type: $type, allocationType: $allocationType, numberOfCarcasses: $numberOfCarcasses, weightOfCarcasses: $weightOfCarcasses, sellType: $sellType, amount: $amount, totalAmount: $totalAmount, approvedPriceStatus: $approvedPriceStatus, date: $date)'; + return 'SubmitStewardAllocation(sellerType: $sellerType, buyerType: $buyerType, guildKey: $guildKey, productKey: $productKey, type: $type, allocationType: $allocationType, numberOfCarcasses: $numberOfCarcasses, weightOfCarcasses: $weightOfCarcasses, sellType: $sellType, amount: $amount, quota: $quota, totalAmount: $totalAmount, approvedPriceStatus: $approvedPriceStatus, date: $date)'; } @@ -271,7 +273,7 @@ abstract mixin class _$SubmitStewardAllocationCopyWith<$Res> implements $SubmitS factory _$SubmitStewardAllocationCopyWith(_SubmitStewardAllocation value, $Res Function(_SubmitStewardAllocation) _then) = __$SubmitStewardAllocationCopyWithImpl; @override @useResult $Res call({ - String? sellerType, String? buyerType, String? guildKey, String? productKey, String? type, String? allocationType, int? numberOfCarcasses, int? weightOfCarcasses, String? sellType, int? amount, int? totalAmount, bool? approvedPriceStatus, String? date + String? sellerType, String? buyerType, String? guildKey, String? productKey, String? type, String? allocationType, int? numberOfCarcasses, int? weightOfCarcasses, String? sellType, int? amount, String? quota, int? totalAmount, bool? approvedPriceStatus, String? date }); @@ -288,7 +290,7 @@ class __$SubmitStewardAllocationCopyWithImpl<$Res> /// Create a copy of SubmitStewardAllocation /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? sellerType = freezed,Object? buyerType = freezed,Object? guildKey = freezed,Object? productKey = freezed,Object? type = freezed,Object? allocationType = freezed,Object? numberOfCarcasses = freezed,Object? weightOfCarcasses = freezed,Object? sellType = freezed,Object? amount = freezed,Object? totalAmount = freezed,Object? approvedPriceStatus = freezed,Object? date = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? sellerType = freezed,Object? buyerType = freezed,Object? guildKey = freezed,Object? productKey = freezed,Object? type = freezed,Object? allocationType = freezed,Object? numberOfCarcasses = freezed,Object? weightOfCarcasses = freezed,Object? sellType = freezed,Object? amount = freezed,Object? quota = freezed,Object? totalAmount = freezed,Object? approvedPriceStatus = freezed,Object? date = freezed,}) { return _then(_SubmitStewardAllocation( sellerType: freezed == sellerType ? _self.sellerType : sellerType // ignore: cast_nullable_to_non_nullable as String?,buyerType: freezed == buyerType ? _self.buyerType : buyerType // ignore: cast_nullable_to_non_nullable @@ -300,7 +302,8 @@ as String?,numberOfCarcasses: freezed == numberOfCarcasses ? _self.numberOfCarca as int?,weightOfCarcasses: freezed == weightOfCarcasses ? _self.weightOfCarcasses : weightOfCarcasses // ignore: cast_nullable_to_non_nullable as int?,sellType: freezed == sellType ? _self.sellType : sellType // ignore: cast_nullable_to_non_nullable as String?,amount: freezed == amount ? _self.amount : amount // ignore: cast_nullable_to_non_nullable -as int?,totalAmount: freezed == totalAmount ? _self.totalAmount : totalAmount // ignore: cast_nullable_to_non_nullable +as int?,quota: freezed == quota ? _self.quota : quota // ignore: cast_nullable_to_non_nullable +as String?,totalAmount: freezed == totalAmount ? _self.totalAmount : totalAmount // ignore: cast_nullable_to_non_nullable as int?,approvedPriceStatus: freezed == approvedPriceStatus ? _self.approvedPriceStatus : approvedPriceStatus // ignore: cast_nullable_to_non_nullable as bool?,date: freezed == date ? _self.date : date // ignore: cast_nullable_to_non_nullable as String?, diff --git a/packages/chicken/lib/data/models/request/submit_steward_allocation/submit_steward_allocation.g.dart b/packages/chicken/lib/data/models/request/submit_steward_allocation/submit_steward_allocation.g.dart index 8b4b2e4..f7faa42 100644 --- a/packages/chicken/lib/data/models/request/submit_steward_allocation/submit_steward_allocation.g.dart +++ b/packages/chicken/lib/data/models/request/submit_steward_allocation/submit_steward_allocation.g.dart @@ -19,6 +19,7 @@ _SubmitStewardAllocation _$SubmitStewardAllocationFromJson( weightOfCarcasses: (json['weight_of_carcasses'] as num?)?.toInt(), sellType: json['sell_type'] as String?, amount: (json['amount'] as num?)?.toInt(), + quota: json['quota'] as String?, totalAmount: (json['total_amount'] as num?)?.toInt(), approvedPriceStatus: json['approved_price_status'] as bool?, date: json['date'] as String?, @@ -37,6 +38,7 @@ Map _$SubmitStewardAllocationToJson( 'weight_of_carcasses': instance.weightOfCarcasses, 'sell_type': instance.sellType, 'amount': instance.amount, + 'quota': instance.quota, 'total_amount': instance.totalAmount, 'approved_price_status': instance.approvedPriceStatus, 'date': instance.date, diff --git a/packages/chicken/lib/presentation/pages/common/auth/view.dart b/packages/chicken/lib/presentation/pages/common/auth/view.dart index ac4361f..cb43da8 100644 --- a/packages/chicken/lib/presentation/pages/common/auth/view.dart +++ b/packages/chicken/lib/presentation/pages/common/auth/view.dart @@ -13,7 +13,7 @@ class AuthPage extends GetView { Widget build(BuildContext context) { return ChickenBasePage( isFullScreen: true, - backGroundWidget: BackGroundWidget( + backGroundWidget: backGroundDecoration( gradient: LinearGradient( begin: Alignment.topRight, end: Alignment.bottomLeft, @@ -24,7 +24,7 @@ class AuthPage extends GetView { ], stops: const [0.0, 0.5, 1.0], ), - vecPath: Assets.vec.chickenPatternSvg.path, + backgroundPath: Assets.images.patternChicken.path, ), onPopScopTaped: () => Get.back(result: -1), child: Stack( diff --git a/packages/chicken/lib/presentation/pages/poultry_science/active_hatching/logic.dart b/packages/chicken/lib/presentation/pages/poultry_science/active_hatching/logic.dart index 78a3a2a..9360f4a 100644 --- a/packages/chicken/lib/presentation/pages/poultry_science/active_hatching/logic.dart +++ b/packages/chicken/lib/presentation/pages/poultry_science/active_hatching/logic.dart @@ -73,4 +73,11 @@ class ActiveHatchingLogic extends GetxController { void toggleExpanded(int index) { expandedIndex.value = expandedIndex.value == index ? -1 : index; } + + Future onRefresh() async { + currentPage.value = 1; + await getHatchingList(); + } + + } diff --git a/packages/chicken/lib/presentation/pages/poultry_science/active_hatching/view.dart b/packages/chicken/lib/presentation/pages/poultry_science/active_hatching/view.dart index 288efd4..6dfc282 100644 --- a/packages/chicken/lib/presentation/pages/poultry_science/active_hatching/view.dart +++ b/packages/chicken/lib/presentation/pages/poultry_science/active_hatching/view.dart @@ -50,10 +50,7 @@ class ActiveHatchingPage extends GetView { itemCount: data.value.data?.results?.length ?? 0, separatorBuilder: (context, index) => SizedBox(height: 8.h), onLoadMore: () async => controller.getHatchingList(true), - onRefresh: () async { - controller.currentPage.value = 1; - await controller.getHatchingList(); - }, + ); }, controller.activeHatchingList); } diff --git a/packages/chicken/lib/presentation/pages/poultry_science/farm/logic.dart b/packages/chicken/lib/presentation/pages/poultry_science/farm/logic.dart index 380ba5d..461b297 100644 --- a/packages/chicken/lib/presentation/pages/poultry_science/farm/logic.dart +++ b/packages/chicken/lib/presentation/pages/poultry_science/farm/logic.dart @@ -107,4 +107,10 @@ class FarmLogic extends GetxController { void toggleExpanded(int index) { expandedIndex.value = expandedIndex.value == index ? -1 : index; } + + Future onRefresh() async { + currentPage.value = 1; + farmList.value = Resource>.loading(); + await getFarmList(); + } } diff --git a/packages/chicken/lib/presentation/pages/poultry_science/farm/view.dart b/packages/chicken/lib/presentation/pages/poultry_science/farm/view.dart index 05b5660..8292434 100644 --- a/packages/chicken/lib/presentation/pages/poultry_science/farm/view.dart +++ b/packages/chicken/lib/presentation/pages/poultry_science/farm/view.dart @@ -3,7 +3,6 @@ import 'package:rasadyar_chicken/data/models/response/poultry_farm/poultry_farm. import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart'; import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart'; import 'package:rasadyar_chicken/presentation/widget/filter_bottom_sheet.dart'; -import 'package:rasadyar_chicken/presentation/widget/label_item.dart'; import 'package:rasadyar_core/core.dart'; import 'logic.dart'; @@ -16,6 +15,7 @@ class FarmPage extends GetView { return ChickenBasePage( hasFilter: false, hasSearch: true, + onRefresh: controller.onRefresh, onFilterTap: () { Get.bottomSheet( isScrollControlled: true, @@ -29,7 +29,7 @@ class FarmPage extends GetView { }, routes: controller.routes, backId: poultryFirstKey, - widgets: [firstTagInformation(), farmListWidget()], + child: Column(children: [firstTagInformation(), farmListWidget()]), ); } @@ -76,10 +76,7 @@ class FarmPage extends GetView { itemCount: data.value.data?.results?.length ?? 0, separatorBuilder: (context, index) => SizedBox(height: 8.h), onLoadMore: () async => controller.getFarmList(true), - onRefresh: () async { - controller.currentPage.value = 1; - await controller.getFarmList(); - }, + ); }, controller.farmList), ); @@ -153,7 +150,7 @@ class FarmPage extends GetView { buildRow( title: 'جوجه ریزی فعال (تعداد دوره) ', value: - '${(item.hatchingInfo?.activeHatching ?? false) ? 'دارد' : 'ندارد'} (${item.hatchingInfo?.period ?? 0})', + '${(item.hatchingInfo?.activeHatching ?? false) ? 'دارد' : 'ندارد'} (${item.hatchingInfo?.period ?? 0})', ), /* buildRow( diff --git a/packages/chicken/lib/presentation/pages/poultry_science/genocide/logic.dart b/packages/chicken/lib/presentation/pages/poultry_science/genocide/logic.dart index 2f26a81..c266812 100644 --- a/packages/chicken/lib/presentation/pages/poultry_science/genocide/logic.dart +++ b/packages/chicken/lib/presentation/pages/poultry_science/genocide/logic.dart @@ -133,4 +133,11 @@ class GenocideLogic extends GetxController { return 'تایید شده'; } } + + + Future onRefresh() async { + currentPage.value = 1; + await getPoultryOrderList(); + + } } diff --git a/packages/chicken/lib/presentation/pages/poultry_science/genocide/view.dart b/packages/chicken/lib/presentation/pages/poultry_science/genocide/view.dart index 71a7113..8efc68a 100644 --- a/packages/chicken/lib/presentation/pages/poultry_science/genocide/view.dart +++ b/packages/chicken/lib/presentation/pages/poultry_science/genocide/view.dart @@ -17,6 +17,7 @@ class GenocidePage extends GetView { routes: controller.routesName, hasSearch: true, hasFilter: true, + onRefresh: controller.onRefresh, onSearchChanged: (data) { controller.searchedValue.value = data; controller.getPoultryOrderList(); @@ -79,10 +80,7 @@ class GenocidePage extends GetView { itemCount: data.value.data?.results?.length ?? 0, separatorBuilder: (context, index) => SizedBox(height: 8.h), onLoadMore: () async => controller.getPoultryOrderList(true), - onRefresh: () async { - controller.currentPage.value = 1; - await controller.getPoultryOrderList(); - }, + ); }, controller.poultryOrderList); } diff --git a/packages/chicken/lib/presentation/pages/poultry_science/home/view.dart b/packages/chicken/lib/presentation/pages/poultry_science/home/view.dart index 7e65885..25576fc 100644 --- a/packages/chicken/lib/presentation/pages/poultry_science/home/view.dart +++ b/packages/chicken/lib/presentation/pages/poultry_science/home/view.dart @@ -19,65 +19,67 @@ class PoultryScienceHomePage extends GetView { hasNews: true, scrollable: true, - widgets: [ - SizedBox(height: 8.h), - InkWell( - onTap: () { - controller.isExpanded.value = !controller.isExpanded.value; - }, - child: Stack( - clipBehavior: Clip.none, - children: [ - Container( - margin: EdgeInsetsGeometry.all(6), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8), - border: Border.all(width: 0.50, color: const Color(0xFFA9A9A9)), - ), - - child: ObxValue((data) { - return AnimatedSize( - duration: Duration(milliseconds: 300), - child: data.value ? mainItemWidget() : mainItemWidgetExpanded(), - ); - }, controller.isExpanded), - ), - Positioned( - top: -10, - right: 20, - child: Container( - height: 32.h, + child: Column( + children: [ + SizedBox(height: 8.h), + InkWell( + onTap: () { + controller.isExpanded.value = !controller.isExpanded.value; + }, + child: Stack( + clipBehavior: Clip.none, + children: [ + Container( + margin: EdgeInsetsGeometry.all(6), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(8), border: Border.all(width: 0.50, color: const Color(0xFFA9A9A9)), ), - padding: EdgeInsets.symmetric(horizontal: 8), - child: Row( - spacing: 8, - children: [ - Assets.vec.chicken2Svg.svg( - width: 16.w, - height: 16.h, - colorFilter: ColorFilter.mode(AppColor.blueDark, BlendMode.srcIn), - ), - Text( - 'اطلاعات فارم‌ها', - textAlign: TextAlign.right, - style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor), - ), - ], + + child: ObxValue((data) { + return AnimatedSize( + duration: Duration(milliseconds: 300), + child: data.value ? mainItemWidget() : mainItemWidgetExpanded(), + ); + }, controller.isExpanded), + ), + Positioned( + top: -10, + right: 20, + child: Container( + height: 32.h, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + border: Border.all(width: 0.50, color: const Color(0xFFA9A9A9)), + ), + padding: EdgeInsets.symmetric(horizontal: 8), + child: Row( + spacing: 8, + children: [ + Assets.vec.chicken2Svg.svg( + width: 16.w, + height: 16.h, + colorFilter: ColorFilter.mode(AppColor.blueDark, BlendMode.srcIn), + ), + Text( + 'اطلاعات فارم‌ها', + textAlign: TextAlign.right, + style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor), + ), + ], + ), ), ), - ), - ], + ], + ), ), - ), - SizedBox(height: 10), - widelyWidget(), - SizedBox(height: 20), - ], + SizedBox(height: 10), + widelyWidget(), + SizedBox(height: 20), + ], + ), ); } diff --git a/packages/chicken/lib/presentation/pages/poultry_science/inspection/logic.dart b/packages/chicken/lib/presentation/pages/poultry_science/inspection/logic.dart index 411de5e..b131553 100644 --- a/packages/chicken/lib/presentation/pages/poultry_science/inspection/logic.dart +++ b/packages/chicken/lib/presentation/pages/poultry_science/inspection/logic.dart @@ -2,7 +2,6 @@ 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 { @@ -43,8 +42,6 @@ class InspectionPoultryScienceLogic extends GetxController { routesName.removeLast(); routesName.add(callback == 0 ? 'بازرسی' : 'بایگانی'); }); - - } @override @@ -71,7 +68,6 @@ class InspectionPoultryScienceLogic extends GetxController { baseLogic.clearSearch(); } - Future getHatchingList([bool isLoadingMore = false]) async { if (isLoadingMore) { isLoadingMoreAllocationsMade.value = true; @@ -261,5 +257,10 @@ class InspectionPoultryScienceLogic extends GetxController { getHatchingList(); } } -} + Future onRefresh() async { + currentPage.value = 1; + + await Future.wait([getHatchingList(), getHatchingReport()]); + } +} diff --git a/packages/chicken/lib/presentation/pages/poultry_science/inspection/view.dart b/packages/chicken/lib/presentation/pages/poultry_science/inspection/view.dart index 22332ac..f465138 100644 --- a/packages/chicken/lib/presentation/pages/poultry_science/inspection/view.dart +++ b/packages/chicken/lib/presentation/pages/poultry_science/inspection/view.dart @@ -21,15 +21,18 @@ class InspectionPoultrySciencePage extends GetView controller.setSearchValue(data), backId: poultryFirstKey, routesWidget: ContainerBreadcrumb(rxRoutes: controller.routesName), - widgets: [ - SizedBox(height: 50, child: segmentWidget()), - ObxValue((data) { - return data.value == 0 ? hatchingWidget() : reportWidget(); - }, controller.selectedSegmentIndex), - ], + child: Column( + children: [ + SizedBox(height: 50, child: segmentWidget()), + ObxValue((data) { + return data.value == 0 ? hatchingWidget() : reportWidget(); + }, controller.selectedSegmentIndex), + ], + ), ); } @@ -60,10 +63,6 @@ class InspectionPoultrySciencePage extends GetView SizedBox(height: 8.h), onLoadMore: () async => controller.getHatchingList(true), - onRefresh: () async { - controller.currentPage.value = 1; - await controller.getHatchingList(); - }, ); }, controller.hatchingList), ); @@ -356,10 +355,6 @@ class InspectionPoultrySciencePage extends GetView SizedBox(height: 8.h), onLoadMore: () async => controller.getHatchingReport(true), - onRefresh: () async { - controller.currentPage.value = 1; - await controller.getHatchingReport(); - }, ); }, controller.hatchingReportList), ); @@ -518,7 +513,8 @@ class InspectionPoultrySciencePage extends GetView { return ChickenBasePage( routes: controller.routesName, isBase: true, - widgets: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - spacing: 21.w, - children: [ - GlassMorphismCardIcon( - title: 'خرید داخل استان', - vecIcon: Assets.vec.map1Svg.path, - gradient: LinearGradient( - colors: [Color(0xFF00E096), Color(0xFF007D5E)], - stops: [0.0, 0.95], - begin: AlignmentGeometry.topLeft, - end: AlignmentGeometry.bottomRight, + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + spacing: 21.w, + children: [ + GlassMorphismCardIcon( + title: 'خرید داخل استان', + vecIcon: Assets.vec.map1Svg.path, + gradient: LinearGradient( + colors: [Color(0xFF00E096), Color(0xFF007D5E)], + stops: [0.0, 0.95], + begin: AlignmentGeometry.topLeft, + end: AlignmentGeometry.bottomRight, + ), + onTap: () { + Get.toNamed(ChickenRoutes.buysInProvinceSteward, id: stewardFirstKey); + }, ), - onTap: () { - Get.toNamed(ChickenRoutes.buysInProvinceSteward, id: stewardFirstKey); - }, - ), - GlassMorphismCardIcon( - title: 'خرید خارج استان', - vecIcon: Assets.vec.buyOutProvinceSvg.path, - gradient: LinearGradient( - colors: [Color(0xFF00E096), Color(0xFF007D5E)], - stops: [0.0, 0.95], - begin: AlignmentGeometry.topLeft, - end: AlignmentGeometry.bottomRight, + GlassMorphismCardIcon( + title: 'خرید خارج استان', + vecIcon: Assets.vec.buyOutProvinceSvg.path, + gradient: LinearGradient( + colors: [Color(0xFF00E096), Color(0xFF007D5E)], + stops: [0.0, 0.95], + begin: AlignmentGeometry.topLeft, + end: AlignmentGeometry.bottomRight, + ), + onTap: () { + Get.toNamed(ChickenRoutes.buysOutOfProvinceSteward, id: stewardFirstKey); + }, ), - onTap: () { - Get.toNamed(ChickenRoutes.buysOutOfProvinceSteward, id: stewardFirstKey); - }, - ), - ], - ), - ], + ], + ), + ], + ), ); } } diff --git a/packages/chicken/lib/presentation/pages/steward/buy_in_province/logic.dart b/packages/chicken/lib/presentation/pages/steward/buy_in_province/logic.dart index 576b0b4..a053f74 100644 --- a/packages/chicken/lib/presentation/pages/steward/buy_in_province/logic.dart +++ b/packages/chicken/lib/presentation/pages/steward/buy_in_province/logic.dart @@ -81,4 +81,9 @@ class BuyInProvinceLogic extends GetxController { buyAllLogic.searchedValue.value = searchedValue.value; } } + + Future onRefresh() async { + final isWaiting = selectedSegmentIndex.value == 0; + await Future.wait([buyWaitingLogic.getWaitingArrivals(), buyAllLogic.getAllArrivals()]); + } } diff --git a/packages/chicken/lib/presentation/pages/steward/buy_in_province/view.dart b/packages/chicken/lib/presentation/pages/steward/buy_in_province/view.dart index 7bcbf2b..4802b8e 100644 --- a/packages/chicken/lib/presentation/pages/steward/buy_in_province/view.dart +++ b/packages/chicken/lib/presentation/pages/steward/buy_in_province/view.dart @@ -22,15 +22,18 @@ class BuyInProvincePage extends GetView { onFilterTap: () { Get.bottomSheet(filterBottomSheet()); }, - widgets: [ - inventoryWidget(controller.rootLogic), - segmentWidget(), - ObxValue((index) { - return Expanded( - child: index.value == 0 ? BuyInProvinceWaitingPage() : BuyInProvinceAllPage(), - ); - }, controller.selectedSegmentIndex), - ], + onRefresh: controller.onRefresh, + child: Column( + children: [ + inventoryWidget(controller.rootLogic), + segmentWidget(), + ObxValue((index) { + return Expanded( + child: index.value == 0 ? BuyInProvinceWaitingPage() : BuyInProvinceAllPage(), + ); + }, controller.selectedSegmentIndex), + ], + ) ); } diff --git a/packages/chicken/lib/presentation/pages/steward/buy_in_province_all/view.dart b/packages/chicken/lib/presentation/pages/steward/buy_in_province_all/view.dart index 2b30ca0..b615289 100644 --- a/packages/chicken/lib/presentation/pages/steward/buy_in_province_all/view.dart +++ b/packages/chicken/lib/presentation/pages/steward/buy_in_province_all/view.dart @@ -12,7 +12,6 @@ class BuyInProvinceAllPage extends GetView { @override Widget build(BuildContext context) { - eLog("BuyInProvinceAllPage"); return Padding( padding: const EdgeInsets.symmetric(horizontal: 8), child: ObxValue((data) { @@ -38,10 +37,7 @@ class BuyInProvinceAllPage extends GetView { itemCount: data.value.data?.results?.length ?? 0, separatorBuilder: (context, index) => SizedBox(height: 8.h), onLoadMore: () async => controller.getAllArrivals(true), - onRefresh: () async { - controller.currentPage.value = 1; - await controller.getAllArrivals(); - }, + ); }, controller.allProduct), ); diff --git a/packages/chicken/lib/presentation/pages/steward/buy_in_province_waiting/view.dart b/packages/chicken/lib/presentation/pages/steward/buy_in_province_waiting/view.dart index e53aa90..03c6a51 100644 --- a/packages/chicken/lib/presentation/pages/steward/buy_in_province_waiting/view.dart +++ b/packages/chicken/lib/presentation/pages/steward/buy_in_province_waiting/view.dart @@ -12,7 +12,6 @@ class BuyInProvinceWaitingPage extends GetView { @override Widget build(BuildContext context) { - eLog("BuyInProvinceWaitingPage"); return Scaffold( backgroundColor: Colors.transparent, body: Padding( @@ -40,28 +39,9 @@ class BuyInProvinceWaitingPage extends GetView { itemCount: data.value.data?.results?.length ?? 0, separatorBuilder: (context, index) => SizedBox(height: 8.h), onLoadMore: () async => controller.getWaitingArrivals(true), - onRefresh: () async { - controller.currentPage.value = 1; - await controller.getWaitingArrivals(); - }, ); }, controller.waitingProduct), ), - /* floatingActionButtonLocation: FloatingActionButtonLocation.endFloat, - floatingActionButton: ObxValue((data) { - if ((data.value.data?.results?.length ?? 0) > 1) { - return AnimatedFab( - onPressed: () { - //TODO FAB - }, - message: 'تایید یکجا', - icon: Assets.vec.clipboardTaskSvg.svg(width: 45.w, height: 42.h), - backgroundColor: controller.bgConfirmAllColor.value, - ); - } else { - return SizedBox.shrink(); - } - }, controller.waitingProduct),*/ ); } diff --git a/packages/chicken/lib/presentation/pages/steward/buy_out_of_province/logic.dart b/packages/chicken/lib/presentation/pages/steward/buy_out_of_province/logic.dart index 337364f..206e202 100644 --- a/packages/chicken/lib/presentation/pages/steward/buy_out_of_province/logic.dart +++ b/packages/chicken/lib/presentation/pages/steward/buy_out_of_province/logic.dart @@ -1,5 +1,4 @@ import 'package:flutter/cupertino.dart'; - import 'package:rasadyar_chicken/data/models/request/create_steward_free_bar/create_steward_free_bar.dart'; import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart'; import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart'; @@ -236,4 +235,9 @@ class BuyOutOfProvinceLogic extends GetxController { ), ); } + + Future onRefresh() async { + currentPage.value = 1; + await getStewardPurchaseOutOfProvince(); + } } diff --git a/packages/chicken/lib/presentation/pages/steward/buy_out_of_province/view.dart b/packages/chicken/lib/presentation/pages/steward/buy_out_of_province/view.dart index defb47c..cd659ad 100644 --- a/packages/chicken/lib/presentation/pages/steward/buy_out_of_province/view.dart +++ b/packages/chicken/lib/presentation/pages/steward/buy_out_of_province/view.dart @@ -21,6 +21,7 @@ class BuyOutOfProvincePage extends GetView { return ChickenBasePage( routes: controller.routesName, backId: stewardFirstKey, + onRefresh: controller.onRefresh, onSearchChanged: (data) => controller.setSearchValue(data), onFilterTap: () { Get.bottomSheet(filterBottomSheet()); @@ -28,58 +29,55 @@ class BuyOutOfProvincePage extends GetView { child: Stack( children: [ - Positioned.fill(child:Column( - children: [ - inventoryWidget(controller.rootLogic), - ObxValue((data) { - return RPaginatedListView( - listType: ListType.separated, - resource: data.value, - hasMore: data.value.data?.next != null, - padding: EdgeInsets.fromLTRB(8, 8, 8, 80), - itemBuilder: (context, index) { - var item = data.value.data!.results![index]; - return ObxValue((val) { - return ExpandableListItem2( - selected: val.contains(index), - onTap: () => controller.isExpandedList.toggle(index), - index: index, - child: itemListWidget(item), - secondChild: itemListExpandedWidget(item), - labelColor: AppColor.blueLight, - labelIcon: Assets.vec.truckFastOutlinedSvg.path, - ); - }, controller.isExpandedList); - }, - itemCount: data.value.data?.results?.length ?? 0, - separatorBuilder: (context, index) => SizedBox(height: 8.h), - onLoadMore: () async => controller.getStewardPurchaseOutOfProvince(true), - onRefresh: () async { - controller.currentPage.value = 1; - await controller.getStewardPurchaseOutOfProvince(); - }, - ); - }, controller.purchaseOutOfProvinceList) - ], - )), + Positioned.fill( + child: Column( + children: [ + inventoryWidget(controller.rootLogic), + ObxValue((data) { + return RPaginatedListView( + listType: ListType.separated, + resource: data.value, + hasMore: data.value.data?.next != null, + padding: EdgeInsets.fromLTRB(8, 8, 8, 80), + itemBuilder: (context, index) { + var item = data.value.data!.results![index]; + return ObxValue((val) { + return ExpandableListItem2( + selected: val.contains(index), + onTap: () => controller.isExpandedList.toggle(index), + index: index, + child: itemListWidget(item), + secondChild: itemListExpandedWidget(item), + labelColor: AppColor.blueLight, + labelIcon: Assets.vec.truckFastOutlinedSvg.path, + ); + }, controller.isExpandedList); + }, + itemCount: data.value.data?.results?.length ?? 0, + separatorBuilder: (context, index) => SizedBox(height: 8.h), + onLoadMore: () async => controller.getStewardPurchaseOutOfProvince(true), + ); + }, controller.purchaseOutOfProvinceList), + ], + ), + ), Positioned( - right: 5, - bottom: 95, - child: RFab.add( - onPressed: () { - Get.bottomSheet( - addPurchasedInformationBottomSheet(), - isScrollControlled: true, - ignoreSafeArea: false, - ).whenComplete(() { - controller.resetSubmitForm(); - }); - }, - )) - + right: 5, + bottom: 95, + child: RFab.add( + onPressed: () { + Get.bottomSheet( + addPurchasedInformationBottomSheet(), + isScrollControlled: true, + ignoreSafeArea: false, + ).whenComplete(() { + controller.resetSubmitForm(); + }); + }, + ), + ), ], ), - ); } diff --git a/packages/chicken/lib/presentation/pages/steward/home/logic.dart b/packages/chicken/lib/presentation/pages/steward/home/logic.dart index 642d93c..536ca94 100644 --- a/packages/chicken/lib/presentation/pages/steward/home/logic.dart +++ b/packages/chicken/lib/presentation/pages/steward/home/logic.dart @@ -1,5 +1,3 @@ - -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/kill_house_distribution_info/kill_house_distribution_info.dart'; import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart'; @@ -16,9 +14,11 @@ class HomeLogic extends GetxController { @override void onReady() { super.onReady(); - getGeneralBarsInformation(); - getTodayBars(); - getDistributionInformation(); + refreshData(); + } + + Future refreshData() async { + await Future.wait([getGeneralBarsInformation(), getTodayBars(), getDistributionInformation()]); } Future getGeneralBarsInformation() async { diff --git a/packages/chicken/lib/presentation/pages/steward/home/view.dart b/packages/chicken/lib/presentation/pages/steward/home/view.dart index 7429f45..0bc658e 100644 --- a/packages/chicken/lib/presentation/pages/steward/home/view.dart +++ b/packages/chicken/lib/presentation/pages/steward/home/view.dart @@ -16,13 +16,16 @@ class HomePage extends GetView { return ChickenBasePage( scrollable: true, isBase: true, - widgets: [ - SizedBox(height: 8.h), - mainInformation(), - SizedBox(height: 8.h), - WidelyUsedWidget(), - SizedBox(height: 20), - ], + onRefresh: controller.refreshData, + child: Column( + children: [ + SizedBox(height: 18.h), + mainInformation(), + SizedBox(height: 8.h), + WidelyUsedWidget(), + SizedBox(height: 20), + ], + ), ); } diff --git a/packages/chicken/lib/presentation/pages/steward/root/logic.dart b/packages/chicken/lib/presentation/pages/steward/root/logic.dart index 52add18..6428f1d 100644 --- a/packages/chicken/lib/presentation/pages/steward/root/logic.dart +++ b/packages/chicken/lib/presentation/pages/steward/root/logic.dart @@ -182,6 +182,12 @@ class StewardRootLogic extends GetxController { final nestedKeyId = getNestedKey(); GlobalKey? currentNestedKey = Get.nestedKey(nestedKeyId); + final currentRoute = currentNestedKey?.currentState; + + + fLog(Get.currentRoute); + +/* fLog("onPopScopTaped ==> ${currentNestedKey?.currentState?.canPop()}"); if (currentNestedKey?.currentState?.canPop() == true) { iLog(currentNestedKey?.currentState?.canPop()); @@ -202,6 +208,6 @@ class StewardRootLogic extends GetxController { } else { await SystemNavigator.pop(); } - } + }*/ } } diff --git a/packages/chicken/lib/presentation/pages/steward/sale/view.dart b/packages/chicken/lib/presentation/pages/steward/sale/view.dart index 5fe6500..055b800 100644 --- a/packages/chicken/lib/presentation/pages/steward/sale/view.dart +++ b/packages/chicken/lib/presentation/pages/steward/sale/view.dart @@ -15,28 +15,30 @@ class SalePage extends GetView { return ChickenBasePage( routes: controller.routesName, isBase: true, - widgets: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - spacing: 21, - children: [ - GlassMorphismCardIcon( - title: 'فروش داخل استان', - vecIcon: Assets.vec.map2Svg.path, - onTap: () { - Get.toNamed(ChickenRoutes.salesInProvinceSteward, id: stewardSecondKey); - }, - ), - GlassMorphismCardIcon( - title: 'فروش خارج استان', - vecIcon: Assets.vec.saleOutProvinceSvg.path, - onTap: () { - Get.toNamed(ChickenRoutes.salesOutOfProvinceSteward, id: stewardSecondKey); - }, - ), - ], - ), - ], + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + spacing: 21, + children: [ + GlassMorphismCardIcon( + title: 'فروش داخل استان', + vecIcon: Assets.vec.map2Svg.path, + onTap: () { + Get.toNamed(ChickenRoutes.salesInProvinceSteward, id: stewardSecondKey); + }, + ), + GlassMorphismCardIcon( + title: 'فروش خارج استان', + vecIcon: Assets.vec.saleOutProvinceSvg.path, + onTap: () { + Get.toNamed(ChickenRoutes.salesOutOfProvinceSteward, id: stewardSecondKey); + }, + ), + ], + ), + ], + ), ); } diff --git a/packages/chicken/lib/presentation/pages/steward/sales_in_province/logic.dart b/packages/chicken/lib/presentation/pages/steward/sales_in_province/logic.dart index b8a1456..a78fbad 100644 --- a/packages/chicken/lib/presentation/pages/steward/sales_in_province/logic.dart +++ b/packages/chicken/lib/presentation/pages/steward/sales_in_province/logic.dart @@ -33,13 +33,18 @@ class SalesInProvinceLogic extends GetxController { GlobalKey formKey = GlobalKey(); - Rx fromDateFilter = Jalali.now().obs; - Rx toDateFilter = Jalali.now().obs; + Rx fromDateFilter = Jalali + .now() + .obs; + Rx toDateFilter = Jalali + .now() + .obs; Rxn selectedProductModel = Rxn(); Rxn selectedGuildModel = Rxn(); Rxn guildProfile = Rxn(); RxInt saleType = 1.obs; RxInt priceType = 1.obs; + RxInt quotaType = 1.obs; RxInt weight = 0.obs; RxInt pricePerKilo = 0.obs; RxInt totalCost = 0.obs; @@ -71,7 +76,6 @@ class SalesInProvinceLogic extends GetxController { }); debounce(weight, time: Duration(milliseconds: 110), (callback) { - totalCost.value = callback * pricePerKilo.value; }); @@ -80,14 +84,16 @@ class SalesInProvinceLogic extends GetxController { }); totalCost.listen((data) { - totalCostController.text = data.toString().separatedByComma; + totalCostController.text = data + .toString() + .separatedByComma; isValid.value = weight.value > 0 && - pricePerKilo.value > 0 && - totalCost.value > 0 && - selectedProductModel.value != null && - selectedGuildModel.value != null; + pricePerKilo.value > 0 && + totalCost.value > 0 && + selectedProductModel.value != null && + selectedGuildModel.value != null; }); everAll([ totalCost, @@ -108,7 +114,7 @@ class SalesInProvinceLogic extends GetxController { debounce( searchedValue, - (callback) => getAllocatedMade(), + (callback) => getAllocatedMade(), time: Duration(milliseconds: timeDebounce), ); } @@ -127,7 +133,8 @@ class SalesInProvinceLogic extends GetxController { } safeCall( - call: () async => await rootLogic.chickenRepository.getAllocatedMade( + call: () async => + await rootLogic.chickenRepository.getAllocatedMade( token: rootLogic.tokenService.accessToken.value!, queryParameters: buildQueryParams( page: currentPage.value, @@ -169,15 +176,16 @@ class SalesInProvinceLogic extends GetxController { void checkVerification() { isValid.value = weight.value > 0 && - pricePerKilo.value > 0 && - totalCost.value > 0 && - selectedProductModel.value != null && - selectedGuildModel.value != null; + pricePerKilo.value > 0 && + totalCost.value > 0 && + selectedProductModel.value != null && + selectedGuildModel.value != null; } void confirmAllocation(ConformAllocation allocation) { safeCall( - call: () async => await rootLogic.chickenRepository.confirmAllocation( + call: () async => + await rootLogic.chickenRepository.confirmAllocation( token: rootLogic.tokenService.accessToken.value!, allocation: allocation.toJson(), ), @@ -190,7 +198,8 @@ class SalesInProvinceLogic extends GetxController { void denyAllocation(String token) { safeCall( - call: () async => await rootLogic.chickenRepository.denyAllocation( + call: () async => + await rootLogic.chickenRepository.denyAllocation( token: rootLogic.tokenService.accessToken.value!, allocationToken: token, ), @@ -203,7 +212,8 @@ class SalesInProvinceLogic extends GetxController { Future confirmAllAllocations() async { safeCall( - call: () async => await rootLogic.chickenRepository.confirmAllAllocation( + call: () async => + await rootLogic.chickenRepository.confirmAllAllocation( token: rootLogic.tokenService.accessToken.value!, allocationTokens: allocatedList.value.data?.results?.map((e) => e.key!).toList() ?? [], ), @@ -216,7 +226,8 @@ class SalesInProvinceLogic extends GetxController { Future getRolesProducts() async { safeCall( - call: () async => await rootLogic.chickenRepository.getRolesProducts( + call: () async => + await rootLogic.chickenRepository.getRolesProducts( token: rootLogic.tokenService.accessToken.value!, ), onSuccess: (result) { @@ -231,7 +242,8 @@ class SalesInProvinceLogic extends GetxController { Future getGuilds() async { safeCall( - call: () async => await rootLogic.chickenRepository.getGuilds( + call: () async => + await rootLogic.chickenRepository.getGuilds( token: rootLogic.tokenService.accessToken.value!, queryParameters: buildQueryParams( queryParams: {'free': saleType.value == 2 ? true : false}, @@ -262,7 +274,8 @@ class SalesInProvinceLogic extends GetxController { Future getGuildProfile() async { await safeCall( - call: () async => await rootLogic.chickenRepository.getProfile( + call: () async => + await rootLogic.chickenRepository.getProfile( token: rootLogic.tokenService.accessToken.value!, ), onError: (error, stackTrace) {}, @@ -276,7 +289,8 @@ class SalesInProvinceLogic extends GetxController { tmpStewardAllocation = SubmitStewardAllocation( approvedPriceStatus: broadcastPrice.value?.active ?? false, allocationType: - '${guildProfile.value?.steward == true ? "steward" : "guild"}_${selectedGuildModel.value?.steward == true ? "steward" : "guild"}', + '${guildProfile.value?.steward == true ? "steward" : "guild"}_${selectedGuildModel.value + ?.steward == true ? "steward" : "guild"}', sellerType: guildProfile.value?.steward == true ? "Steward" : "Guild", buyerType: selectedGuildModel.value?.steward == true ? "Steward" : "Guild", amount: pricePerKilo.value, @@ -284,16 +298,20 @@ class SalesInProvinceLogic extends GetxController { weightOfCarcasses: weight.value, sellType: saleType.value == 2 ? "free" : 'exclusive', numberOfCarcasses: 0, + quota: quotaType.value == 1 ? 'governmental' : 'free', guildKey: selectedGuildModel.value?.key, productKey: selectedProductModel.value?.key, - date: DateTime.now().formattedDashedGregorian, + date: DateTime + .now() + .formattedDashedGregorian, type: "manual", ); } Future submitAllocation() async { safeCall( - call: () async => await rootLogic.chickenRepository.postSubmitStewardAllocation( + call: () async => + await rootLogic.chickenRepository.postSubmitStewardAllocation( token: rootLogic.tokenService.accessToken.value!, request: tmpStewardAllocation!, ), @@ -307,7 +325,8 @@ class SalesInProvinceLogic extends GetxController { Future deleteAllocation(AllocatedMadeModel model) async { safeCall( - call: () async => await rootLogic.chickenRepository.deleteStewardAllocation( + call: () async => + await rootLogic.chickenRepository.deleteStewardAllocation( token: rootLogic.tokenService.accessToken.value!, queryParameters: {'steward_allocation_key': model.key}, ), @@ -333,9 +352,15 @@ class SalesInProvinceLogic extends GetxController { weight.value = item.weightOfCarcasses ?? 0; pricePerKilo.value = item.amount ?? 0; totalCost.value = item.totalAmount ?? 0; - weightController.text = weight.value.toString().separatedByComma; - pricePerKiloController.text = pricePerKilo.value.toString().separatedByComma; - totalCostController.text = totalCost.value.toString().separatedByComma; + weightController.text = weight.value + .toString() + .separatedByComma; + pricePerKiloController.text = pricePerKilo.value + .toString() + .separatedByComma; + totalCostController.text = totalCost.value + .toString() + .separatedByComma; isValid.value = true; } @@ -364,7 +389,8 @@ class SalesInProvinceLogic extends GetxController { ); safeCall( - call: () async => await rootLogic.chickenRepository.updateStewardAllocation( + call: () async => + await rootLogic.chickenRepository.updateStewardAllocation( token: rootLogic.tokenService.accessToken.value!, request: updatedAllocationModel, ), @@ -408,17 +434,27 @@ class SalesInProvinceLogic extends GetxController { Future getBroadcastPrice() async { safeCall( - call: () async => await rootLogic.chickenRepository.getBroadcastPrice( + call: () async => + await rootLogic.chickenRepository.getBroadcastPrice( token: rootLogic.tokenService.accessToken.value!, ), onSuccess: (result) { broadcastPrice.value = result; if (broadcastPrice.value?.active == true) { pricePerKilo.value = broadcastPrice.value?.stewardPrice ?? 0; - pricePerKiloController.text = pricePerKilo.value.toString().separatedByComma; + pricePerKiloController.text = pricePerKilo.value + .toString() + .separatedByComma; } }, onError: (error, stacktrace) {}, ); } + + Future onRefresh() async { + currentPage.value = 1; + hasMoreDataAllocationsMade.value = true; + + await Future.wait([getAllocatedMade()]); + } } diff --git a/packages/chicken/lib/presentation/pages/steward/sales_in_province/view.dart b/packages/chicken/lib/presentation/pages/steward/sales_in_province/view.dart index 97b3028..0c2d8b5 100644 --- a/packages/chicken/lib/presentation/pages/steward/sales_in_province/view.dart +++ b/packages/chicken/lib/presentation/pages/steward/sales_in_province/view.dart @@ -20,6 +20,7 @@ class SalesInProvincePage extends GetView { routes: controller.routesName, backId: stewardSecondKey, onSearchChanged: (data) => controller.setSearchValue(data), + onRefresh: controller.onRefresh, onFilterTap: () { Get.bottomSheet(filterBottomSheet()); }, @@ -36,10 +37,6 @@ class SalesInProvincePage extends GetView { resource: data.value, hasMore: data.value.data?.next != null, isPaginating: controller.isLoadingMoreAllocationsMade.value, - onRefresh: () async { - controller.currentPage.value = 1; - await controller.getAllocatedMade(); - }, onLoadMore: () async { controller.currentPage.value++; iLog(controller.currentPage.value); @@ -404,30 +401,23 @@ class SalesInProvincePage extends GetView { SizedBox( height: 40, child: ObxValue((data) { - return Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Radio( - value: 1, - groupValue: controller.saleType.value, - onChanged: (value) { - controller.saleType.value = value!; - - controller.selectedGuildModel.value = null; - controller.selectedGuildModel.refresh(); - }, - ), - Text('فروش اختصاصی', style: AppFonts.yekan14), - SizedBox(width: 30.w), - Radio( - value: 2, - groupValue: controller.saleType.value, - onChanged: (value) { - controller.saleType.value = value!; - }, - ), - Text('فروش آزاد', style: AppFonts.yekan14), - ], + return RadioGroup( + groupValue: controller.saleType.value, + onChanged: (value) { + controller.saleType.value = value!; + controller.selectedGuildModel.value = null; + controller.selectedGuildModel.refresh(); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Radio(value: 1), + Text('فروش اختصاصی', style: AppFonts.yekan14), + SizedBox(width: 30.w), + Radio(value: 2), + Text('فروش آزاد', style: AppFonts.yekan14), + ], + ), ); }, controller.saleType), ), @@ -521,6 +511,27 @@ class SalesInProvincePage extends GetView { ); }), + Obx(() { + return RadioGroup( + groupValue: controller.quotaType.value, + onChanged: (value) { + controller.quotaType.value = value!; + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Radio(value: 1), + Text('انبار دولتی', style: AppFonts.yekan14), + + SizedBox(width: 30.w), + + Radio(value: 2), + Text('فروش آزاد', style: AppFonts.yekan14), + ], + ), + ); + }), + Obx(() { return Visibility( visible: controller.broadcastPrice.value?.active == true, diff --git a/packages/chicken/lib/presentation/pages/steward/sales_out_of_province/logic.dart b/packages/chicken/lib/presentation/pages/steward/sales_out_of_province/logic.dart index bd5d28d..c5fddea 100644 --- a/packages/chicken/lib/presentation/pages/steward/sales_out_of_province/logic.dart +++ b/packages/chicken/lib/presentation/pages/steward/sales_out_of_province/logic.dart @@ -211,4 +211,12 @@ class SalesOutOfProvinceLogic extends GetxController { selectedProduct.value = null; key = null; } + + + Future onRefresh() async { + currentPage.value = 1; + await getOutProvinceSales(); + + + } } diff --git a/packages/chicken/lib/presentation/pages/steward/sales_out_of_province/view.dart b/packages/chicken/lib/presentation/pages/steward/sales_out_of_province/view.dart index e58f674..b090df7 100644 --- a/packages/chicken/lib/presentation/pages/steward/sales_out_of_province/view.dart +++ b/packages/chicken/lib/presentation/pages/steward/sales_out_of_province/view.dart @@ -21,6 +21,7 @@ class SalesOutOfProvincePage extends GetView { return ChickenBasePage( routes: controller.routesName, backId: stewardSecondKey, + onRefresh: controller.onRefresh, onSearchChanged: (data) => controller.setSearchValue(data), onFilterTap: () { Get.bottomSheet(filterBottomSheet()); @@ -73,10 +74,6 @@ class SalesOutOfProvincePage extends GetView { ObxValue((data) { return RPaginatedListView( onLoadMore: () async => controller.getOutProvinceSales(true), - onRefresh: () async { - controller.currentPage.value = 1; - await controller.getOutProvinceSales(); - }, hasMore: data.value.data?.next != null, listType: ListType.separated, resource: data.value, @@ -285,7 +282,10 @@ class SalesOutOfProvincePage extends GetView { buildRow(title: 'مشخصات خریدار', value: item.buyer?.fullname ?? 'N/A'), buildRow(title: 'تلفن خریدار', value: item.buyer?.mobile ?? 'N/A'), buildRow(title: 'نام واحد', value: item.buyer?.unitName ?? 'N/A'), - buildRow(title: 'وزن لاشه (ريال)', value: '${item.weightOfCarcasses?.separatedByCommaFa}'), + buildRow( + title: 'وزن لاشه (ريال)', + value: '${item.weightOfCarcasses?.separatedByCommaFa}', + ), Row( mainAxisAlignment: MainAxisAlignment.center, diff --git a/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_buyers/logic.dart b/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_buyers/logic.dart index 34f660a..600b852 100644 --- a/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_buyers/logic.dart +++ b/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_buyers/logic.dart @@ -208,4 +208,10 @@ class SalesOutOfProvinceBuyersLogic extends GetxController { toDateFilter.value = toDateFilter.value; getOutProvinceCarcassesBuyer(); } + + + Future onRefresh() async { + currentPage.value = 1; + await getOutProvinceCarcassesBuyer(); + } } diff --git a/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_buyers/view.dart b/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_buyers/view.dart index 772a264..fa4335d 100644 --- a/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_buyers/view.dart +++ b/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_buyers/view.dart @@ -16,6 +16,7 @@ class SalesOutOfProvinceBuyersPage extends GetView controller.setSearchValue(data), filteringWidget: filterBottomSheet(), child: Stack( @@ -33,21 +34,16 @@ class SalesOutOfProvinceBuyersPage extends GetView controller.getOutProvinceCarcassesBuyer(true), - onRefresh: () async { - controller.currentPage.value = 1; - await controller.getOutProvinceCarcassesBuyer(); - }, hasMore: data.value.data?.next != null, listType: ListType.separated, resource: data.value, diff --git a/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_sales_list/view.dart b/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_sales_list/view.dart index 7860ae0..5d96d07 100644 --- a/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_sales_list/view.dart +++ b/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_sales_list/view.dart @@ -20,10 +20,7 @@ class SalesOutOfProvinceSalesListPage extends GetView controller.getOutProvinceSales(true), - onRefresh: () async { - controller.currentPage.value = 1; - await controller.getOutProvinceSales(); - }, + hasMore: data.value.data?.next != null, listType: ListType.separated, resource: data.value, diff --git a/packages/chicken/lib/presentation/pages/steward/segmentation/logic.dart b/packages/chicken/lib/presentation/pages/steward/segmentation/logic.dart index c4bacb5..a99ac7a 100644 --- a/packages/chicken/lib/presentation/pages/steward/segmentation/logic.dart +++ b/packages/chicken/lib/presentation/pages/steward/segmentation/logic.dart @@ -220,4 +220,10 @@ class SegmentationLogic extends GetxController { onError: (error, stacktrace) {}, ); } + + + Future onRefresh() async { + currentPage.value = 1; + await getAllSegmentation(); + } } diff --git a/packages/chicken/lib/presentation/pages/steward/segmentation/view.dart b/packages/chicken/lib/presentation/pages/steward/segmentation/view.dart index 130dc0c..324d4e6 100644 --- a/packages/chicken/lib/presentation/pages/steward/segmentation/view.dart +++ b/packages/chicken/lib/presentation/pages/steward/segmentation/view.dart @@ -18,6 +18,7 @@ class SegmentationPage extends GetView { onFilterTap: () { Get.bottomSheet(filterBottomSheet()); }, + onRefresh: controller.onRefresh, hasBack: false, child: Stack( children: [ @@ -25,10 +26,7 @@ class SegmentationPage extends GetView { child: ObxValue((data) { return RPaginatedListView( onLoadMore: () async => controller.getAllSegmentation(true), - onRefresh: () async { - controller.currentPage.value = 1; - await controller.getAllSegmentation(); - }, + hasMore: data.value.data?.next != null, listType: ListType.separated, resource: data.value, diff --git a/packages/chicken/lib/presentation/widget/base_page/back_ground.dart b/packages/chicken/lib/presentation/widget/base_page/back_ground.dart index 30b9ce9..3f9f8e1 100644 --- a/packages/chicken/lib/presentation/widget/base_page/back_ground.dart +++ b/packages/chicken/lib/presentation/widget/base_page/back_ground.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:rasadyar_core/core.dart'; -BackGroundWidget chickenBackground() { - return BackGroundWidget( +BoxDecoration chickenBackground() { + return backGroundDecoration( gradient: LinearGradient( begin: Alignment(1.00, 0.01), end: Alignment(0.04, 0.99), @@ -12,6 +12,6 @@ BackGroundWidget chickenBackground() { const Color(0xFFD6E4E3).withValues(alpha: .8), ], ), - vecPath: Assets.vec.chickenPatternSvg.path, + backgroundPath: Assets.images.patternChicken.path, ); } diff --git a/packages/chicken/lib/presentation/widget/base_page/view.dart b/packages/chicken/lib/presentation/widget/base_page/view.dart index bbb944f..84930be 100644 --- a/packages/chicken/lib/presentation/widget/base_page/view.dart +++ b/packages/chicken/lib/presentation/widget/base_page/view.dart @@ -21,7 +21,6 @@ class ChickenBasePage extends GetView { this.onSearchChanged, this.routes, this.routesWidget, - this.widgets, this.child, this.scrollable = false, this.floatingActionButtonLocation, @@ -30,6 +29,7 @@ class ChickenBasePage extends GetView { this.backGroundWidget, this.isFullScreen = false, this.onPopScopTaped, + this.onRefresh, }); //AppBar properties` @@ -48,10 +48,10 @@ class ChickenBasePage extends GetView { final VoidCallback? onSearchTap; final VoidCallback? onNewsTap; final VoidCallback? onNotificationTap; + final RefreshCallback? onRefresh; final List? routes; final Widget? routesWidget; - final List? widgets; final Widget? child; final bool scrollable; @@ -60,7 +60,7 @@ class ChickenBasePage extends GetView { final Widget? filteringWidget; final void Function(String?)? onSearchChanged; - final BackGroundWidget? backGroundWidget; + final BoxDecoration? backGroundWidget; void _onFilterTap() { if (hasFilter && filteringWidget != null) { @@ -82,13 +82,12 @@ class ChickenBasePage extends GetView { routes: routes, routesWidget: routesWidget, onPopScopTaped: onPopScopTaped, - widgets: widgets, + onRefresh: onRefresh, child: child, - scrollable: scrollable, onSearchChanged: onSearchChanged, floatingActionButtonLocation: floatingActionButtonLocation, floatingActionButton: floatingActionButton, - backGroundWidget: backGroundWidget ?? chickenBackground(), + backGroundDecoration: backGroundWidget ?? chickenBackground(), appBar: isFullScreen ? null : chickenAppBar( diff --git a/packages/core/lib/presentation/common/assets.gen.dart b/packages/core/lib/presentation/common/assets.gen.dart index a85a4df..f488199 100644 --- a/packages/core/lib/presentation/common/assets.gen.dart +++ b/packages/core/lib/presentation/common/assets.gen.dart @@ -493,6 +493,9 @@ class $AssetsImagesGen { /// File path: assets/images/outter_splash.webp AssetGenImage get outterSplash => const AssetGenImage('assets/images/outter_splash.webp'); + /// File path: assets/images/pattern_chicken.webp + AssetGenImage get patternChicken => const AssetGenImage('assets/images/pattern_chicken.webp'); + /// File path: assets/images/place_holder.png AssetGenImage get placeHolder => const AssetGenImage('assets/images/place_holder.png'); @@ -500,7 +503,7 @@ class $AssetsImagesGen { AssetGenImage get selectRole => const AssetGenImage('assets/images/select_role.webp'); /// List of all assets - List get values => [chicken, innerSplash, outterSplash, placeHolder, selectRole]; + List get values => [chicken, innerSplash, outterSplash, patternChicken, placeHolder, selectRole]; } class $AssetsLogosGen { diff --git a/packages/core/lib/presentation/widget/base_page/view.dart b/packages/core/lib/presentation/widget/base_page/view.dart index 18599b9..ef5d2ab 100644 --- a/packages/core/lib/presentation/widget/base_page/view.dart +++ b/packages/core/lib/presentation/widget/base_page/view.dart @@ -6,30 +6,28 @@ class BasePage extends GetView { super.key, this.routes, this.routesWidget, - this.widgets, this.child, - this.scrollable = false, this.floatingActionButtonLocation, this.floatingActionButton, this.appBar, - this.backGroundWidget, + this.backGroundDecoration, this.onPopScopTaped, this.backId, this.onSearchChanged, + this.onRefresh, }); final List? routes; final Widget? routesWidget; - final List? widgets; final Widget? child; - final bool scrollable; final RAppBar? appBar; - final BackGroundWidget? backGroundWidget; + final BoxDecoration? backGroundDecoration; final FloatingActionButtonLocation? floatingActionButtonLocation; final Widget? floatingActionButton; final VoidCallback? onPopScopTaped; final int? backId; final void Function(String?)? onSearchChanged; + final RefreshCallback? onRefresh; Widget _buildHeader() { if (appBar?.hasSearch == true) { @@ -49,38 +47,30 @@ class BasePage extends GetView { final content = [ if (routes != null || routesWidget != null) _buildHeader(), if (child != null) Expanded(child: child!), - ...?widgets, ]; - if (scrollable) { - if (backGroundWidget != null) { - return Stack( - children: [ - ?backGroundWidget, - SingleChildScrollView( - physics: const BouncingScrollPhysics(), - padding: EdgeInsets.symmetric(vertical: 8.h), - child: Column(children: content), + if (onRefresh == null) { + return Container( + decoration: backGroundDecoration, + child: Column(mainAxisAlignment: MainAxisAlignment.start, children: content), + ); + } else { + return RefreshIndicator.adaptive( + triggerMode: RefreshIndicatorTriggerMode.anywhere, + edgeOffset: 16.h, + onRefresh: onRefresh ?? () async {}, + child: CustomScrollView( + slivers: [ + SliverFillRemaining( + child: Container( + decoration: backGroundDecoration, + child: Column(mainAxisAlignment: MainAxisAlignment.start, children: content), + ), ), ], - ); - } - return SingleChildScrollView( - physics: const BouncingScrollPhysics(), - padding: EdgeInsets.symmetric(vertical: 8.h), - child: Column(children: content), + ), ); } - - if (backGroundWidget != null) { - return Stack( - children: [ - Positioned.fill(child: backGroundWidget!), - Column(children: content), - ], - ); - } - return Column(children: content); } @override diff --git a/packages/core/lib/presentation/widget/base_page/widgets/back_ground_widget.dart b/packages/core/lib/presentation/widget/base_page/widgets/back_ground_widget.dart index 120ead5..64a693a 100644 --- a/packages/core/lib/presentation/widget/base_page/widgets/back_ground_widget.dart +++ b/packages/core/lib/presentation/widget/base_page/widgets/back_ground_widget.dart @@ -2,19 +2,9 @@ import 'package:flutter/material.dart'; import '../../../../core.dart'; -class BackGroundWidget extends StatelessWidget { - const BackGroundWidget({super.key, required this.gradient, required this.vecPath}); - - final Gradient gradient; - final String vecPath; - - @override - Widget build(BuildContext context) { - return Container( - width: Get.width, - height: Get.height, - decoration: BoxDecoration(gradient: gradient), - child: SvgGenImage.vec(vecPath).svg(fit: BoxFit.cover), - ); - } +BoxDecoration backGroundDecoration({required Gradient gradient, required String backgroundPath}) { + return BoxDecoration( + gradient: gradient, + image: DecorationImage(image: AssetGenImage(backgroundPath).provider(), fit: BoxFit.cover), + ); } diff --git a/packages/core/lib/presentation/widget/list_view/r_paginated_list_view.dart b/packages/core/lib/presentation/widget/list_view/r_paginated_list_view.dart index 25a6262..281b333 100644 --- a/packages/core/lib/presentation/widget/list_view/r_paginated_list_view.dart +++ b/packages/core/lib/presentation/widget/list_view/r_paginated_list_view.dart @@ -11,7 +11,6 @@ class RPaginatedListView extends StatelessWidget { required this.itemBuilder, required this.itemCount, this.separatorBuilder, - this.onRefresh, required this.onLoadMore, this.isPaginating = false, this.hasMore = true, @@ -27,7 +26,6 @@ class RPaginatedListView extends StatelessWidget { final Resource> resource; final NullableIndexedWidgetBuilder itemBuilder; final IndexedWidgetBuilder? separatorBuilder; - final Future Function()? onRefresh; final Future Function() onLoadMore; final bool isPaginating; final bool hasMore; @@ -55,7 +53,7 @@ class RPaginatedListView extends StatelessWidget { } if (resource.isEmpty || resource.data?.results?.isEmpty == true) { - return emptyWidget ?? EmptyWidget(onRefresh: onRefresh); + return emptyWidget ?? EmptyWidget(); } final controller = scrollController ?? ScrollController(); @@ -69,50 +67,44 @@ class RPaginatedListView extends StatelessWidget { } return false; }, - child: RefreshIndicator( - color: AppColor.blueNormal, - triggerMode: RefreshIndicatorTriggerMode.anywhere, - - onRefresh: onRefresh ?? () async {}, - child: listType == ListType.separated - ? ListView.separated( - padding: padding, - controller: controller, - shrinkWrap: true, - itemCount: itemCount + (isPaginating ? 1 : 0), - itemBuilder: (context, index) { - if (isPaginating && index == itemCount) { - return SizedBox( - height: 50, - child: const Padding( - padding: EdgeInsets.all(16), - child: Center(child: CupertinoActivityIndicator()), - ), - ); - } - return itemBuilder(context, index); - }, - separatorBuilder: separatorBuilder ?? (_, __) => const SizedBox(height: 8), - ) - : ListView.builder( - padding: padding, - controller: controller, - shrinkWrap: true, - itemCount: itemCount + (isPaginating ? 1 : 0), - itemBuilder: (context, index) { - if (isPaginating && index == itemCount) { - return SizedBox( - height: 50, - child: const Padding( - padding: EdgeInsets.all(16), - child: Center(child: CupertinoActivityIndicator()), - ), - ); - } - return itemBuilder(context, index); - }, - ), - ), + child: listType == ListType.separated + ? ListView.separated( + padding: padding, + controller: controller, + shrinkWrap: true, + itemCount: itemCount + (isPaginating ? 1 : 0), + itemBuilder: (context, index) { + if (isPaginating && index == itemCount) { + return SizedBox( + height: 50, + child: const Padding( + padding: EdgeInsets.all(16), + child: Center(child: CupertinoActivityIndicator()), + ), + ); + } + return itemBuilder(context, index); + }, + separatorBuilder: separatorBuilder ?? (_, __) => const SizedBox(height: 8), + ) + : ListView.builder( + padding: padding, + controller: controller, + shrinkWrap: true, + itemCount: itemCount + (isPaginating ? 1 : 0), + itemBuilder: (context, index) { + if (isPaginating && index == itemCount) { + return SizedBox( + height: 50, + child: const Padding( + padding: EdgeInsets.all(16), + child: Center(child: CupertinoActivityIndicator()), + ), + ); + } + return itemBuilder(context, index); + }, + ), ); } } diff --git a/packages/inspection/lib/presentation/pages/records/logic.dart b/packages/inspection/lib/presentation/pages/records/logic.dart index a4c1fce..1a30cb6 100644 --- a/packages/inspection/lib/presentation/pages/records/logic.dart +++ b/packages/inspection/lib/presentation/pages/records/logic.dart @@ -29,4 +29,14 @@ class RecordsLogic extends GetxController { } } + + Future onRefresh() async { + await Future.delayed(const Duration(seconds: 2)).then((value) { + currentPage.value = 1; + countList.value = Resource>.success( + PaginationModel(results: [1, 2, 3, 4, 5, 6], count: 1, next: null, previous: null), + ); + }); + } + } diff --git a/packages/inspection/lib/presentation/pages/records/view.dart b/packages/inspection/lib/presentation/pages/records/view.dart index e2b56be..1d7c999 100644 --- a/packages/inspection/lib/presentation/pages/records/view.dart +++ b/packages/inspection/lib/presentation/pages/records/view.dart @@ -16,10 +16,7 @@ class RecordsPage extends GetView { resource: data.value, hasMore: data.value.data?.next != null, isPaginating: controller.isLoadingMore.value, - onRefresh: () async { - controller.currentPage.value = 1; - //await controller.getAllocatedMade(); - }, + onLoadMore: () async { controller.currentPage.value++; iLog(controller.currentPage.value); diff --git a/packages/inspection/lib/presentation/pages/users/view.dart b/packages/inspection/lib/presentation/pages/users/view.dart index ddf1285..f57a0c0 100644 --- a/packages/inspection/lib/presentation/pages/users/view.dart +++ b/packages/inspection/lib/presentation/pages/users/view.dart @@ -16,10 +16,7 @@ class UsersPage extends GetView { resource: data.value, hasMore: data.value.data?.next != null, isPaginating: controller.isLoadingMore.value, - onRefresh: () async { - controller.currentPage.value = 1; - //await controller.getAllocatedMade(); - }, + onLoadMore: () async { controller.currentPage.value++; iLog(controller.currentPage.value); @@ -58,10 +55,7 @@ class UsersPage extends GetView { mainAxisAlignment: MainAxisAlignment.center, spacing: 3, children: [ - Text( - 'داود خرم مهری پور', - style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal), - ), + Text('داود خرم مهری پور', style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal)), Text( '09302545455', style: AppFonts.yekan10.copyWith(color: AppColor.darkGreyDarkHover), @@ -72,10 +66,7 @@ class UsersPage extends GetView { mainAxisAlignment: MainAxisAlignment.center, children: [ Text('باقی مانده', style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)), - Text( - '0 کیلوگرم', - style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover), - ), + Text('0 کیلوگرم', style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover)), ], ), Assets.vec.scanBarcodeSvg.svg(), @@ -141,7 +132,7 @@ class UsersPage extends GetView { ), ), Visibility( - visible:true, + visible: true, child: Row( mainAxisAlignment: MainAxisAlignment.center, spacing: 16.w, @@ -152,7 +143,7 @@ class UsersPage extends GetView { height: 40.h, onPressed: () { - /* controller.setEditData(item); + /* controller.setEditData(item); Get.bottomSheet( addOrEditBottomSheet(true), isScrollControlled: true, @@ -176,7 +167,7 @@ class UsersPage extends GetView { // controller.denyAllocation(item.key ?? ''); //await controller.deleteAllocation(item); }, - onRefresh: () async{} + onRefresh: () async {}, ); }, borderColor: AppColor.redNormal,