refactor: chicken module for other role's

feat: steward Role
chore: add some rive file and library
This commit is contained in:
2025-09-02 14:40:55 +03:30
parent dfb9298097
commit 5ec772ee8a
49 changed files with 395 additions and 201 deletions

View File

@@ -0,0 +1,78 @@
String getFaUserRole(String? role) {
switch (role) {
case "Admin":
return "ادمین استان";
case "CityOperator":
return "تعاونی";
case "Poultry":
return "مرغدار";
case "ProvinceOperator":
return "مدیر اجرایی";
case "ProvinceFinancial":
return "مالی اتحادیه";
case "KillHouse":
return "کشتارگاه";
case "KillHouseVet":
return "دامپزشک کشتارگاه";
case "VetFarm":
return "دامپزشک فارم";
case "Driver":
return "راننده";
case "ProvinceInspector":
return "بازرس اتحادیه ";
case "VetSupervisor":
return "دامپزشک کل";
case "Jahad":
return "جهاد کشاورزی استان";
case "CityJahad":
return "جهاد کشاورزی شهرستان";
case "ProvincialGovernment":
return "استانداری";
case "Guilds":
return "صنف";
case "Steward":
return "مباشر";
case "Commerce":
return "معاونت بازرگانی استان";
case "CityCommerce":
return "بازرگانی شهرستان";
case "UnitWindow":
return "پنجره واحد";
case "CityVet":
return "دامپزشک شهرستان";
case "Observatory":
return "رصدخانه";
case "ProvinceSupervisor":
return "ناظر استان";
case "GuildRoom":
return "اتاق اصناف";
case "PosCompany":
return "شرکت psp";
case "LiveStockSupport":
return "پشتیبانی امور دام";
case "SuperAdmin":
return "ادمین کل";
case "ChainCompany":
return "شرکت زنجیره";
case "AdminX":
return "ادمین ایکس";
case "Supporter":
return "پشتیبان سامانه";
case "Dispenser":
return "پخش کننده";
case "CityPoultry":
return "طیور شهرستان";
case "ParentCompany":
return "شرکت مادر";
case "ColdHouseSteward":
return "مباشر سردخانه";
case "CityGuild":
return "اتحادیه پروتئینی";
case "LiveStockProvinceJahad":
return "جهاد استان";
case "PoultryScience":
return "کارشناس طیور";
default:
return "نامشخص";
}
}

View File

@@ -23,7 +23,7 @@ class ChickenLocalDataSourceImp implements ChickenLocalDataSource {
color: AppColor.greenLightActive.toARGB32(),
iconColor: AppColor.greenNormal.toARGB32(),
iconPath: Assets.vec.cubeSearchSvg.path,
path: ChickenRoutes.buysInProvince,
path: ChickenRoutes.buysInProvinceSteward,
),
WidelyUsedLocalItem(
index: 1,
@@ -32,7 +32,7 @@ class ChickenLocalDataSourceImp implements ChickenLocalDataSource {
color: AppColor.blueLightActive.toARGB32(),
iconColor: AppColor.blueNormal.toARGB32(),
iconPath: Assets.vec.cubeSvg.path,
path: ChickenRoutes.salesInProvince,
path: ChickenRoutes.salesInProvinceSteward,
),
WidelyUsedLocalItem(
@@ -41,7 +41,7 @@ class ChickenLocalDataSourceImp implements ChickenLocalDataSource {
color: AppColor.blueLightActive.toARGB32(),
iconColor: AppColor.blueNormal.toARGB32(),
iconPath: Assets.vec.cubeRotateSvg.path,
path: ChickenRoutes.buysInProvince,
path: ChickenRoutes.buysInProvinceSteward,
),
];
await local.add(

View File

@@ -1,5 +1,3 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'auth_response_model.freezed.dart';
@@ -8,13 +6,24 @@ part 'auth_response_model.g.dart';
@freezed
abstract class AuthResponseModel with _$AuthResponseModel {
const factory AuthResponseModel({
String? refresh,
String? access,
bool? otpStatus,
String? accessToken,
String? expiresIn,
String? scope,
String? expireTime,
String? mobile,
String? fullname,
String? firstname,
String? lastname,
String? city,
String? province,
String? nationalCode,
String? nationalId,
String? birthday,
String? image,
int? baseOrder,
List<String>? role,
}) = _AuthResponseModel;
factory AuthResponseModel.fromJson(Map<String, dynamic> json) =>
_$AuthResponseModelFromJson(json);
}

View File

@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$AuthResponseModel {
String? get refresh; String? get access; bool? get otpStatus;
String? get accessToken; String? get expiresIn; String? get scope; String? get expireTime; String? get mobile; String? get fullname; String? get firstname; String? get lastname; String? get city; String? get province; String? get nationalCode; String? get nationalId; String? get birthday; String? get image; int? get baseOrder; List<String>? get role;
/// Create a copy of AuthResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -28,16 +28,16 @@ $AuthResponseModelCopyWith<AuthResponseModel> get copyWith => _$AuthResponseMode
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is AuthResponseModel&&(identical(other.refresh, refresh) || other.refresh == refresh)&&(identical(other.access, access) || other.access == access)&&(identical(other.otpStatus, otpStatus) || other.otpStatus == otpStatus));
return identical(this, other) || (other.runtimeType == runtimeType&&other is AuthResponseModel&&(identical(other.accessToken, accessToken) || other.accessToken == accessToken)&&(identical(other.expiresIn, expiresIn) || other.expiresIn == expiresIn)&&(identical(other.scope, scope) || other.scope == scope)&&(identical(other.expireTime, expireTime) || other.expireTime == expireTime)&&(identical(other.mobile, mobile) || other.mobile == mobile)&&(identical(other.fullname, fullname) || other.fullname == fullname)&&(identical(other.firstname, firstname) || other.firstname == firstname)&&(identical(other.lastname, lastname) || other.lastname == lastname)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.nationalCode, nationalCode) || other.nationalCode == nationalCode)&&(identical(other.nationalId, nationalId) || other.nationalId == nationalId)&&(identical(other.birthday, birthday) || other.birthday == birthday)&&(identical(other.image, image) || other.image == image)&&(identical(other.baseOrder, baseOrder) || other.baseOrder == baseOrder)&&const DeepCollectionEquality().equals(other.role, role));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,refresh,access,otpStatus);
int get hashCode => Object.hash(runtimeType,accessToken,expiresIn,scope,expireTime,mobile,fullname,firstname,lastname,city,province,nationalCode,nationalId,birthday,image,baseOrder,const DeepCollectionEquality().hash(role));
@override
String toString() {
return 'AuthResponseModel(refresh: $refresh, access: $access, otpStatus: $otpStatus)';
return 'AuthResponseModel(accessToken: $accessToken, expiresIn: $expiresIn, scope: $scope, expireTime: $expireTime, mobile: $mobile, fullname: $fullname, firstname: $firstname, lastname: $lastname, city: $city, province: $province, nationalCode: $nationalCode, nationalId: $nationalId, birthday: $birthday, image: $image, baseOrder: $baseOrder, role: $role)';
}
@@ -48,7 +48,7 @@ abstract mixin class $AuthResponseModelCopyWith<$Res> {
factory $AuthResponseModelCopyWith(AuthResponseModel value, $Res Function(AuthResponseModel) _then) = _$AuthResponseModelCopyWithImpl;
@useResult
$Res call({
String? refresh, String? access, bool? otpStatus
String? accessToken, String? expiresIn, String? scope, String? expireTime, String? mobile, String? fullname, String? firstname, String? lastname, String? city, String? province, String? nationalCode, String? nationalId, String? birthday, String? image, int? baseOrder, List<String>? role
});
@@ -65,12 +65,25 @@ class _$AuthResponseModelCopyWithImpl<$Res>
/// Create a copy of AuthResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? refresh = freezed,Object? access = freezed,Object? otpStatus = freezed,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? accessToken = freezed,Object? expiresIn = freezed,Object? scope = freezed,Object? expireTime = freezed,Object? mobile = freezed,Object? fullname = freezed,Object? firstname = freezed,Object? lastname = freezed,Object? city = freezed,Object? province = freezed,Object? nationalCode = freezed,Object? nationalId = freezed,Object? birthday = freezed,Object? image = freezed,Object? baseOrder = freezed,Object? role = freezed,}) {
return _then(_self.copyWith(
refresh: freezed == refresh ? _self.refresh : refresh // ignore: cast_nullable_to_non_nullable
as String?,access: freezed == access ? _self.access : access // ignore: cast_nullable_to_non_nullable
as String?,otpStatus: freezed == otpStatus ? _self.otpStatus : otpStatus // ignore: cast_nullable_to_non_nullable
as bool?,
accessToken: freezed == accessToken ? _self.accessToken : accessToken // ignore: cast_nullable_to_non_nullable
as String?,expiresIn: freezed == expiresIn ? _self.expiresIn : expiresIn // ignore: cast_nullable_to_non_nullable
as String?,scope: freezed == scope ? _self.scope : scope // ignore: cast_nullable_to_non_nullable
as String?,expireTime: freezed == expireTime ? _self.expireTime : expireTime // ignore: cast_nullable_to_non_nullable
as String?,mobile: freezed == mobile ? _self.mobile : mobile // ignore: cast_nullable_to_non_nullable
as String?,fullname: freezed == fullname ? _self.fullname : fullname // ignore: cast_nullable_to_non_nullable
as String?,firstname: freezed == firstname ? _self.firstname : firstname // ignore: cast_nullable_to_non_nullable
as String?,lastname: freezed == lastname ? _self.lastname : lastname // ignore: cast_nullable_to_non_nullable
as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
as String?,province: freezed == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
as String?,nationalCode: freezed == nationalCode ? _self.nationalCode : nationalCode // ignore: cast_nullable_to_non_nullable
as String?,nationalId: freezed == nationalId ? _self.nationalId : nationalId // ignore: cast_nullable_to_non_nullable
as String?,birthday: freezed == birthday ? _self.birthday : birthday // ignore: cast_nullable_to_non_nullable
as String?,image: freezed == image ? _self.image : image // ignore: cast_nullable_to_non_nullable
as String?,baseOrder: freezed == baseOrder ? _self.baseOrder : baseOrder // ignore: cast_nullable_to_non_nullable
as int?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
as List<String>?,
));
}
@@ -155,10 +168,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? refresh, String? access, bool? otpStatus)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? accessToken, String? expiresIn, String? scope, String? expireTime, String? mobile, String? fullname, String? firstname, String? lastname, String? city, String? province, String? nationalCode, String? nationalId, String? birthday, String? image, int? baseOrder, List<String>? role)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _AuthResponseModel() when $default != null:
return $default(_that.refresh,_that.access,_that.otpStatus);case _:
return $default(_that.accessToken,_that.expiresIn,_that.scope,_that.expireTime,_that.mobile,_that.fullname,_that.firstname,_that.lastname,_that.city,_that.province,_that.nationalCode,_that.nationalId,_that.birthday,_that.image,_that.baseOrder,_that.role);case _:
return orElse();
}
@@ -176,10 +189,10 @@ return $default(_that.refresh,_that.access,_that.otpStatus);case _:
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? refresh, String? access, bool? otpStatus) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? accessToken, String? expiresIn, String? scope, String? expireTime, String? mobile, String? fullname, String? firstname, String? lastname, String? city, String? province, String? nationalCode, String? nationalId, String? birthday, String? image, int? baseOrder, List<String>? role) $default,) {final _that = this;
switch (_that) {
case _AuthResponseModel():
return $default(_that.refresh,_that.access,_that.otpStatus);case _:
return $default(_that.accessToken,_that.expiresIn,_that.scope,_that.expireTime,_that.mobile,_that.fullname,_that.firstname,_that.lastname,_that.city,_that.province,_that.nationalCode,_that.nationalId,_that.birthday,_that.image,_that.baseOrder,_that.role);case _:
throw StateError('Unexpected subclass');
}
@@ -196,10 +209,10 @@ return $default(_that.refresh,_that.access,_that.otpStatus);case _:
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? refresh, String? access, bool? otpStatus)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? accessToken, String? expiresIn, String? scope, String? expireTime, String? mobile, String? fullname, String? firstname, String? lastname, String? city, String? province, String? nationalCode, String? nationalId, String? birthday, String? image, int? baseOrder, List<String>? role)? $default,) {final _that = this;
switch (_that) {
case _AuthResponseModel() when $default != null:
return $default(_that.refresh,_that.access,_that.otpStatus);case _:
return $default(_that.accessToken,_that.expiresIn,_that.scope,_that.expireTime,_that.mobile,_that.fullname,_that.firstname,_that.lastname,_that.city,_that.province,_that.nationalCode,_that.nationalId,_that.birthday,_that.image,_that.baseOrder,_that.role);case _:
return null;
}
@@ -211,12 +224,33 @@ return $default(_that.refresh,_that.access,_that.otpStatus);case _:
@JsonSerializable()
class _AuthResponseModel implements AuthResponseModel {
const _AuthResponseModel({this.refresh, this.access, this.otpStatus});
const _AuthResponseModel({this.accessToken, this.expiresIn, this.scope, this.expireTime, this.mobile, this.fullname, this.firstname, this.lastname, this.city, this.province, this.nationalCode, this.nationalId, this.birthday, this.image, this.baseOrder, final List<String>? role}): _role = role;
factory _AuthResponseModel.fromJson(Map<String, dynamic> json) => _$AuthResponseModelFromJson(json);
@override final String? refresh;
@override final String? access;
@override final bool? otpStatus;
@override final String? accessToken;
@override final String? expiresIn;
@override final String? scope;
@override final String? expireTime;
@override final String? mobile;
@override final String? fullname;
@override final String? firstname;
@override final String? lastname;
@override final String? city;
@override final String? province;
@override final String? nationalCode;
@override final String? nationalId;
@override final String? birthday;
@override final String? image;
@override final int? baseOrder;
final List<String>? _role;
@override List<String>? get role {
final value = _role;
if (value == null) return null;
if (_role is EqualUnmodifiableListView) return _role;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(value);
}
/// Create a copy of AuthResponseModel
/// with the given fields replaced by the non-null parameter values.
@@ -231,16 +265,16 @@ Map<String, dynamic> toJson() {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AuthResponseModel&&(identical(other.refresh, refresh) || other.refresh == refresh)&&(identical(other.access, access) || other.access == access)&&(identical(other.otpStatus, otpStatus) || other.otpStatus == otpStatus));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AuthResponseModel&&(identical(other.accessToken, accessToken) || other.accessToken == accessToken)&&(identical(other.expiresIn, expiresIn) || other.expiresIn == expiresIn)&&(identical(other.scope, scope) || other.scope == scope)&&(identical(other.expireTime, expireTime) || other.expireTime == expireTime)&&(identical(other.mobile, mobile) || other.mobile == mobile)&&(identical(other.fullname, fullname) || other.fullname == fullname)&&(identical(other.firstname, firstname) || other.firstname == firstname)&&(identical(other.lastname, lastname) || other.lastname == lastname)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.nationalCode, nationalCode) || other.nationalCode == nationalCode)&&(identical(other.nationalId, nationalId) || other.nationalId == nationalId)&&(identical(other.birthday, birthday) || other.birthday == birthday)&&(identical(other.image, image) || other.image == image)&&(identical(other.baseOrder, baseOrder) || other.baseOrder == baseOrder)&&const DeepCollectionEquality().equals(other._role, _role));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,refresh,access,otpStatus);
int get hashCode => Object.hash(runtimeType,accessToken,expiresIn,scope,expireTime,mobile,fullname,firstname,lastname,city,province,nationalCode,nationalId,birthday,image,baseOrder,const DeepCollectionEquality().hash(_role));
@override
String toString() {
return 'AuthResponseModel(refresh: $refresh, access: $access, otpStatus: $otpStatus)';
return 'AuthResponseModel(accessToken: $accessToken, expiresIn: $expiresIn, scope: $scope, expireTime: $expireTime, mobile: $mobile, fullname: $fullname, firstname: $firstname, lastname: $lastname, city: $city, province: $province, nationalCode: $nationalCode, nationalId: $nationalId, birthday: $birthday, image: $image, baseOrder: $baseOrder, role: $role)';
}
@@ -251,7 +285,7 @@ abstract mixin class _$AuthResponseModelCopyWith<$Res> implements $AuthResponseM
factory _$AuthResponseModelCopyWith(_AuthResponseModel value, $Res Function(_AuthResponseModel) _then) = __$AuthResponseModelCopyWithImpl;
@override @useResult
$Res call({
String? refresh, String? access, bool? otpStatus
String? accessToken, String? expiresIn, String? scope, String? expireTime, String? mobile, String? fullname, String? firstname, String? lastname, String? city, String? province, String? nationalCode, String? nationalId, String? birthday, String? image, int? baseOrder, List<String>? role
});
@@ -268,12 +302,25 @@ class __$AuthResponseModelCopyWithImpl<$Res>
/// Create a copy of AuthResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? refresh = freezed,Object? access = freezed,Object? otpStatus = freezed,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? accessToken = freezed,Object? expiresIn = freezed,Object? scope = freezed,Object? expireTime = freezed,Object? mobile = freezed,Object? fullname = freezed,Object? firstname = freezed,Object? lastname = freezed,Object? city = freezed,Object? province = freezed,Object? nationalCode = freezed,Object? nationalId = freezed,Object? birthday = freezed,Object? image = freezed,Object? baseOrder = freezed,Object? role = freezed,}) {
return _then(_AuthResponseModel(
refresh: freezed == refresh ? _self.refresh : refresh // ignore: cast_nullable_to_non_nullable
as String?,access: freezed == access ? _self.access : access // ignore: cast_nullable_to_non_nullable
as String?,otpStatus: freezed == otpStatus ? _self.otpStatus : otpStatus // ignore: cast_nullable_to_non_nullable
as bool?,
accessToken: freezed == accessToken ? _self.accessToken : accessToken // ignore: cast_nullable_to_non_nullable
as String?,expiresIn: freezed == expiresIn ? _self.expiresIn : expiresIn // ignore: cast_nullable_to_non_nullable
as String?,scope: freezed == scope ? _self.scope : scope // ignore: cast_nullable_to_non_nullable
as String?,expireTime: freezed == expireTime ? _self.expireTime : expireTime // ignore: cast_nullable_to_non_nullable
as String?,mobile: freezed == mobile ? _self.mobile : mobile // ignore: cast_nullable_to_non_nullable
as String?,fullname: freezed == fullname ? _self.fullname : fullname // ignore: cast_nullable_to_non_nullable
as String?,firstname: freezed == firstname ? _self.firstname : firstname // ignore: cast_nullable_to_non_nullable
as String?,lastname: freezed == lastname ? _self.lastname : lastname // ignore: cast_nullable_to_non_nullable
as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
as String?,province: freezed == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
as String?,nationalCode: freezed == nationalCode ? _self.nationalCode : nationalCode // ignore: cast_nullable_to_non_nullable
as String?,nationalId: freezed == nationalId ? _self.nationalId : nationalId // ignore: cast_nullable_to_non_nullable
as String?,birthday: freezed == birthday ? _self.birthday : birthday // ignore: cast_nullable_to_non_nullable
as String?,image: freezed == image ? _self.image : image // ignore: cast_nullable_to_non_nullable
as String?,baseOrder: freezed == baseOrder ? _self.baseOrder : baseOrder // ignore: cast_nullable_to_non_nullable
as int?,role: freezed == role ? _self._role : role // ignore: cast_nullable_to_non_nullable
as List<String>?,
));
}

View File

@@ -8,14 +8,40 @@ part of 'auth_response_model.dart';
_AuthResponseModel _$AuthResponseModelFromJson(Map<String, dynamic> json) =>
_AuthResponseModel(
refresh: json['refresh'] as String?,
access: json['access'] as String?,
otpStatus: json['otp_status'] as bool?,
accessToken: json['access_token'] as String?,
expiresIn: json['expires_in'] as String?,
scope: json['scope'] as String?,
expireTime: json['expire_time'] as String?,
mobile: json['mobile'] as String?,
fullname: json['fullname'] as String?,
firstname: json['firstname'] as String?,
lastname: json['lastname'] as String?,
city: json['city'] as String?,
province: json['province'] as String?,
nationalCode: json['national_code'] as String?,
nationalId: json['national_id'] as String?,
birthday: json['birthday'] as String?,
image: json['image'] as String?,
baseOrder: (json['base_order'] as num?)?.toInt(),
role: (json['role'] as List<dynamic>?)?.map((e) => e as String).toList(),
);
Map<String, dynamic> _$AuthResponseModelToJson(_AuthResponseModel instance) =>
<String, dynamic>{
'refresh': instance.refresh,
'access': instance.access,
'otp_status': instance.otpStatus,
'access_token': instance.accessToken,
'expires_in': instance.expiresIn,
'scope': instance.scope,
'expire_time': instance.expireTime,
'mobile': instance.mobile,
'fullname': instance.fullname,
'firstname': instance.firstname,
'lastname': instance.lastname,
'city': instance.city,
'province': instance.province,
'national_code': instance.nationalCode,
'national_id': instance.nationalId,
'birthday': instance.birthday,
'image': instance.image,
'base_order': instance.baseOrder,
'role': instance.role,
};