feat : profile with logic

This commit is contained in:
2025-07-08 16:06:10 +03:30
parent a9b012b016
commit 146ea28e77
17 changed files with 1531 additions and 61 deletions

4
assets/icons/lock.svg Normal file
View File

@@ -0,0 +1,4 @@
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M19.9999 28.9167C21.5002 28.9167 22.7165 27.7004 22.7165 26.2001C22.7165 24.6997 21.5002 23.4834 19.9999 23.4834C18.4995 23.4834 17.2832 24.6997 17.2832 26.2001C17.2832 27.7004 18.4995 28.9167 19.9999 28.9167Z" fill="#2D5FFF"/>
<path d="M30.4668 15.883V13.7997C30.4668 9.29967 29.3835 3.33301 20.0002 3.33301C10.6168 3.33301 9.5335 9.29967 9.5335 13.7997V15.883C4.86683 16.4663 3.3335 18.833 3.3335 24.6497V27.7497C3.3335 34.583 5.41683 36.6663 12.2502 36.6663H27.7502C34.5835 36.6663 36.6668 34.583 36.6668 27.7497V24.6497C36.6668 18.833 35.1335 16.4663 30.4668 15.883ZM20.0002 31.233C17.2168 31.233 14.9668 28.9663 14.9668 26.1997C14.9668 23.4163 17.2335 21.1663 20.0002 21.1663C22.7668 21.1663 25.0335 23.433 25.0335 26.1997C25.0335 28.983 22.7835 31.233 20.0002 31.233ZM12.2502 15.733C12.1168 15.733 12.0002 15.733 11.8668 15.733V13.7997C11.8668 8.91634 13.2502 5.66634 20.0002 5.66634C26.7502 5.66634 28.1335 8.91634 28.1335 13.7997V15.7497C28.0002 15.7497 27.8835 15.7497 27.7502 15.7497H12.2502V15.733Z" fill="#2D5FFF"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
assets/vec/lock.svg.vec Normal file

Binary file not shown.

View File

@@ -0,0 +1,18 @@
import 'package:rasadyar_core/core.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'change_password_request_model.freezed.dart';
part 'change_password_request_model.g.dart';
@freezed
abstract class ChangePasswordRequestModel with _$ChangePasswordRequestModel {
const factory ChangePasswordRequestModel({
String? username,
String? password,
}) = _ChangePasswordRequestModel;
factory ChangePasswordRequestModel.fromJson(Map<String, dynamic> json) =>
_$ChangePasswordRequestModelFromJson(json);
}

View File

@@ -0,0 +1,151 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'change_password_request_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$ChangePasswordRequestModel {
String? get username; String? get password;
/// Create a copy of ChangePasswordRequestModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ChangePasswordRequestModelCopyWith<ChangePasswordRequestModel> get copyWith => _$ChangePasswordRequestModelCopyWithImpl<ChangePasswordRequestModel>(this as ChangePasswordRequestModel, _$identity);
/// Serializes this ChangePasswordRequestModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is ChangePasswordRequestModel&&(identical(other.username, username) || other.username == username)&&(identical(other.password, password) || other.password == password));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,username,password);
@override
String toString() {
return 'ChangePasswordRequestModel(username: $username, password: $password)';
}
}
/// @nodoc
abstract mixin class $ChangePasswordRequestModelCopyWith<$Res> {
factory $ChangePasswordRequestModelCopyWith(ChangePasswordRequestModel value, $Res Function(ChangePasswordRequestModel) _then) = _$ChangePasswordRequestModelCopyWithImpl;
@useResult
$Res call({
String? username, String? password
});
}
/// @nodoc
class _$ChangePasswordRequestModelCopyWithImpl<$Res>
implements $ChangePasswordRequestModelCopyWith<$Res> {
_$ChangePasswordRequestModelCopyWithImpl(this._self, this._then);
final ChangePasswordRequestModel _self;
final $Res Function(ChangePasswordRequestModel) _then;
/// Create a copy of ChangePasswordRequestModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? username = freezed,Object? password = freezed,}) {
return _then(_self.copyWith(
username: freezed == username ? _self.username : username // ignore: cast_nullable_to_non_nullable
as String?,password: freezed == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
@JsonSerializable()
class _ChangePasswordRequestModel implements ChangePasswordRequestModel {
const _ChangePasswordRequestModel({this.username, this.password});
factory _ChangePasswordRequestModel.fromJson(Map<String, dynamic> json) => _$ChangePasswordRequestModelFromJson(json);
@override final String? username;
@override final String? password;
/// Create a copy of ChangePasswordRequestModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$ChangePasswordRequestModelCopyWith<_ChangePasswordRequestModel> get copyWith => __$ChangePasswordRequestModelCopyWithImpl<_ChangePasswordRequestModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$ChangePasswordRequestModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChangePasswordRequestModel&&(identical(other.username, username) || other.username == username)&&(identical(other.password, password) || other.password == password));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,username,password);
@override
String toString() {
return 'ChangePasswordRequestModel(username: $username, password: $password)';
}
}
/// @nodoc
abstract mixin class _$ChangePasswordRequestModelCopyWith<$Res> implements $ChangePasswordRequestModelCopyWith<$Res> {
factory _$ChangePasswordRequestModelCopyWith(_ChangePasswordRequestModel value, $Res Function(_ChangePasswordRequestModel) _then) = __$ChangePasswordRequestModelCopyWithImpl;
@override @useResult
$Res call({
String? username, String? password
});
}
/// @nodoc
class __$ChangePasswordRequestModelCopyWithImpl<$Res>
implements _$ChangePasswordRequestModelCopyWith<$Res> {
__$ChangePasswordRequestModelCopyWithImpl(this._self, this._then);
final _ChangePasswordRequestModel _self;
final $Res Function(_ChangePasswordRequestModel) _then;
/// Create a copy of ChangePasswordRequestModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? username = freezed,Object? password = freezed,}) {
return _then(_ChangePasswordRequestModel(
username: freezed == username ? _self.username : username // ignore: cast_nullable_to_non_nullable
as String?,password: freezed == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
// dart format on

View File

@@ -0,0 +1,21 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'change_password_request_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_ChangePasswordRequestModel _$ChangePasswordRequestModelFromJson(
Map<String, dynamic> json,
) => _ChangePasswordRequestModel(
username: json['username'] as String?,
password: json['password'] as String?,
);
Map<String, dynamic> _$ChangePasswordRequestModelToJson(
_ChangePasswordRequestModel instance,
) => <String, dynamic>{
'username': instance.username,
'password': instance.password,
};

View File

@@ -0,0 +1,65 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'user_profile.freezed.dart';
part 'user_profile.g.dart';
@freezed
abstract class UserProfile with _$UserProfile {
const factory UserProfile({
List<String>? role,
String? city,
String? province,
String? key,
String? userGateWayId,
dynamic userDjangoIdForeignKey,
dynamic provinceIdForeignKey,
dynamic cityIdForeignKey,
dynamic systemUserProfileIdKey,
String? fullname,
String? firstName,
String? lastName,
String? nationalCode,
String? nationalCodeImage,
String? nationalId,
String? mobile,
String? birthday,
String? image,
String? password,
bool? active,
UserState? state,
int? baseOrder,
int? cityNumber,
String? cityName,
int? provinceNumber,
String? provinceName,
String? unitName,
String? unitNationalId,
String? unitRegistrationNumber,
String? unitEconomicalNumber,
String? unitProvince,
String? unitCity,
String? unitPostalCode,
String? unitAddress,
String? personType,
String? type,
}) = _UserProfile;
factory UserProfile.fromJson(Map<String, dynamic> json) => _$UserProfileFromJson(json);
}
@freezed
abstract class UserState with _$UserState {
const factory UserState({
String? city,
String? image,
String? mobile,
String? birthday,
String? province,
String? lastName,
String? firstName,
String? nationalId,
String? nationalCode,
}) = _UserState;
factory UserState.fromJson(Map<String, dynamic> json) => _$UserStateFromJson(json);
}

View File

@@ -0,0 +1,442 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'user_profile.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$UserProfile {
List<String>? get role; String? get city; String? get province; String? get key; String? get userGateWayId; dynamic get userDjangoIdForeignKey; dynamic get provinceIdForeignKey; dynamic get cityIdForeignKey; dynamic get systemUserProfileIdKey; String? get fullname; String? get firstName; String? get lastName; String? get nationalCode; String? get nationalCodeImage; String? get nationalId; String? get mobile; String? get birthday; String? get image; String? get password; bool? get active; UserState? get state; int? get baseOrder; int? get cityNumber; String? get cityName; int? get provinceNumber; String? get provinceName; String? get unitName; String? get unitNationalId; String? get unitRegistrationNumber; String? get unitEconomicalNumber; String? get unitProvince; String? get unitCity; String? get unitPostalCode; String? get unitAddress; String? get personType; String? get type;
/// Create a copy of UserProfile
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$UserProfileCopyWith<UserProfile> get copyWith => _$UserProfileCopyWithImpl<UserProfile>(this as UserProfile, _$identity);
/// Serializes this UserProfile to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is UserProfile&&const DeepCollectionEquality().equals(other.role, role)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.key, key) || other.key == key)&&(identical(other.userGateWayId, userGateWayId) || other.userGateWayId == userGateWayId)&&const DeepCollectionEquality().equals(other.userDjangoIdForeignKey, userDjangoIdForeignKey)&&const DeepCollectionEquality().equals(other.provinceIdForeignKey, provinceIdForeignKey)&&const DeepCollectionEquality().equals(other.cityIdForeignKey, cityIdForeignKey)&&const DeepCollectionEquality().equals(other.systemUserProfileIdKey, systemUserProfileIdKey)&&(identical(other.fullname, fullname) || other.fullname == fullname)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.nationalCode, nationalCode) || other.nationalCode == nationalCode)&&(identical(other.nationalCodeImage, nationalCodeImage) || other.nationalCodeImage == nationalCodeImage)&&(identical(other.nationalId, nationalId) || other.nationalId == nationalId)&&(identical(other.mobile, mobile) || other.mobile == mobile)&&(identical(other.birthday, birthday) || other.birthday == birthday)&&(identical(other.image, image) || other.image == image)&&(identical(other.password, password) || other.password == password)&&(identical(other.active, active) || other.active == active)&&(identical(other.state, state) || other.state == state)&&(identical(other.baseOrder, baseOrder) || other.baseOrder == baseOrder)&&(identical(other.cityNumber, cityNumber) || other.cityNumber == cityNumber)&&(identical(other.cityName, cityName) || other.cityName == cityName)&&(identical(other.provinceNumber, provinceNumber) || other.provinceNumber == provinceNumber)&&(identical(other.provinceName, provinceName) || other.provinceName == provinceName)&&(identical(other.unitName, unitName) || other.unitName == unitName)&&(identical(other.unitNationalId, unitNationalId) || other.unitNationalId == unitNationalId)&&(identical(other.unitRegistrationNumber, unitRegistrationNumber) || other.unitRegistrationNumber == unitRegistrationNumber)&&(identical(other.unitEconomicalNumber, unitEconomicalNumber) || other.unitEconomicalNumber == unitEconomicalNumber)&&(identical(other.unitProvince, unitProvince) || other.unitProvince == unitProvince)&&(identical(other.unitCity, unitCity) || other.unitCity == unitCity)&&(identical(other.unitPostalCode, unitPostalCode) || other.unitPostalCode == unitPostalCode)&&(identical(other.unitAddress, unitAddress) || other.unitAddress == unitAddress)&&(identical(other.personType, personType) || other.personType == personType)&&(identical(other.type, type) || other.type == type));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hashAll([runtimeType,const DeepCollectionEquality().hash(role),city,province,key,userGateWayId,const DeepCollectionEquality().hash(userDjangoIdForeignKey),const DeepCollectionEquality().hash(provinceIdForeignKey),const DeepCollectionEquality().hash(cityIdForeignKey),const DeepCollectionEquality().hash(systemUserProfileIdKey),fullname,firstName,lastName,nationalCode,nationalCodeImage,nationalId,mobile,birthday,image,password,active,state,baseOrder,cityNumber,cityName,provinceNumber,provinceName,unitName,unitNationalId,unitRegistrationNumber,unitEconomicalNumber,unitProvince,unitCity,unitPostalCode,unitAddress,personType,type]);
@override
String toString() {
return 'UserProfile(role: $role, city: $city, province: $province, key: $key, userGateWayId: $userGateWayId, userDjangoIdForeignKey: $userDjangoIdForeignKey, provinceIdForeignKey: $provinceIdForeignKey, cityIdForeignKey: $cityIdForeignKey, systemUserProfileIdKey: $systemUserProfileIdKey, fullname: $fullname, firstName: $firstName, lastName: $lastName, nationalCode: $nationalCode, nationalCodeImage: $nationalCodeImage, nationalId: $nationalId, mobile: $mobile, birthday: $birthday, image: $image, password: $password, active: $active, state: $state, baseOrder: $baseOrder, cityNumber: $cityNumber, cityName: $cityName, provinceNumber: $provinceNumber, provinceName: $provinceName, unitName: $unitName, unitNationalId: $unitNationalId, unitRegistrationNumber: $unitRegistrationNumber, unitEconomicalNumber: $unitEconomicalNumber, unitProvince: $unitProvince, unitCity: $unitCity, unitPostalCode: $unitPostalCode, unitAddress: $unitAddress, personType: $personType, type: $type)';
}
}
/// @nodoc
abstract mixin class $UserProfileCopyWith<$Res> {
factory $UserProfileCopyWith(UserProfile value, $Res Function(UserProfile) _then) = _$UserProfileCopyWithImpl;
@useResult
$Res call({
List<String>? role, String? city, String? province, String? key, String? userGateWayId, dynamic userDjangoIdForeignKey, dynamic provinceIdForeignKey, dynamic cityIdForeignKey, dynamic systemUserProfileIdKey, String? fullname, String? firstName, String? lastName, String? nationalCode, String? nationalCodeImage, String? nationalId, String? mobile, String? birthday, String? image, String? password, bool? active, UserState? state, int? baseOrder, int? cityNumber, String? cityName, int? provinceNumber, String? provinceName, String? unitName, String? unitNationalId, String? unitRegistrationNumber, String? unitEconomicalNumber, String? unitProvince, String? unitCity, String? unitPostalCode, String? unitAddress, String? personType, String? type
});
$UserStateCopyWith<$Res>? get state;
}
/// @nodoc
class _$UserProfileCopyWithImpl<$Res>
implements $UserProfileCopyWith<$Res> {
_$UserProfileCopyWithImpl(this._self, this._then);
final UserProfile _self;
final $Res Function(UserProfile) _then;
/// Create a copy of UserProfile
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? role = freezed,Object? city = freezed,Object? province = freezed,Object? key = freezed,Object? userGateWayId = freezed,Object? userDjangoIdForeignKey = freezed,Object? provinceIdForeignKey = freezed,Object? cityIdForeignKey = freezed,Object? systemUserProfileIdKey = freezed,Object? fullname = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? nationalCode = freezed,Object? nationalCodeImage = freezed,Object? nationalId = freezed,Object? mobile = freezed,Object? birthday = freezed,Object? image = freezed,Object? password = freezed,Object? active = freezed,Object? state = freezed,Object? baseOrder = freezed,Object? cityNumber = freezed,Object? cityName = freezed,Object? provinceNumber = freezed,Object? provinceName = freezed,Object? unitName = freezed,Object? unitNationalId = freezed,Object? unitRegistrationNumber = freezed,Object? unitEconomicalNumber = freezed,Object? unitProvince = freezed,Object? unitCity = freezed,Object? unitPostalCode = freezed,Object? unitAddress = freezed,Object? personType = freezed,Object? type = freezed,}) {
return _then(_self.copyWith(
role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
as List<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?,key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,userGateWayId: freezed == userGateWayId ? _self.userGateWayId : userGateWayId // ignore: cast_nullable_to_non_nullable
as String?,userDjangoIdForeignKey: freezed == userDjangoIdForeignKey ? _self.userDjangoIdForeignKey : userDjangoIdForeignKey // ignore: cast_nullable_to_non_nullable
as dynamic,provinceIdForeignKey: freezed == provinceIdForeignKey ? _self.provinceIdForeignKey : provinceIdForeignKey // ignore: cast_nullable_to_non_nullable
as dynamic,cityIdForeignKey: freezed == cityIdForeignKey ? _self.cityIdForeignKey : cityIdForeignKey // ignore: cast_nullable_to_non_nullable
as dynamic,systemUserProfileIdKey: freezed == systemUserProfileIdKey ? _self.systemUserProfileIdKey : systemUserProfileIdKey // ignore: cast_nullable_to_non_nullable
as dynamic,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?,nationalCode: freezed == nationalCode ? _self.nationalCode : nationalCode // ignore: cast_nullable_to_non_nullable
as String?,nationalCodeImage: freezed == nationalCodeImage ? _self.nationalCodeImage : nationalCodeImage // ignore: cast_nullable_to_non_nullable
as String?,nationalId: freezed == nationalId ? _self.nationalId : nationalId // ignore: cast_nullable_to_non_nullable
as String?,mobile: freezed == mobile ? _self.mobile : mobile // 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?,password: freezed == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
as String?,active: freezed == active ? _self.active : active // ignore: cast_nullable_to_non_nullable
as bool?,state: freezed == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
as UserState?,baseOrder: freezed == baseOrder ? _self.baseOrder : baseOrder // ignore: cast_nullable_to_non_nullable
as int?,cityNumber: freezed == cityNumber ? _self.cityNumber : cityNumber // ignore: cast_nullable_to_non_nullable
as int?,cityName: freezed == cityName ? _self.cityName : cityName // ignore: cast_nullable_to_non_nullable
as String?,provinceNumber: freezed == provinceNumber ? _self.provinceNumber : provinceNumber // ignore: cast_nullable_to_non_nullable
as int?,provinceName: freezed == provinceName ? _self.provinceName : provinceName // ignore: cast_nullable_to_non_nullable
as String?,unitName: freezed == unitName ? _self.unitName : unitName // ignore: cast_nullable_to_non_nullable
as String?,unitNationalId: freezed == unitNationalId ? _self.unitNationalId : unitNationalId // ignore: cast_nullable_to_non_nullable
as String?,unitRegistrationNumber: freezed == unitRegistrationNumber ? _self.unitRegistrationNumber : unitRegistrationNumber // ignore: cast_nullable_to_non_nullable
as String?,unitEconomicalNumber: freezed == unitEconomicalNumber ? _self.unitEconomicalNumber : unitEconomicalNumber // ignore: cast_nullable_to_non_nullable
as String?,unitProvince: freezed == unitProvince ? _self.unitProvince : unitProvince // ignore: cast_nullable_to_non_nullable
as String?,unitCity: freezed == unitCity ? _self.unitCity : unitCity // ignore: cast_nullable_to_non_nullable
as String?,unitPostalCode: freezed == unitPostalCode ? _self.unitPostalCode : unitPostalCode // ignore: cast_nullable_to_non_nullable
as String?,unitAddress: freezed == unitAddress ? _self.unitAddress : unitAddress // ignore: cast_nullable_to_non_nullable
as String?,personType: freezed == personType ? _self.personType : personType // ignore: cast_nullable_to_non_nullable
as String?,type: freezed == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
as String?,
));
}
/// Create a copy of UserProfile
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UserStateCopyWith<$Res>? get state {
if (_self.state == null) {
return null;
}
return $UserStateCopyWith<$Res>(_self.state!, (value) {
return _then(_self.copyWith(state: value));
});
}
}
/// @nodoc
@JsonSerializable()
class _UserProfile implements UserProfile {
const _UserProfile({final List<String>? role, this.city, this.province, this.key, this.userGateWayId, this.userDjangoIdForeignKey, this.provinceIdForeignKey, this.cityIdForeignKey, this.systemUserProfileIdKey, this.fullname, this.firstName, this.lastName, this.nationalCode, this.nationalCodeImage, this.nationalId, this.mobile, this.birthday, this.image, this.password, this.active, this.state, this.baseOrder, this.cityNumber, this.cityName, this.provinceNumber, this.provinceName, this.unitName, this.unitNationalId, this.unitRegistrationNumber, this.unitEconomicalNumber, this.unitProvince, this.unitCity, this.unitPostalCode, this.unitAddress, this.personType, this.type}): _role = role;
factory _UserProfile.fromJson(Map<String, dynamic> json) => _$UserProfileFromJson(json);
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);
}
@override final String? city;
@override final String? province;
@override final String? key;
@override final String? userGateWayId;
@override final dynamic userDjangoIdForeignKey;
@override final dynamic provinceIdForeignKey;
@override final dynamic cityIdForeignKey;
@override final dynamic systemUserProfileIdKey;
@override final String? fullname;
@override final String? firstName;
@override final String? lastName;
@override final String? nationalCode;
@override final String? nationalCodeImage;
@override final String? nationalId;
@override final String? mobile;
@override final String? birthday;
@override final String? image;
@override final String? password;
@override final bool? active;
@override final UserState? state;
@override final int? baseOrder;
@override final int? cityNumber;
@override final String? cityName;
@override final int? provinceNumber;
@override final String? provinceName;
@override final String? unitName;
@override final String? unitNationalId;
@override final String? unitRegistrationNumber;
@override final String? unitEconomicalNumber;
@override final String? unitProvince;
@override final String? unitCity;
@override final String? unitPostalCode;
@override final String? unitAddress;
@override final String? personType;
@override final String? type;
/// Create a copy of UserProfile
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$UserProfileCopyWith<_UserProfile> get copyWith => __$UserProfileCopyWithImpl<_UserProfile>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$UserProfileToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UserProfile&&const DeepCollectionEquality().equals(other._role, _role)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.key, key) || other.key == key)&&(identical(other.userGateWayId, userGateWayId) || other.userGateWayId == userGateWayId)&&const DeepCollectionEquality().equals(other.userDjangoIdForeignKey, userDjangoIdForeignKey)&&const DeepCollectionEquality().equals(other.provinceIdForeignKey, provinceIdForeignKey)&&const DeepCollectionEquality().equals(other.cityIdForeignKey, cityIdForeignKey)&&const DeepCollectionEquality().equals(other.systemUserProfileIdKey, systemUserProfileIdKey)&&(identical(other.fullname, fullname) || other.fullname == fullname)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.nationalCode, nationalCode) || other.nationalCode == nationalCode)&&(identical(other.nationalCodeImage, nationalCodeImage) || other.nationalCodeImage == nationalCodeImage)&&(identical(other.nationalId, nationalId) || other.nationalId == nationalId)&&(identical(other.mobile, mobile) || other.mobile == mobile)&&(identical(other.birthday, birthday) || other.birthday == birthday)&&(identical(other.image, image) || other.image == image)&&(identical(other.password, password) || other.password == password)&&(identical(other.active, active) || other.active == active)&&(identical(other.state, state) || other.state == state)&&(identical(other.baseOrder, baseOrder) || other.baseOrder == baseOrder)&&(identical(other.cityNumber, cityNumber) || other.cityNumber == cityNumber)&&(identical(other.cityName, cityName) || other.cityName == cityName)&&(identical(other.provinceNumber, provinceNumber) || other.provinceNumber == provinceNumber)&&(identical(other.provinceName, provinceName) || other.provinceName == provinceName)&&(identical(other.unitName, unitName) || other.unitName == unitName)&&(identical(other.unitNationalId, unitNationalId) || other.unitNationalId == unitNationalId)&&(identical(other.unitRegistrationNumber, unitRegistrationNumber) || other.unitRegistrationNumber == unitRegistrationNumber)&&(identical(other.unitEconomicalNumber, unitEconomicalNumber) || other.unitEconomicalNumber == unitEconomicalNumber)&&(identical(other.unitProvince, unitProvince) || other.unitProvince == unitProvince)&&(identical(other.unitCity, unitCity) || other.unitCity == unitCity)&&(identical(other.unitPostalCode, unitPostalCode) || other.unitPostalCode == unitPostalCode)&&(identical(other.unitAddress, unitAddress) || other.unitAddress == unitAddress)&&(identical(other.personType, personType) || other.personType == personType)&&(identical(other.type, type) || other.type == type));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hashAll([runtimeType,const DeepCollectionEquality().hash(_role),city,province,key,userGateWayId,const DeepCollectionEquality().hash(userDjangoIdForeignKey),const DeepCollectionEquality().hash(provinceIdForeignKey),const DeepCollectionEquality().hash(cityIdForeignKey),const DeepCollectionEquality().hash(systemUserProfileIdKey),fullname,firstName,lastName,nationalCode,nationalCodeImage,nationalId,mobile,birthday,image,password,active,state,baseOrder,cityNumber,cityName,provinceNumber,provinceName,unitName,unitNationalId,unitRegistrationNumber,unitEconomicalNumber,unitProvince,unitCity,unitPostalCode,unitAddress,personType,type]);
@override
String toString() {
return 'UserProfile(role: $role, city: $city, province: $province, key: $key, userGateWayId: $userGateWayId, userDjangoIdForeignKey: $userDjangoIdForeignKey, provinceIdForeignKey: $provinceIdForeignKey, cityIdForeignKey: $cityIdForeignKey, systemUserProfileIdKey: $systemUserProfileIdKey, fullname: $fullname, firstName: $firstName, lastName: $lastName, nationalCode: $nationalCode, nationalCodeImage: $nationalCodeImage, nationalId: $nationalId, mobile: $mobile, birthday: $birthday, image: $image, password: $password, active: $active, state: $state, baseOrder: $baseOrder, cityNumber: $cityNumber, cityName: $cityName, provinceNumber: $provinceNumber, provinceName: $provinceName, unitName: $unitName, unitNationalId: $unitNationalId, unitRegistrationNumber: $unitRegistrationNumber, unitEconomicalNumber: $unitEconomicalNumber, unitProvince: $unitProvince, unitCity: $unitCity, unitPostalCode: $unitPostalCode, unitAddress: $unitAddress, personType: $personType, type: $type)';
}
}
/// @nodoc
abstract mixin class _$UserProfileCopyWith<$Res> implements $UserProfileCopyWith<$Res> {
factory _$UserProfileCopyWith(_UserProfile value, $Res Function(_UserProfile) _then) = __$UserProfileCopyWithImpl;
@override @useResult
$Res call({
List<String>? role, String? city, String? province, String? key, String? userGateWayId, dynamic userDjangoIdForeignKey, dynamic provinceIdForeignKey, dynamic cityIdForeignKey, dynamic systemUserProfileIdKey, String? fullname, String? firstName, String? lastName, String? nationalCode, String? nationalCodeImage, String? nationalId, String? mobile, String? birthday, String? image, String? password, bool? active, UserState? state, int? baseOrder, int? cityNumber, String? cityName, int? provinceNumber, String? provinceName, String? unitName, String? unitNationalId, String? unitRegistrationNumber, String? unitEconomicalNumber, String? unitProvince, String? unitCity, String? unitPostalCode, String? unitAddress, String? personType, String? type
});
@override $UserStateCopyWith<$Res>? get state;
}
/// @nodoc
class __$UserProfileCopyWithImpl<$Res>
implements _$UserProfileCopyWith<$Res> {
__$UserProfileCopyWithImpl(this._self, this._then);
final _UserProfile _self;
final $Res Function(_UserProfile) _then;
/// Create a copy of UserProfile
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? role = freezed,Object? city = freezed,Object? province = freezed,Object? key = freezed,Object? userGateWayId = freezed,Object? userDjangoIdForeignKey = freezed,Object? provinceIdForeignKey = freezed,Object? cityIdForeignKey = freezed,Object? systemUserProfileIdKey = freezed,Object? fullname = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? nationalCode = freezed,Object? nationalCodeImage = freezed,Object? nationalId = freezed,Object? mobile = freezed,Object? birthday = freezed,Object? image = freezed,Object? password = freezed,Object? active = freezed,Object? state = freezed,Object? baseOrder = freezed,Object? cityNumber = freezed,Object? cityName = freezed,Object? provinceNumber = freezed,Object? provinceName = freezed,Object? unitName = freezed,Object? unitNationalId = freezed,Object? unitRegistrationNumber = freezed,Object? unitEconomicalNumber = freezed,Object? unitProvince = freezed,Object? unitCity = freezed,Object? unitPostalCode = freezed,Object? unitAddress = freezed,Object? personType = freezed,Object? type = freezed,}) {
return _then(_UserProfile(
role: freezed == role ? _self._role : role // ignore: cast_nullable_to_non_nullable
as List<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?,key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,userGateWayId: freezed == userGateWayId ? _self.userGateWayId : userGateWayId // ignore: cast_nullable_to_non_nullable
as String?,userDjangoIdForeignKey: freezed == userDjangoIdForeignKey ? _self.userDjangoIdForeignKey : userDjangoIdForeignKey // ignore: cast_nullable_to_non_nullable
as dynamic,provinceIdForeignKey: freezed == provinceIdForeignKey ? _self.provinceIdForeignKey : provinceIdForeignKey // ignore: cast_nullable_to_non_nullable
as dynamic,cityIdForeignKey: freezed == cityIdForeignKey ? _self.cityIdForeignKey : cityIdForeignKey // ignore: cast_nullable_to_non_nullable
as dynamic,systemUserProfileIdKey: freezed == systemUserProfileIdKey ? _self.systemUserProfileIdKey : systemUserProfileIdKey // ignore: cast_nullable_to_non_nullable
as dynamic,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?,nationalCode: freezed == nationalCode ? _self.nationalCode : nationalCode // ignore: cast_nullable_to_non_nullable
as String?,nationalCodeImage: freezed == nationalCodeImage ? _self.nationalCodeImage : nationalCodeImage // ignore: cast_nullable_to_non_nullable
as String?,nationalId: freezed == nationalId ? _self.nationalId : nationalId // ignore: cast_nullable_to_non_nullable
as String?,mobile: freezed == mobile ? _self.mobile : mobile // 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?,password: freezed == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
as String?,active: freezed == active ? _self.active : active // ignore: cast_nullable_to_non_nullable
as bool?,state: freezed == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
as UserState?,baseOrder: freezed == baseOrder ? _self.baseOrder : baseOrder // ignore: cast_nullable_to_non_nullable
as int?,cityNumber: freezed == cityNumber ? _self.cityNumber : cityNumber // ignore: cast_nullable_to_non_nullable
as int?,cityName: freezed == cityName ? _self.cityName : cityName // ignore: cast_nullable_to_non_nullable
as String?,provinceNumber: freezed == provinceNumber ? _self.provinceNumber : provinceNumber // ignore: cast_nullable_to_non_nullable
as int?,provinceName: freezed == provinceName ? _self.provinceName : provinceName // ignore: cast_nullable_to_non_nullable
as String?,unitName: freezed == unitName ? _self.unitName : unitName // ignore: cast_nullable_to_non_nullable
as String?,unitNationalId: freezed == unitNationalId ? _self.unitNationalId : unitNationalId // ignore: cast_nullable_to_non_nullable
as String?,unitRegistrationNumber: freezed == unitRegistrationNumber ? _self.unitRegistrationNumber : unitRegistrationNumber // ignore: cast_nullable_to_non_nullable
as String?,unitEconomicalNumber: freezed == unitEconomicalNumber ? _self.unitEconomicalNumber : unitEconomicalNumber // ignore: cast_nullable_to_non_nullable
as String?,unitProvince: freezed == unitProvince ? _self.unitProvince : unitProvince // ignore: cast_nullable_to_non_nullable
as String?,unitCity: freezed == unitCity ? _self.unitCity : unitCity // ignore: cast_nullable_to_non_nullable
as String?,unitPostalCode: freezed == unitPostalCode ? _self.unitPostalCode : unitPostalCode // ignore: cast_nullable_to_non_nullable
as String?,unitAddress: freezed == unitAddress ? _self.unitAddress : unitAddress // ignore: cast_nullable_to_non_nullable
as String?,personType: freezed == personType ? _self.personType : personType // ignore: cast_nullable_to_non_nullable
as String?,type: freezed == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
as String?,
));
}
/// Create a copy of UserProfile
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UserStateCopyWith<$Res>? get state {
if (_self.state == null) {
return null;
}
return $UserStateCopyWith<$Res>(_self.state!, (value) {
return _then(_self.copyWith(state: value));
});
}
}
/// @nodoc
mixin _$UserState {
String? get city; String? get image; String? get mobile; String? get birthday; String? get province; String? get lastName; String? get firstName; String? get nationalId; String? get nationalCode;
/// Create a copy of UserState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$UserStateCopyWith<UserState> get copyWith => _$UserStateCopyWithImpl<UserState>(this as UserState, _$identity);
/// Serializes this UserState to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is UserState&&(identical(other.city, city) || other.city == city)&&(identical(other.image, image) || other.image == image)&&(identical(other.mobile, mobile) || other.mobile == mobile)&&(identical(other.birthday, birthday) || other.birthday == birthday)&&(identical(other.province, province) || other.province == province)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.nationalId, nationalId) || other.nationalId == nationalId)&&(identical(other.nationalCode, nationalCode) || other.nationalCode == nationalCode));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,city,image,mobile,birthday,province,lastName,firstName,nationalId,nationalCode);
@override
String toString() {
return 'UserState(city: $city, image: $image, mobile: $mobile, birthday: $birthday, province: $province, lastName: $lastName, firstName: $firstName, nationalId: $nationalId, nationalCode: $nationalCode)';
}
}
/// @nodoc
abstract mixin class $UserStateCopyWith<$Res> {
factory $UserStateCopyWith(UserState value, $Res Function(UserState) _then) = _$UserStateCopyWithImpl;
@useResult
$Res call({
String? city, String? image, String? mobile, String? birthday, String? province, String? lastName, String? firstName, String? nationalId, String? nationalCode
});
}
/// @nodoc
class _$UserStateCopyWithImpl<$Res>
implements $UserStateCopyWith<$Res> {
_$UserStateCopyWithImpl(this._self, this._then);
final UserState _self;
final $Res Function(UserState) _then;
/// Create a copy of UserState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? city = freezed,Object? image = freezed,Object? mobile = freezed,Object? birthday = freezed,Object? province = freezed,Object? lastName = freezed,Object? firstName = freezed,Object? nationalId = freezed,Object? nationalCode = freezed,}) {
return _then(_self.copyWith(
city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
as String?,image: freezed == image ? _self.image : image // ignore: cast_nullable_to_non_nullable
as String?,mobile: freezed == mobile ? _self.mobile : mobile // ignore: cast_nullable_to_non_nullable
as String?,birthday: freezed == birthday ? _self.birthday : birthday // ignore: cast_nullable_to_non_nullable
as String?,province: freezed == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,nationalId: freezed == nationalId ? _self.nationalId : nationalId // ignore: cast_nullable_to_non_nullable
as String?,nationalCode: freezed == nationalCode ? _self.nationalCode : nationalCode // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
@JsonSerializable()
class _UserState implements UserState {
const _UserState({this.city, this.image, this.mobile, this.birthday, this.province, this.lastName, this.firstName, this.nationalId, this.nationalCode});
factory _UserState.fromJson(Map<String, dynamic> json) => _$UserStateFromJson(json);
@override final String? city;
@override final String? image;
@override final String? mobile;
@override final String? birthday;
@override final String? province;
@override final String? lastName;
@override final String? firstName;
@override final String? nationalId;
@override final String? nationalCode;
/// Create a copy of UserState
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$UserStateCopyWith<_UserState> get copyWith => __$UserStateCopyWithImpl<_UserState>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$UserStateToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UserState&&(identical(other.city, city) || other.city == city)&&(identical(other.image, image) || other.image == image)&&(identical(other.mobile, mobile) || other.mobile == mobile)&&(identical(other.birthday, birthday) || other.birthday == birthday)&&(identical(other.province, province) || other.province == province)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.nationalId, nationalId) || other.nationalId == nationalId)&&(identical(other.nationalCode, nationalCode) || other.nationalCode == nationalCode));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,city,image,mobile,birthday,province,lastName,firstName,nationalId,nationalCode);
@override
String toString() {
return 'UserState(city: $city, image: $image, mobile: $mobile, birthday: $birthday, province: $province, lastName: $lastName, firstName: $firstName, nationalId: $nationalId, nationalCode: $nationalCode)';
}
}
/// @nodoc
abstract mixin class _$UserStateCopyWith<$Res> implements $UserStateCopyWith<$Res> {
factory _$UserStateCopyWith(_UserState value, $Res Function(_UserState) _then) = __$UserStateCopyWithImpl;
@override @useResult
$Res call({
String? city, String? image, String? mobile, String? birthday, String? province, String? lastName, String? firstName, String? nationalId, String? nationalCode
});
}
/// @nodoc
class __$UserStateCopyWithImpl<$Res>
implements _$UserStateCopyWith<$Res> {
__$UserStateCopyWithImpl(this._self, this._then);
final _UserState _self;
final $Res Function(_UserState) _then;
/// Create a copy of UserState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? city = freezed,Object? image = freezed,Object? mobile = freezed,Object? birthday = freezed,Object? province = freezed,Object? lastName = freezed,Object? firstName = freezed,Object? nationalId = freezed,Object? nationalCode = freezed,}) {
return _then(_UserState(
city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
as String?,image: freezed == image ? _self.image : image // ignore: cast_nullable_to_non_nullable
as String?,mobile: freezed == mobile ? _self.mobile : mobile // ignore: cast_nullable_to_non_nullable
as String?,birthday: freezed == birthday ? _self.birthday : birthday // ignore: cast_nullable_to_non_nullable
as String?,province: freezed == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,nationalId: freezed == nationalId ? _self.nationalId : nationalId // ignore: cast_nullable_to_non_nullable
as String?,nationalCode: freezed == nationalCode ? _self.nationalCode : nationalCode // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
// dart format on

View File

@@ -0,0 +1,113 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'user_profile.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_UserProfile _$UserProfileFromJson(Map<String, dynamic> json) => _UserProfile(
role: (json['role'] as List<dynamic>?)?.map((e) => e as String).toList(),
city: json['city'] as String?,
province: json['province'] as String?,
key: json['key'] as String?,
userGateWayId: json['user_gate_way_id'] as String?,
userDjangoIdForeignKey: json['user_django_id_foreign_key'],
provinceIdForeignKey: json['province_id_foreign_key'],
cityIdForeignKey: json['city_id_foreign_key'],
systemUserProfileIdKey: json['system_user_profile_id_key'],
fullname: json['fullname'] as String?,
firstName: json['first_name'] as String?,
lastName: json['last_name'] as String?,
nationalCode: json['national_code'] as String?,
nationalCodeImage: json['national_code_image'] as String?,
nationalId: json['national_id'] as String?,
mobile: json['mobile'] as String?,
birthday: json['birthday'] as String?,
image: json['image'] as String?,
password: json['password'] as String?,
active: json['active'] as bool?,
state: json['state'] == null
? null
: UserState.fromJson(json['state'] as Map<String, dynamic>),
baseOrder: (json['base_order'] as num?)?.toInt(),
cityNumber: (json['city_number'] as num?)?.toInt(),
cityName: json['city_name'] as String?,
provinceNumber: (json['province_number'] as num?)?.toInt(),
provinceName: json['province_name'] as String?,
unitName: json['unit_name'] as String?,
unitNationalId: json['unit_national_id'] as String?,
unitRegistrationNumber: json['unit_registration_number'] as String?,
unitEconomicalNumber: json['unit_economical_number'] as String?,
unitProvince: json['unit_province'] as String?,
unitCity: json['unit_city'] as String?,
unitPostalCode: json['unit_postal_code'] as String?,
unitAddress: json['unit_address'] as String?,
personType: json['person_type'] as String?,
type: json['type'] as String?,
);
Map<String, dynamic> _$UserProfileToJson(_UserProfile instance) =>
<String, dynamic>{
'role': instance.role,
'city': instance.city,
'province': instance.province,
'key': instance.key,
'user_gate_way_id': instance.userGateWayId,
'user_django_id_foreign_key': instance.userDjangoIdForeignKey,
'province_id_foreign_key': instance.provinceIdForeignKey,
'city_id_foreign_key': instance.cityIdForeignKey,
'system_user_profile_id_key': instance.systemUserProfileIdKey,
'fullname': instance.fullname,
'first_name': instance.firstName,
'last_name': instance.lastName,
'national_code': instance.nationalCode,
'national_code_image': instance.nationalCodeImage,
'national_id': instance.nationalId,
'mobile': instance.mobile,
'birthday': instance.birthday,
'image': instance.image,
'password': instance.password,
'active': instance.active,
'state': instance.state,
'base_order': instance.baseOrder,
'city_number': instance.cityNumber,
'city_name': instance.cityName,
'province_number': instance.provinceNumber,
'province_name': instance.provinceName,
'unit_name': instance.unitName,
'unit_national_id': instance.unitNationalId,
'unit_registration_number': instance.unitRegistrationNumber,
'unit_economical_number': instance.unitEconomicalNumber,
'unit_province': instance.unitProvince,
'unit_city': instance.unitCity,
'unit_postal_code': instance.unitPostalCode,
'unit_address': instance.unitAddress,
'person_type': instance.personType,
'type': instance.type,
};
_UserState _$UserStateFromJson(Map<String, dynamic> json) => _UserState(
city: json['city'] as String?,
image: json['image'] as String?,
mobile: json['mobile'] as String?,
birthday: json['birthday'] as String?,
province: json['province'] as String?,
lastName: json['last_name'] as String?,
firstName: json['first_name'] as String?,
nationalId: json['national_id'] as String?,
nationalCode: json['national_code'] as String?,
);
Map<String, dynamic> _$UserStateToJson(_UserState instance) =>
<String, dynamic>{
'city': instance.city,
'image': instance.image,
'mobile': instance.mobile,
'birthday': instance.birthday,
'province': instance.province,
'last_name': instance.lastName,
'first_name': instance.firstName,
'national_id': instance.nationalId,
'national_code': instance.nationalCode,
};

View File

@@ -1,3 +1,4 @@
import 'package:rasadyar_chicken/data/models/request/change_password/change_password_request_model.dart';
import 'package:rasadyar_chicken/data/models/request/conform_allocation/conform_allocation.dart';
import 'package:rasadyar_chicken/data/models/request/steward_free_sale_bar/steward_free_sale_bar_request.dart';
import 'package:rasadyar_chicken/data/models/request/submit_steward_allocation/submit_steward_allocation.dart';
@@ -15,33 +16,29 @@ import 'package:rasadyar_chicken/data/models/response/roles_products/roles_produ
import 'package:rasadyar_chicken/data/models/response/steward_free_bar/steward_free_bar.dart';
import 'package:rasadyar_chicken/data/models/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart';
import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart';
import 'package:rasadyar_chicken/data/models/response/user_profile/user_profile.dart';
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart'
hide ProductModel;
import 'package:rasadyar_core/core.dart';
import '../models/request/create_steward_free_bar/create_steward_free_bar.dart';
import '../models/request/create_steward_free_bar/create_steward_free_bar.dart';
abstract class ChickenRepository {
Future<List<InventoryModel>?> getInventory({required String token});
Future<KillHouseDistributionInfo?> getKillHouseDistributionInfo({
required String token,
});
Future<KillHouseDistributionInfo?> getKillHouseDistributionInfo({required String token});
Future<BarInformation?> getGeneralBarInformation({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<PaginationModel<WaitingArrivalModel>?> getWaitingArrivals({
Future<PaginationModel<WaitingArrivalModel>?> getWaitingArrivals({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<void> setSateForArrivals({
required String token,
required Map<String, dynamic> request,
});
Future<void> setSateForArrivals({required String token, required Map<String, dynamic> request});
Future<PaginationModel<ImportedLoadsModel>?> getImportedLoadsModel({
required String token,
@@ -53,15 +50,9 @@ abstract class ChickenRepository {
Map<String, dynamic>? queryParameters,
});
Future<void> confirmAllocation({
required String token,
required Map<String, dynamic> allocation,
});
Future<void> confirmAllocation({required String token, required Map<String, dynamic> allocation});
Future<void> denyAllocation({
required String token,
required String allocationToken,
});
Future<void> denyAllocation({required String token, required String allocationToken});
Future<void> confirmAllAllocation({
required String token,
@@ -87,13 +78,7 @@ abstract class ChickenRepository {
Map<String, dynamic>? queryParameters,
});
Future<void> updateStewardAllocation({
required String token,
required ConformAllocation request,
});
Future<void> updateStewardAllocation({required String token, required ConformAllocation request});
Future<StewardFreeBarDashboard?> getStewardDashboard({
required String token,
@@ -107,8 +92,7 @@ abstract class ChickenRepository {
required String endDate,
});
Future<PaginationModel<StewardFreeBar>?>
getStewardPurchasesOutSideOfTheProvince({
Future<PaginationModel<StewardFreeBar>?> getStewardPurchasesOutSideOfTheProvince({
required String token,
Map<String, dynamic>? queryParameters,
});
@@ -123,8 +107,7 @@ abstract class ChickenRepository {
required String stewardFreeBarKey,
});
Future<PaginationModel<OutProvinceCarcassesBuyer>?>
getOutProvinceCarcassesBuyer({
Future<PaginationModel<OutProvinceCarcassesBuyer>?> getOutProvinceCarcassesBuyer({
required String token,
Map<String, dynamic>? queryParameters,
});
@@ -153,4 +136,9 @@ abstract class ChickenRepository {
required StewardFreeSaleBarRequest body,
});
Future<UserProfile?> getUserProfile({required String token});
Future<void> updateUserProfile({required String token, required UserProfile userProfile});
Future<void> updatePassword({required String token, required ChangePasswordRequestModel model});
}

View File

@@ -1,3 +1,4 @@
import 'package:rasadyar_chicken/data/models/request/change_password/change_password_request_model.dart';
import 'package:rasadyar_chicken/data/models/request/conform_allocation/conform_allocation.dart';
import 'package:rasadyar_chicken/data/models/request/create_steward_free_bar/create_steward_free_bar.dart';
import 'package:rasadyar_chicken/data/models/request/steward_free_sale_bar/steward_free_sale_bar_request.dart';
@@ -16,6 +17,7 @@ import 'package:rasadyar_chicken/data/models/response/roles_products/roles_produ
import 'package:rasadyar_chicken/data/models/response/steward_free_bar/steward_free_bar.dart';
import 'package:rasadyar_chicken/data/models/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart';
import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart';
import 'package:rasadyar_chicken/data/models/response/user_profile/user_profile.dart';
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart'
hide ProductModel;
import 'package:rasadyar_core/core.dart';
@@ -176,7 +178,7 @@ class ChickenRepositoryImpl implements ChickenRepository {
Map<String, dynamic>? queryParameters,
}) async {
var res = await _httpClient.get(
'/guilds/?',
'/guilds/',
queryParameters: queryParameters,
headers: {'Authorization': 'Bearer $token'},
fromJsonList: (json) =>
@@ -265,7 +267,7 @@ class ChickenRepositoryImpl implements ChickenRepository {
Map<String, dynamic>? queryParameters,
}) async {
var res = await _httpClient.get(
'/steward_free_bar/?',
'/steward_free_bar/',
queryParameters: queryParameters,
headers: {'Authorization': 'Bearer $token'},
fromJson: (json) => PaginationModel<StewardFreeBar>.fromJson(
@@ -279,7 +281,7 @@ class ChickenRepositoryImpl implements ChickenRepository {
@override
Future<List<IranProvinceCityModel>?> getCity({required String provinceName}) async {
var res = await _httpClient.get(
'/iran_city/?',
'/iran_city/',
queryParameters: {'name': provinceName},
fromJsonList: (json) =>
json.map((item) => IranProvinceCityModel.fromJson(item as Map<String, dynamic>)).toList(),
@@ -315,7 +317,7 @@ class ChickenRepositoryImpl implements ChickenRepository {
required String stewardFreeBarKey,
}) async {
await _httpClient.delete(
'/steward_free_bar/0/?',
'/steward_free_bar/0/',
headers: {'Authorization': 'Bearer $token'},
queryParameters: {'key': stewardFreeBarKey},
);
@@ -327,7 +329,7 @@ class ChickenRepositoryImpl implements ChickenRepository {
Map<String, dynamic>? queryParameters,
}) async {
var res = await _httpClient.get(
'/out-province-carcasses-buyer/?',
'/out-province-carcasses-buyer/',
queryParameters: queryParameters,
headers: {'Authorization': 'Bearer $token'},
fromJson: (json) => PaginationModel<OutProvinceCarcassesBuyer>.fromJson(
@@ -356,7 +358,7 @@ class ChickenRepositoryImpl implements ChickenRepository {
Map<String, dynamic>? queryParameters,
}) async {
var res = await _httpClient.get(
'/steward_free_sale_bar/?',
'/steward_free_sale_bar/',
queryParameters: queryParameters,
headers: {'Authorization': 'Bearer $token'},
fromJson: (json) => PaginationModel<StewardFreeSaleBar>.fromJson(
@@ -392,4 +394,36 @@ class ChickenRepositoryImpl implements ChickenRepository {
headers: {'Authorization': 'Bearer $token'},
);
}
@override
Future<UserProfile?> getUserProfile({required String token}) async {
var res = await _httpClient.get(
'/system_user_profile/?self-profile',
headers: {'Authorization': 'Bearer $token'},
fromJson: (json) => UserProfile.fromJson(json),
);
return res.data;
}
@override
Future<void> updateUserProfile({required String token, required UserProfile userProfile}) async {
await _httpClient.put(
'/system_user_profile/?self-profile/0/',
headers: {'Authorization': 'Bearer $token'},
data: userProfile.toJson()..removeWhere((key, value) => value == null),
);
}
@override
Future<void> updatePassword({
required String token,
required ChangePasswordRequestModel model,
}) async {
await _httpClient.post(
'/api/change_password/',
headers: {'Authorization': 'Bearer $token'},
data: model.toJson()..removeWhere((key, value) => value == null),
);
}
}

View File

@@ -0,0 +1,127 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_auth/data/utils/safe_call.dart';
import 'package:rasadyar_chicken/data/models/request/change_password/change_password_request_model.dart';
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
import 'package:rasadyar_chicken/data/models/response/user_profile/user_profile.dart';
import 'package:rasadyar_chicken/presentation/pages/root/logic.dart';
import 'package:rasadyar_core/core.dart';
class ProfileLogic extends GetxController {
RootLogic rootLogic = Get.find<RootLogic>();
RxInt selectedInformationType = 0.obs;
Rxn<Jalali> birthDate = Rxn<Jalali>();
Rx<Resource<UserProfile>> userProfile = Rx<Resource<UserProfile>>(Resource.loading());
TextEditingController nameController = TextEditingController();
TextEditingController lastNameController = TextEditingController();
TextEditingController nationalCodeController = TextEditingController();
TextEditingController nationalIdController = TextEditingController();
TextEditingController birthdayController = TextEditingController();
TextEditingController oldPasswordController = TextEditingController();
TextEditingController newPasswordController = TextEditingController();
TextEditingController retryNewPasswordController = TextEditingController();
RxList<IranProvinceCityModel> cites = <IranProvinceCityModel>[].obs;
Rxn<IranProvinceCityModel> selectedProvince = Rxn();
Rxn<IranProvinceCityModel> selectedCity = Rxn();
GlobalKey<FormState> formKey = GlobalKey();
@override
void onReady() {
super.onReady();
getUserProfile();
selectedProvince.listen((p0) => getCites());
userProfile.listen((data) {
nameController.text = data.data?.firstName ?? '';
lastNameController.text = data.data?.lastName ?? '';
nationalCodeController.text = data.data?.nationalCode ?? '';
nationalIdController.text = data.data?.nationalId ?? '';
birthdayController.text = data.data?.birthday?.toJalali.formatCompactDate() ?? '';
birthDate.value = data.data?.birthday?.toJalali;
selectedProvince.value = IranProvinceCityModel(
name: data.data?.province ?? '',
id: data.data?.provinceNumber ?? 0,
);
selectedCity.value = IranProvinceCityModel(
name: data.data?.city ?? '',
id: data.data?.cityNumber ?? 0,
);
});
}
@override
void onClose() {
super.onClose();
}
Future<void> getUserProfile() async {
userProfile.value = Resource.loading();
await safeCall<UserProfile?>(
call: () async => await rootLogic.chickenRepository.getUserProfile(
token: rootLogic.tokenService.accessToken.value!,
),
onSuccess: (result) {
if (result != null) {
userProfile.value = Resource.success(result);
}
},
onError: (error, stackTrace) {},
);
}
Future<void> getCites() async {
await safeCall(
call: () =>
rootLogic.chickenRepository.getCity(provinceName: selectedProvince.value?.name ?? ''),
onSuccess: (result) {
if (result != null && result.isNotEmpty) {
cites.value = result;
}
},
);
}
Future<void> updateUserProfile() async {
UserProfile userProfile = UserProfile(
firstName: nameController.text,
lastName: lastNameController.text,
nationalCode: nationalCodeController.text,
nationalId: nationalIdController.text,
birthday: birthDate.value?.toGregorian().toString(),
personType: 'self',
type: 'self_profile',
);
await safeCall(
call: () async => await rootLogic.chickenRepository.updateUserProfile(
token: rootLogic.tokenService.accessToken.value!,
userProfile: userProfile,
),
);
}
Future<void> updatePassword() async {
if (formKey.currentState?.validate() ?? false) {
ChangePasswordRequestModel model = ChangePasswordRequestModel(
username: userProfile.value.data?.mobile,
password: newPasswordController.text,
);
await safeCall(
call: () async => await rootLogic.chickenRepository.updatePassword(
token: rootLogic.tokenService.accessToken.value!,
model: model,
),
);
}
}
void clearPasswordForm() {
oldPasswordController.clear();
newPasswordController.clear();
retryNewPasswordController.clear();
}
}

View File

@@ -0,0 +1,502 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
import 'package:rasadyar_chicken/data/models/response/user_profile/user_profile.dart';
import 'package:rasadyar_chicken/presentation/widget/list_row_item.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
class ProfilePage extends GetView<ProfileLogic> {
const ProfilePage({super.key});
@override
Widget build(BuildContext context) {
return Column(
spacing: 30,
children: [
Expanded(
flex: 1,
child: Container(
color: AppColor.blueNormal,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(),
Container(
width: 128.w,
height: 128.h,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColor.blueLightActive,
),
child: Center(
child: Assets.vec.userSvg.svg(
width: 64.w,
height: 64.h,
colorFilter: ColorFilter.mode(AppColor.whiteLight, BlendMode.srcIn),
),
),
),
],
),
),
),
Expanded(
flex: 3,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 16,
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 10),
child: userProfileInformation(),
),
),
ObxValue((data) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Wrap(
spacing: 20,
runSpacing: 10,
children: [
cardActionWidget(
title: 'اطلاعات کاربری',
onPressed: () {
data.value = 0;
},
icon: Assets.vec.profileUserSvg.path,
selected: data.value == 0,
),
cardActionWidget(
title: 'تغییر رمز عبور',
selected: true,
onPressed: () {
Get.bottomSheet(changePasswordBottomSheet(), isScrollControlled: true);
},
icon: Assets.vec.lockSvg.path,
),
/*cardActionWidget(
title: 'اطلاعات بانکی',
onPressed: () {
data.value = 1;
},
icon: Assets.vec.informationSvg.path,
selected: data.value == 1,
),
cardActionWidget(
title: 'اطلاعات \nصدور فاکتور',
onPressed: () {
data.value = 2;
},
icon: Assets.vec.receiptDiscountSvg.path,
selected: data.value == 2,
),*/
],
),
);
}, controller.selectedInformationType),
SizedBox(height: 100),
],
),
),
],
);
}
Container invoiceIssuanceInformation() => Container();
Widget bankInformationWidget() => Column(
spacing: 16,
children: [
itemList(title: 'نام بانک', content: 'سامان'),
itemList(title: 'نام صاحب حساب', content: 'رضا رضایی'),
itemList(title: 'شماره کارت ', content: '54154545415'),
itemList(title: 'شماره حساب', content: '62565263263652'),
itemList(title: 'شماره شبا', content: '62565263263652'),
],
);
Widget userProfileInformation() {
return ObxValue((data) {
if (data.value.status == ResourceStatus.loading) {
return LoadingWidget();
} else if (data.value.status == ResourceStatus.error) {
return ErrorWidget('خطا در دریافت اطلاعات کاربر');
} else if (data.value.status == ResourceStatus.success) {
UserProfile item = data.value.data!;
return Column(
spacing: 6,
children: [
buildRowOnTapped(
onTap: () {
Get.bottomSheet(userInformationBottomSheet(), isScrollControlled: true);
},
titleWidget: Column(
spacing: 3,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'اطلاعات هویتی',
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
),
Container(width: 37.w, height: 1.h, color: AppColor.greenNormal),
],
),
valueWidget: Assets.vec.editSvg.svg(
width: 24.w,
height: 24.h,
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
),
),
itemList(
title: 'نام و نام خانوادگی',
content: item.fullname ?? 'نامشخص',
icon: Assets.vec.userSvg.path,
hasColoredBox: true,
),
itemList(
title: 'موبایل',
content: item.mobile ?? 'نامشخص',
icon: Assets.vec.callSvg.path,
),
itemList(
title: 'کدملی',
content: item.nationalId ?? 'نامشخص',
icon: Assets.vec.tagUserSvg.path,
),
itemList(
title: 'شماره شناسنامه',
content: item.nationalCode ?? 'نامشخص',
icon: Assets.vec.userSquareSvg.path,
),
itemList(
title: 'تاریخ تولد',
content: item.birthday?.toJalali.formatCompactDate() ?? 'نامشخص',
icon: Assets.vec.calendarSvg.path,
),
itemList(
title: 'استان',
content: item.province ?? 'نامشخص',
icon: Assets.vec.pictureFrameSvg.path,
),
itemList(title: 'شهر', content: item.city ?? 'نامشخص', icon: Assets.vec.mapSvg.path),
],
);
} else {
return SizedBox.shrink();
}
}, controller.userProfile);
}
Widget itemList({
required String title,
required String content,
String? icon,
bool hasColoredBox = false,
}) => Container(
padding: EdgeInsets.symmetric(horizontal: 12.h, vertical: 6.h),
decoration: BoxDecoration(
color: hasColoredBox ? AppColor.blueLight : Colors.transparent,
border: hasColoredBox
? Border.all(width: 1, color: AppColor.blueLightHover)
: Border.all(width: 0, color: Colors.transparent),
),
child: Row(
spacing: 4,
children: [
if (icon != null)
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: SvgGenImage.vec(icon).svg(
width: 20,
height: 20,
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
),
),
Text(title, style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal)),
Spacer(),
Text(content, style: AppFonts.yekan13.copyWith(color: AppColor.darkGreyNormalHover)),
],
),
);
Widget cardActionWidget({
required String title,
required VoidCallback onPressed,
required String icon,
bool selected = false,
}) {
return GestureDetector(
onTap: onPressed,
child: Column(
spacing: 4,
children: [
Container(
width: 52,
height: 52,
padding: EdgeInsets.all(8),
decoration: ShapeDecoration(
color: AppColor.blueLight,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
child: SvgGenImage.vec(icon).svg(
width: 40,
height: 40,
colorFilter: ColorFilter.mode(
selected ? AppColor.blueNormal : AppColor.whiteLight,
BlendMode.srcIn,
),
),
),
SizedBox(height: 2),
Text(
title,
style: AppFonts.yekan10.copyWith(
color: selected ? AppColor.blueNormal : AppColor.blueLightActive,
),
textAlign: TextAlign.center,
),
],
),
);
}
Widget userInformationBottomSheet() {
return BaseBottomSheet(
height: 500.h,
child: SingleChildScrollView(
child: Column(
spacing: 8,
children: [
Text(
'ویرایش اطلاعات هویتی',
style: AppFonts.yekan16Bold.copyWith(color: AppColor.darkGreyDarkHover),
),
/*
Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.darkGreyLight, width: 1),
),
child: Column(spacing: 12, children: [_provinceWidget(), _cityWidget()]),
),*/
Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.darkGreyLight, width: 1),
),
child: Column(
spacing: 12,
children: [
RTextField(
controller: controller.nameController,
label: 'نام',
borderColor: AppColor.darkGreyLight,
filledColor: AppColor.bgLight,
filled: true,
),
RTextField(
controller: controller.lastNameController,
label: 'نام خانوادگی',
borderColor: AppColor.darkGreyLight,
filledColor: AppColor.bgLight,
filled: true,
),
RTextField(
controller: controller.nationalCodeController,
label: 'شماره شناسنامه',
borderColor: AppColor.darkGreyLight,
filledColor: AppColor.bgLight,
filled: true,
),
RTextField(
controller: controller.nationalIdController,
label: 'کد ملی',
borderColor: AppColor.darkGreyLight,
filledColor: AppColor.bgLight,
filled: true,
),
ObxValue((data) {
return RTextField(
controller: controller.birthdayController,
label: 'تاریخ تولد',
initText: data.value?.formatCompactDate() ?? '',
borderColor: AppColor.darkGreyLight,
filledColor: AppColor.bgLight,
filled: true,
onTap: () {},
);
}, controller.birthDate),
SizedBox(),
Row(
spacing: 16,
mainAxisAlignment: MainAxisAlignment.center,
children: [
RElevated(
height: 40.h,
text: 'ویرایش',
onPressed: () async {
await controller.updateUserProfile();
controller.getUserProfile();
Get.back();
},
),
ROutlinedElevated(
height: 40.h,
text: 'انصراف',
borderColor: AppColor.blueNormal,
onPressed: () {
Get.back();
},
),
],
),
],
),
),
SizedBox(),
],
),
),
);
}
Widget _provinceWidget() {
return Obx(() {
return OverlayDropdownWidget<IranProvinceCityModel>(
items: controller.rootLogic.provinces,
onChanged: (value) {
controller.selectedProvince.value = value;
},
selectedItem: controller.selectedProvince.value,
itemBuilder: (item) => Text(item.name ?? 'بدون نام'),
labelBuilder: (item) => Text(item?.name ?? 'انتخاب استان'),
);
});
}
Widget _cityWidget() {
return ObxValue((data) {
return OverlayDropdownWidget<IranProvinceCityModel>(
items: data,
onChanged: (value) {
controller.selectedCity.value = value;
},
selectedItem: controller.selectedCity.value,
itemBuilder: (item) => Text(item.name ?? 'بدون نام'),
labelBuilder: (item) => Text(item?.name ?? 'انتخاب شهر'),
);
}, controller.cites);
}
Widget changePasswordBottomSheet() {
return BaseBottomSheet(
height: 400.h,
child: SingleChildScrollView(
child: Form(
key: controller.formKey,
child: Column(
spacing: 8,
children: [
Text(
'تغییر رمز عبور',
style: AppFonts.yekan16Bold.copyWith(color: AppColor.darkGreyDarkHover),
),
SizedBox(),
RTextField(
controller: controller.oldPasswordController,
hintText: 'رمز عبور قبلی',
borderColor: AppColor.darkGreyLight,
filledColor: AppColor.bgLight,
filled: true,
validator: (value) {
if (value == null || value.isEmpty) {
return 'رمز عبور را وارد کنید';
} else if (controller.userProfile.value.data?.password != value) {
return 'رمز عبور صحیح نیست';
}
return null;
},
),
RTextField(
controller: controller.newPasswordController,
hintText: 'رمز عبور جدید',
borderColor: AppColor.darkGreyLight,
filledColor: AppColor.bgLight,
filled: true,
validator: (value) {
if (value == null || value.isEmpty) {
return 'رمز عبور را وارد کنید';
} else if (value.length < 6) {
return 'رمز عبور باید بیش از 6 کارکتر باشد.';
}
return null;
},
),
RTextField(
controller: controller.retryNewPasswordController,
hintText: 'تکرار رمز عبور جدید',
borderColor: AppColor.darkGreyLight,
filledColor: AppColor.bgLight,
filled: true,
validator: (value) {
if (value == null || value.isEmpty) {
return 'رمز عبور را وارد کنید';
} else if (value.length < 6) {
return 'رمز عبور باید بیش از 6 کارکتر باشد.';
} else if (controller.newPasswordController.text != value) {
return 'رمز عبور جدید یکسان نیست';
}
return null;
},
),
SizedBox(),
Row(
spacing: 16,
mainAxisAlignment: MainAxisAlignment.center,
children: [
RElevated(
height: 40.h,
text: 'ویرایش',
onPressed: () async {
if (controller.formKey.currentState?.validate() != true) {
return;
}
await controller.updatePassword();
controller.getUserProfile();
controller.clearPasswordForm();
Get.back();
},
),
ROutlinedElevated(
height: 40.h,
text: 'انصراف',
borderColor: AppColor.blueNormal,
onPressed: () {
Get.back();
},
),
],
),
],
),
),
),
);
}
}

View File

@@ -8,6 +8,7 @@ import 'package:rasadyar_chicken/data/repositories/chicken_repository.dart';
import 'package:rasadyar_chicken/data/repositories/chicken_repository_imp.dart';
import 'package:rasadyar_chicken/presentation/pages/buy/view.dart';
import 'package:rasadyar_chicken/presentation/pages/home/view.dart';
import 'package:rasadyar_chicken/presentation/pages/profile/view.dart';
import 'package:rasadyar_chicken/presentation/pages/sale/view.dart';
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
@@ -22,14 +23,10 @@ class RootLogic extends GetxController {
SalePage(),
HomePage(),
Container(color: Colors.blue),
Container(color: Colors.amber),
ProfilePage(),
];
final defaultRoutes = <int, String>{
0: ChickenRoutes.buy,
1: ChickenRoutes.sale,
};
final defaultRoutes = <int, String>{0: ChickenRoutes.buy, 1: ChickenRoutes.sale};
List<String> routesName = ['رصدطیور'];
@@ -65,7 +62,8 @@ class RootLogic extends GetxController {
Future<void> getInventory() async {
await safeCall<List<InventoryModel>?>(
call: () async => await chickenRepository.getInventory(token: tokenService.accessToken.value!),
call: () async =>
await chickenRepository.getInventory(token: tokenService.accessToken.value!),
onSuccess: (result) {
if (result != null) {
inventoryModel.value = result.first;

View File

@@ -9,6 +9,7 @@ import 'package:rasadyar_chicken/presentation/pages/buy_out_of_province/logic.da
import 'package:rasadyar_chicken/presentation/pages/buy_out_of_province/view.dart';
import 'package:rasadyar_chicken/presentation/pages/home/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/home/view.dart';
import 'package:rasadyar_chicken/presentation/pages/profile/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/root/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/root/view.dart';
import 'package:rasadyar_chicken/presentation/pages/sale/logic.dart';
@@ -38,10 +39,8 @@ sealed class ChickenPages {
Get.lazyPut(() => HomeLogic());
Get.lazyPut(() => BuyLogic());
Get.lazyPut(() => SaleLogic());
Get.lazyPut(() => ProfileLogic());
Get.lazyPut(() => BaseLogic());
/*Get.lazyPut(() => SalesInProvinceLogic());
Get.lazyPut(() => SalesOutOfProvinceLogic());*/
}),
),

View File

@@ -146,6 +146,9 @@ class $AssetsIconsGen {
/// File path: assets/icons/liveStock.svg
SvgGenImage get liveStock => const SvgGenImage('assets/icons/liveStock.svg');
/// File path: assets/icons/lock.svg
SvgGenImage get lock => const SvgGenImage('assets/icons/lock.svg');
/// File path: assets/icons/logout.svg
SvgGenImage get logout => const SvgGenImage('assets/icons/logout.svg');
@@ -280,6 +283,7 @@ class $AssetsIconsGen {
key,
killogram,
liveStock,
lock,
logout,
map,
mapMarker,
@@ -463,6 +467,9 @@ class $AssetsVecGen {
/// File path: assets/vec/liveStock.svg.vec
SvgGenImage get liveStockSvg => const SvgGenImage.vec('assets/vec/liveStock.svg.vec');
/// File path: assets/vec/lock.svg.vec
SvgGenImage get lockSvg => const SvgGenImage.vec('assets/vec/lock.svg.vec');
/// File path: assets/vec/logout.svg.vec
SvgGenImage get logoutSvg => const SvgGenImage.vec('assets/vec/logout.svg.vec');
@@ -597,6 +604,7 @@ class $AssetsVecGen {
keySvg,
killogramSvg,
liveStockSvg,
lockSvg,
logoutSvg,
mapSvg,
mapMarkerSvg,

View File

@@ -114,17 +114,17 @@ class RListView<T> extends StatelessWidget {
@override
Widget build(BuildContext context) {
switch (resource.status) {
case Status.initial:
case Status.loading:
case ResourceStatus.initial:
case ResourceStatus.loading:
return loadingWidget;
case Status.error:
case ResourceStatus.error:
return errorWidget;
case Status.empty:
case ResourceStatus.empty:
return emptyWidget;
case Status.success:
case ResourceStatus.success:
if (resource.data?.isEmpty ?? true) {
return emptyWidget;
}

View File

@@ -1,31 +1,31 @@
enum Status { initial, loading, success, error, empty }
enum ResourceStatus { initial, loading, success, error, empty }
class Resource<T> {
final Status status;
final ResourceStatus status;
final T? data;
final String? message;
const Resource._({required this.status, this.data, this.message});
const Resource.initial() : this._(status: Status.initial);
const Resource.initial() : this._(status: ResourceStatus.initial);
const Resource.loading() : this._(status: Status.loading);
const Resource.loading() : this._(status: ResourceStatus.loading);
const Resource.success(T data) : this._(status: Status.success, data: data);
const Resource.success(T data) : this._(status: ResourceStatus.success, data: data);
const Resource.error(String message) : this._(status: Status.error, message: message);
const Resource.error(String message) : this._(status: ResourceStatus.error, message: message);
const Resource.empty() : this._(status: Status.empty);
const Resource.empty() : this._(status: ResourceStatus.empty);
bool get isInitial => status == Status.initial;
bool get isInitial => status == ResourceStatus.initial;
bool get isLoading => status == Status.loading;
bool get isLoading => status == ResourceStatus.loading;
bool get isSuccess => status == Status.success;
bool get isSuccess => status == ResourceStatus.success;
bool get isError => status == Status.error;
bool get isError => status == ResourceStatus.error;
bool get isEmpty => status == Status.empty;
bool get isEmpty => status == ResourceStatus.empty;
@override
String toString() {