refactor(legacy-auth): simplify signup to 2 steps and remove phone from recover password
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
import 'package:legacy_auth/src/features/sign_up/domain/entities/address_entity.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'address_model.freezed.dart';
|
||||
part 'address_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class LegacyAddressModel with _$LegacyAddressModel {
|
||||
const factory LegacyAddressModel({
|
||||
required String street,
|
||||
required String city,
|
||||
required String province,
|
||||
required String state,
|
||||
required String country,
|
||||
required int postCode,
|
||||
}) = _LegacyAddressModel;
|
||||
|
||||
factory LegacyAddressModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$LegacyAddressModelFromJson(json);
|
||||
}
|
||||
|
||||
extension LegacyAddressModelMapper on LegacyAddressEntity {
|
||||
LegacyAddressModel toModel() => LegacyAddressModel(
|
||||
street: street,
|
||||
city: city,
|
||||
province: province,
|
||||
state: state,
|
||||
country: country,
|
||||
postCode: postCode,
|
||||
);
|
||||
}
|
||||
@@ -1,292 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// 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 'address_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LegacyAddressModel {
|
||||
|
||||
String get street; String get city; String get province; String get state; String get country; int get postCode;
|
||||
/// Create a copy of LegacyAddressModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$LegacyAddressModelCopyWith<LegacyAddressModel> get copyWith => _$LegacyAddressModelCopyWithImpl<LegacyAddressModel>(this as LegacyAddressModel, _$identity);
|
||||
|
||||
/// Serializes this LegacyAddressModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is LegacyAddressModel&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country)&&(identical(other.postCode, postCode) || other.postCode == postCode));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,street,city,province,state,country,postCode);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LegacyAddressModel(street: $street, city: $city, province: $province, state: $state, country: $country, postCode: $postCode)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $LegacyAddressModelCopyWith<$Res> {
|
||||
factory $LegacyAddressModelCopyWith(LegacyAddressModel value, $Res Function(LegacyAddressModel) _then) = _$LegacyAddressModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String street, String city, String province, String state, String country, int postCode
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$LegacyAddressModelCopyWithImpl<$Res>
|
||||
implements $LegacyAddressModelCopyWith<$Res> {
|
||||
_$LegacyAddressModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final LegacyAddressModel _self;
|
||||
final $Res Function(LegacyAddressModel) _then;
|
||||
|
||||
/// Create a copy of LegacyAddressModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? street = null,Object? city = null,Object? province = null,Object? state = null,Object? country = null,Object? postCode = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
street: null == street ? _self.street : street // ignore: cast_nullable_to_non_nullable
|
||||
as String,city: null == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
|
||||
as String,province: null == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
|
||||
as String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
|
||||
as String,country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
|
||||
as String,postCode: null == postCode ? _self.postCode : postCode // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [LegacyAddressModel].
|
||||
extension LegacyAddressModelPatterns on LegacyAddressModel {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _LegacyAddressModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyAddressModel() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _LegacyAddressModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyAddressModel():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _LegacyAddressModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyAddressModel() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String street, String city, String province, String state, String country, int postCode)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyAddressModel() when $default != null:
|
||||
return $default(_that.street,_that.city,_that.province,_that.state,_that.country,_that.postCode);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String street, String city, String province, String state, String country, int postCode) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyAddressModel():
|
||||
return $default(_that.street,_that.city,_that.province,_that.state,_that.country,_that.postCode);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String street, String city, String province, String state, String country, int postCode)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyAddressModel() when $default != null:
|
||||
return $default(_that.street,_that.city,_that.province,_that.state,_that.country,_that.postCode);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _LegacyAddressModel implements LegacyAddressModel {
|
||||
const _LegacyAddressModel({required this.street, required this.city, required this.province, required this.state, required this.country, required this.postCode});
|
||||
factory _LegacyAddressModel.fromJson(Map<String, dynamic> json) => _$LegacyAddressModelFromJson(json);
|
||||
|
||||
@override final String street;
|
||||
@override final String city;
|
||||
@override final String province;
|
||||
@override final String state;
|
||||
@override final String country;
|
||||
@override final int postCode;
|
||||
|
||||
/// Create a copy of LegacyAddressModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$LegacyAddressModelCopyWith<_LegacyAddressModel> get copyWith => __$LegacyAddressModelCopyWithImpl<_LegacyAddressModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$LegacyAddressModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LegacyAddressModel&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country)&&(identical(other.postCode, postCode) || other.postCode == postCode));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,street,city,province,state,country,postCode);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LegacyAddressModel(street: $street, city: $city, province: $province, state: $state, country: $country, postCode: $postCode)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$LegacyAddressModelCopyWith<$Res> implements $LegacyAddressModelCopyWith<$Res> {
|
||||
factory _$LegacyAddressModelCopyWith(_LegacyAddressModel value, $Res Function(_LegacyAddressModel) _then) = __$LegacyAddressModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String street, String city, String province, String state, String country, int postCode
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$LegacyAddressModelCopyWithImpl<$Res>
|
||||
implements _$LegacyAddressModelCopyWith<$Res> {
|
||||
__$LegacyAddressModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _LegacyAddressModel _self;
|
||||
final $Res Function(_LegacyAddressModel) _then;
|
||||
|
||||
/// Create a copy of LegacyAddressModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? street = null,Object? city = null,Object? province = null,Object? state = null,Object? country = null,Object? postCode = null,}) {
|
||||
return _then(_LegacyAddressModel(
|
||||
street: null == street ? _self.street : street // ignore: cast_nullable_to_non_nullable
|
||||
as String,city: null == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
|
||||
as String,province: null == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
|
||||
as String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
|
||||
as String,country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
|
||||
as String,postCode: null == postCode ? _self.postCode : postCode // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -1,27 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'address_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_LegacyAddressModel _$LegacyAddressModelFromJson(Map<String, dynamic> json) =>
|
||||
_LegacyAddressModel(
|
||||
street: json['street'] as String,
|
||||
city: json['city'] as String,
|
||||
province: json['province'] as String,
|
||||
state: json['state'] as String,
|
||||
country: json['country'] as String,
|
||||
postCode: (json['postCode'] as num).toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$LegacyAddressModelToJson(_LegacyAddressModel instance) =>
|
||||
<String, dynamic>{
|
||||
'street': instance.street,
|
||||
'city': instance.city,
|
||||
'province': instance.province,
|
||||
'state': instance.state,
|
||||
'country': instance.country,
|
||||
'postCode': instance.postCode,
|
||||
};
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:legacy_auth/src/features/sign_up/domain/entities/sign_up_request_entity.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'address_model.dart';
|
||||
|
||||
part 'sign_up_request_model.freezed.dart';
|
||||
part 'sign_up_request_model.g.dart';
|
||||
@@ -14,14 +13,6 @@ abstract class LegacySignUpRequestModel with _$LegacySignUpRequestModel {
|
||||
required String phone,
|
||||
required String language,
|
||||
required String password,
|
||||
required List<LegacyAddressModel> taxResidences,
|
||||
required List<LegacyAddressModel> addresses,
|
||||
required int bornAt,
|
||||
required String placeOfBirth,
|
||||
required String birthCountry,
|
||||
required String document,
|
||||
required String documentType,
|
||||
required String relationType,
|
||||
}) = _LegacySignUpRequestModel;
|
||||
|
||||
factory LegacySignUpRequestModel.fromJson(Map<String, dynamic> json) =>
|
||||
@@ -36,15 +27,5 @@ extension LegacySignUpRequestModelMapper on LegacySignUpRequestEntity {
|
||||
phone: phone,
|
||||
language: language,
|
||||
password: password,
|
||||
taxResidences: taxResidences
|
||||
.map((e) => e.toModel())
|
||||
.toList(growable: false),
|
||||
addresses: addresses.map((e) => e.toModel()).toList(growable: false),
|
||||
bornAt: bornAt,
|
||||
placeOfBirth: placeOfBirth,
|
||||
birthCountry: birthCountry,
|
||||
document: document,
|
||||
documentType: documentType,
|
||||
relationType: relationType,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$LegacySignUpRequestModel {
|
||||
|
||||
String get firstName; String get lastName; String get email; String get phone; String get language; String get password; List<LegacyAddressModel> get taxResidences; List<LegacyAddressModel> get addresses; int get bornAt; String get placeOfBirth; String get birthCountry; String get document; String get documentType; String get relationType;
|
||||
String get firstName; String get lastName; String get email; String get phone; String get language; String get password;
|
||||
/// Create a copy of LegacySignUpRequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -28,16 +28,16 @@ $LegacySignUpRequestModelCopyWith<LegacySignUpRequestModel> get copyWith => _$Le
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is LegacySignUpRequestModel&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.language, language) || other.language == language)&&(identical(other.password, password) || other.password == password)&&const DeepCollectionEquality().equals(other.taxResidences, taxResidences)&&const DeepCollectionEquality().equals(other.addresses, addresses)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(identical(other.document, document) || other.document == document)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.relationType, relationType) || other.relationType == relationType));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is LegacySignUpRequestModel&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.language, language) || other.language == language)&&(identical(other.password, password) || other.password == password));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,firstName,lastName,email,phone,language,password,const DeepCollectionEquality().hash(taxResidences),const DeepCollectionEquality().hash(addresses),bornAt,placeOfBirth,birthCountry,document,documentType,relationType);
|
||||
int get hashCode => Object.hash(runtimeType,firstName,lastName,email,phone,language,password);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LegacySignUpRequestModel(firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, password: $password, taxResidences: $taxResidences, addresses: $addresses, bornAt: $bornAt, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, document: $document, documentType: $documentType, relationType: $relationType)';
|
||||
return 'LegacySignUpRequestModel(firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, password: $password)';
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ abstract mixin class $LegacySignUpRequestModelCopyWith<$Res> {
|
||||
factory $LegacySignUpRequestModelCopyWith(LegacySignUpRequestModel value, $Res Function(LegacySignUpRequestModel) _then) = _$LegacySignUpRequestModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String firstName, String lastName, String email, String phone, String language, String password, List<LegacyAddressModel> taxResidences, List<LegacyAddressModel> addresses, int bornAt, String placeOfBirth, String birthCountry, String document, String documentType, String relationType
|
||||
String firstName, String lastName, String email, String phone, String language, String password
|
||||
});
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class _$LegacySignUpRequestModelCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of LegacySignUpRequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? language = null,Object? password = null,Object? taxResidences = null,Object? addresses = null,Object? bornAt = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? document = null,Object? documentType = null,Object? relationType = null,}) {
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? language = null,Object? password = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
||||
as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
|
||||
@@ -73,14 +73,6 @@ as String,email: null == email ? _self.email : email // ignore: cast_nullable_to
|
||||
as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||
as String,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
|
||||
as String,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
|
||||
as String,taxResidences: null == taxResidences ? _self.taxResidences : taxResidences // ignore: cast_nullable_to_non_nullable
|
||||
as List<LegacyAddressModel>,addresses: null == addresses ? _self.addresses : addresses // ignore: cast_nullable_to_non_nullable
|
||||
as List<LegacyAddressModel>,bornAt: null == bornAt ? _self.bornAt : bornAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,placeOfBirth: null == placeOfBirth ? _self.placeOfBirth : placeOfBirth // ignore: cast_nullable_to_non_nullable
|
||||
as String,birthCountry: null == birthCountry ? _self.birthCountry : birthCountry // ignore: cast_nullable_to_non_nullable
|
||||
as String,document: null == document ? _self.document : document // ignore: cast_nullable_to_non_nullable
|
||||
as String,documentType: null == documentType ? _self.documentType : documentType // ignore: cast_nullable_to_non_nullable
|
||||
as String,relationType: null == relationType ? _self.relationType : relationType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
@@ -166,10 +158,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String firstName, String lastName, String email, String phone, String language, String password, List<LegacyAddressModel> taxResidences, List<LegacyAddressModel> addresses, int bornAt, String placeOfBirth, String birthCountry, String document, String documentType, String relationType)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String firstName, String lastName, String email, String phone, String language, String password)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacySignUpRequestModel() when $default != null:
|
||||
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.placeOfBirth,_that.birthCountry,_that.document,_that.documentType,_that.relationType);case _:
|
||||
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -187,10 +179,10 @@ return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.lan
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String firstName, String lastName, String email, String phone, String language, String password, List<LegacyAddressModel> taxResidences, List<LegacyAddressModel> addresses, int bornAt, String placeOfBirth, String birthCountry, String document, String documentType, String relationType) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String firstName, String lastName, String email, String phone, String language, String password) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacySignUpRequestModel():
|
||||
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.placeOfBirth,_that.birthCountry,_that.document,_that.documentType,_that.relationType);case _:
|
||||
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -207,10 +199,10 @@ return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.lan
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String firstName, String lastName, String email, String phone, String language, String password, List<LegacyAddressModel> taxResidences, List<LegacyAddressModel> addresses, int bornAt, String placeOfBirth, String birthCountry, String document, String documentType, String relationType)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String firstName, String lastName, String email, String phone, String language, String password)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacySignUpRequestModel() when $default != null:
|
||||
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.placeOfBirth,_that.birthCountry,_that.document,_that.documentType,_that.relationType);case _:
|
||||
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -222,7 +214,7 @@ return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.lan
|
||||
@JsonSerializable()
|
||||
|
||||
class _LegacySignUpRequestModel implements LegacySignUpRequestModel {
|
||||
const _LegacySignUpRequestModel({required this.firstName, required this.lastName, required this.email, required this.phone, required this.language, required this.password, required final List<LegacyAddressModel> taxResidences, required final List<LegacyAddressModel> addresses, required this.bornAt, required this.placeOfBirth, required this.birthCountry, required this.document, required this.documentType, required this.relationType}): _taxResidences = taxResidences,_addresses = addresses;
|
||||
const _LegacySignUpRequestModel({required this.firstName, required this.lastName, required this.email, required this.phone, required this.language, required this.password});
|
||||
factory _LegacySignUpRequestModel.fromJson(Map<String, dynamic> json) => _$LegacySignUpRequestModelFromJson(json);
|
||||
|
||||
@override final String firstName;
|
||||
@@ -231,26 +223,6 @@ class _LegacySignUpRequestModel implements LegacySignUpRequestModel {
|
||||
@override final String phone;
|
||||
@override final String language;
|
||||
@override final String password;
|
||||
final List<LegacyAddressModel> _taxResidences;
|
||||
@override List<LegacyAddressModel> get taxResidences {
|
||||
if (_taxResidences is EqualUnmodifiableListView) return _taxResidences;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_taxResidences);
|
||||
}
|
||||
|
||||
final List<LegacyAddressModel> _addresses;
|
||||
@override List<LegacyAddressModel> get addresses {
|
||||
if (_addresses is EqualUnmodifiableListView) return _addresses;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_addresses);
|
||||
}
|
||||
|
||||
@override final int bornAt;
|
||||
@override final String placeOfBirth;
|
||||
@override final String birthCountry;
|
||||
@override final String document;
|
||||
@override final String documentType;
|
||||
@override final String relationType;
|
||||
|
||||
/// Create a copy of LegacySignUpRequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -265,16 +237,16 @@ Map<String, dynamic> toJson() {
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LegacySignUpRequestModel&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.language, language) || other.language == language)&&(identical(other.password, password) || other.password == password)&&const DeepCollectionEquality().equals(other._taxResidences, _taxResidences)&&const DeepCollectionEquality().equals(other._addresses, _addresses)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(identical(other.document, document) || other.document == document)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.relationType, relationType) || other.relationType == relationType));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LegacySignUpRequestModel&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.language, language) || other.language == language)&&(identical(other.password, password) || other.password == password));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,firstName,lastName,email,phone,language,password,const DeepCollectionEquality().hash(_taxResidences),const DeepCollectionEquality().hash(_addresses),bornAt,placeOfBirth,birthCountry,document,documentType,relationType);
|
||||
int get hashCode => Object.hash(runtimeType,firstName,lastName,email,phone,language,password);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LegacySignUpRequestModel(firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, password: $password, taxResidences: $taxResidences, addresses: $addresses, bornAt: $bornAt, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, document: $document, documentType: $documentType, relationType: $relationType)';
|
||||
return 'LegacySignUpRequestModel(firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, password: $password)';
|
||||
}
|
||||
|
||||
|
||||
@@ -285,7 +257,7 @@ abstract mixin class _$LegacySignUpRequestModelCopyWith<$Res> implements $Legacy
|
||||
factory _$LegacySignUpRequestModelCopyWith(_LegacySignUpRequestModel value, $Res Function(_LegacySignUpRequestModel) _then) = __$LegacySignUpRequestModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String firstName, String lastName, String email, String phone, String language, String password, List<LegacyAddressModel> taxResidences, List<LegacyAddressModel> addresses, int bornAt, String placeOfBirth, String birthCountry, String document, String documentType, String relationType
|
||||
String firstName, String lastName, String email, String phone, String language, String password
|
||||
});
|
||||
|
||||
|
||||
@@ -302,7 +274,7 @@ class __$LegacySignUpRequestModelCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of LegacySignUpRequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? language = null,Object? password = null,Object? taxResidences = null,Object? addresses = null,Object? bornAt = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? document = null,Object? documentType = null,Object? relationType = null,}) {
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? language = null,Object? password = null,}) {
|
||||
return _then(_LegacySignUpRequestModel(
|
||||
firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
||||
as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
|
||||
@@ -310,14 +282,6 @@ as String,email: null == email ? _self.email : email // ignore: cast_nullable_to
|
||||
as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||
as String,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
|
||||
as String,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
|
||||
as String,taxResidences: null == taxResidences ? _self._taxResidences : taxResidences // ignore: cast_nullable_to_non_nullable
|
||||
as List<LegacyAddressModel>,addresses: null == addresses ? _self._addresses : addresses // ignore: cast_nullable_to_non_nullable
|
||||
as List<LegacyAddressModel>,bornAt: null == bornAt ? _self.bornAt : bornAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,placeOfBirth: null == placeOfBirth ? _self.placeOfBirth : placeOfBirth // ignore: cast_nullable_to_non_nullable
|
||||
as String,birthCountry: null == birthCountry ? _self.birthCountry : birthCountry // ignore: cast_nullable_to_non_nullable
|
||||
as String,document: null == document ? _self.document : document // ignore: cast_nullable_to_non_nullable
|
||||
as String,documentType: null == documentType ? _self.documentType : documentType // ignore: cast_nullable_to_non_nullable
|
||||
as String,relationType: null == relationType ? _self.relationType : relationType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -15,18 +15,6 @@ _LegacySignUpRequestModel _$LegacySignUpRequestModelFromJson(
|
||||
phone: json['phone'] as String,
|
||||
language: json['language'] as String,
|
||||
password: json['password'] as String,
|
||||
taxResidences: (json['taxResidences'] as List<dynamic>)
|
||||
.map((e) => LegacyAddressModel.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
addresses: (json['addresses'] as List<dynamic>)
|
||||
.map((e) => LegacyAddressModel.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
bornAt: (json['bornAt'] as num).toInt(),
|
||||
placeOfBirth: json['placeOfBirth'] as String,
|
||||
birthCountry: json['birthCountry'] as String,
|
||||
document: json['document'] as String,
|
||||
documentType: json['documentType'] as String,
|
||||
relationType: json['relationType'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$LegacySignUpRequestModelToJson(
|
||||
@@ -38,12 +26,4 @@ Map<String, dynamic> _$LegacySignUpRequestModelToJson(
|
||||
'phone': instance.phone,
|
||||
'language': instance.language,
|
||||
'password': instance.password,
|
||||
'taxResidences': instance.taxResidences,
|
||||
'addresses': instance.addresses,
|
||||
'bornAt': instance.bornAt,
|
||||
'placeOfBirth': instance.placeOfBirth,
|
||||
'birthCountry': instance.birthCountry,
|
||||
'document': instance.document,
|
||||
'documentType': instance.documentType,
|
||||
'relationType': instance.relationType,
|
||||
};
|
||||
|
||||
@@ -175,45 +175,6 @@ class LegacyNewPasswordScreen extends ConsumerWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: SizeUtils.getByScreen(small: 32, big: 32, xl: 24),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(
|
||||
context.translate(I18n.mobilePhone),
|
||||
style: TextStyle(
|
||||
fontSize: SizeUtils.getByScreen(
|
||||
small: 14,
|
||||
big: 14,
|
||||
xl: 12,
|
||||
),
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
CountryPrefixPicker(
|
||||
headerText: context.translate(I18n.selectYourCountry),
|
||||
width: 80,
|
||||
onChanged: (country) {
|
||||
viewModel.updateDialCode(
|
||||
country.dialCode ?? viewState.dialCode,
|
||||
);
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: CustomTextField(
|
||||
hint: context.translate(I18n.phoneNumber),
|
||||
keyboardType: TextInputType.number,
|
||||
controller: viewModel.newPhoneNumberController,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (viewState.errorMessage.isNotEmpty) ...[
|
||||
SizedBox(height: 10),
|
||||
Text(
|
||||
|
||||
@@ -58,41 +58,6 @@ class LegacyRequestRecoveryScreen extends ConsumerWidget {
|
||||
SizedBox(
|
||||
height: SizeUtils.getByScreen(small: 40, big: 40, xl: 28),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(
|
||||
context.translate(I18n.mobilePhone),
|
||||
style: TextStyle(fontSize: 14, letterSpacing: 0),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
CountryPrefixPicker(
|
||||
headerText: context.translate(I18n.selectYourCountry),
|
||||
initialSelection: viewState.dialCode,
|
||||
onChanged: (country) {
|
||||
viewModel.updateDialCode(
|
||||
country.dialCode ?? viewState.dialCode,
|
||||
);
|
||||
},
|
||||
width: 80,
|
||||
),
|
||||
SizedBox(
|
||||
width: SizeUtils.getByScreen(small: 10, big: 10, xl: 6),
|
||||
),
|
||||
Expanded(
|
||||
child: CustomTextField(
|
||||
hint: context.translate(I18n.phoneNumber),
|
||||
keyboardType: TextInputType.number,
|
||||
controller: viewModel.phoneNumberController,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: SizeUtils.getByScreen(small: 40, big: 40, xl: 28),
|
||||
),
|
||||
if (viewState.errorMessage.isNotEmpty) ...[
|
||||
Text(
|
||||
context.translate(viewState.errorMessage),
|
||||
|
||||
@@ -18,7 +18,6 @@ class LegacySentScreen extends ConsumerWidget {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
|
||||
final viewModel = ref.read(legacyRecoverPasswordViewModelProvider.notifier);
|
||||
final viewState = ref.watch(legacyRecoverPasswordViewModelProvider);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
@@ -51,9 +50,7 @@ class LegacySentScreen extends ConsumerWidget {
|
||||
width: SizeUtils.getByScreen(small: 10, big: 10, xl: 6),
|
||||
),
|
||||
Text(
|
||||
viewState.recoveryFormat == "email"
|
||||
? context.translate(I18n.emailSent)
|
||||
: context.translate(I18n.smsSent),
|
||||
context.translate(I18n.emailSent),
|
||||
style: TextStyle(
|
||||
fontSize: SizeUtils.getByScreen(
|
||||
small: 18,
|
||||
@@ -69,9 +66,7 @@ class LegacySentScreen extends ConsumerWidget {
|
||||
height: SizeUtils.getByScreen(small: 48, big: 48, xl: 40),
|
||||
),
|
||||
Text(
|
||||
viewState.recoveryFormat == "email"
|
||||
? context.translate(I18n.checkEmail1)
|
||||
: context.translate(I18n.checkSms1),
|
||||
context.translate(I18n.checkEmail1),
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: SizeUtils.getByScreen(small: 17, big: 17, xl: 15),
|
||||
@@ -80,9 +75,7 @@ class LegacySentScreen extends ConsumerWidget {
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text(
|
||||
viewState.recoveryFormat == "email"
|
||||
? context.translate(I18n.checkEmail2)
|
||||
: context.translate(I18n.checkSms2),
|
||||
context.translate(I18n.checkEmail2),
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: SizeUtils.getByScreen(small: 14, big: 14, xl: 12),
|
||||
@@ -96,14 +89,8 @@ class LegacySentScreen extends ConsumerWidget {
|
||||
children: [
|
||||
Expanded(
|
||||
child: SecondaryButton(
|
||||
onPressed: () {
|
||||
if (viewState.recoveryFormat == "email") {
|
||||
viewModel.requestEmail();
|
||||
}
|
||||
},
|
||||
text: viewState.recoveryFormat == "email"
|
||||
? context.translate(I18n.resendEmail)
|
||||
: context.translate(I18n.resendSms),
|
||||
onPressed: viewModel.requestRecovery,
|
||||
text: context.translate(I18n.resendEmail),
|
||||
size: SizeUtils.getByScreen(small: 16, big: 16, xl: 14),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:legacy_auth/src/features/recover_password/domain/use_cases/recover_password_use_case.dart';
|
||||
import 'package:legacy_auth/src/features/recover_password/presentation/state/recover_password_view_state.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:legacy_auth/src/features/recover_password/domain/use_cases/recover_password_use_case.dart';
|
||||
import 'package:legacy_auth/src/features/recover_password/presentation/state/recover_password_view_state.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
import 'package:sf_tracking/sf_tracking.dart';
|
||||
|
||||
import '../providers/recover_password_provider.dart';
|
||||
@@ -18,20 +19,16 @@ class LegacyRecoverPasswordViewModel
|
||||
extends Notifier<LegacyRecoverPasswordViewState> {
|
||||
late final LegacyRecoverPasswordUseCase _recoverPasswordUseCase;
|
||||
late final SfTrackingRepository _tracking;
|
||||
late final TextEditingController phoneNumberController;
|
||||
|
||||
late final TextEditingController emailController;
|
||||
late final TextEditingController passwordController;
|
||||
late final TextEditingController repeatedPasswordController;
|
||||
late final TextEditingController newPhoneNumberController;
|
||||
|
||||
@override
|
||||
LegacyRecoverPasswordViewState build() {
|
||||
_recoverPasswordUseCase = ref.read(legacyRecoverPasswordUseCaseProvider);
|
||||
_tracking = ref.read(sfTrackingProvider);
|
||||
|
||||
phoneNumberController = TextEditingController();
|
||||
phoneNumberController.addListener(_onPhoneNumberChanged);
|
||||
|
||||
emailController = TextEditingController();
|
||||
emailController.addListener(_onEmailChanged);
|
||||
|
||||
@@ -41,83 +38,45 @@ class LegacyRecoverPasswordViewModel
|
||||
repeatedPasswordController = TextEditingController();
|
||||
repeatedPasswordController.addListener(_onRepeatedPasswordChanged);
|
||||
|
||||
newPhoneNumberController = TextEditingController();
|
||||
newPhoneNumberController.addListener(_onNewPhoneNumberChanged);
|
||||
|
||||
ref.onDispose(disposeControllers);
|
||||
|
||||
return const LegacyRecoverPasswordViewState();
|
||||
}
|
||||
|
||||
void _onPhoneNumberChanged() {
|
||||
final String raw = phoneNumberController.text;
|
||||
state = state.copyWith(
|
||||
phoneNumber: raw,
|
||||
errorMessage: '',
|
||||
recoveryRequested: false,
|
||||
);
|
||||
}
|
||||
|
||||
void _onNewPhoneNumberChanged() {
|
||||
final String raw = newPhoneNumberController.text;
|
||||
state = state.copyWith(
|
||||
newPhoneNumber: raw,
|
||||
errorMessage: '',
|
||||
recoveryRequested: false,
|
||||
);
|
||||
}
|
||||
|
||||
void _onEmailChanged() {
|
||||
final String raw = emailController.text;
|
||||
state = state.copyWith(
|
||||
email: raw,
|
||||
email: emailController.text,
|
||||
errorMessage: '',
|
||||
recoveryRequested: false,
|
||||
);
|
||||
}
|
||||
|
||||
void _onPasswordChanged() {
|
||||
final String raw = passwordController.text;
|
||||
final bool equalPasswords = raw == repeatedPasswordController.text;
|
||||
|
||||
final bool minCheck = raw.length >= 8;
|
||||
final bool capitalCheck = RegExp(r'[A-Z]').hasMatch(raw);
|
||||
final bool numberCheck = RegExp(r'[0-9]').hasMatch(raw);
|
||||
final bool specialCheck = RegExp(r'[^A-Za-z0-9]').hasMatch(raw);
|
||||
|
||||
final Map<String, bool> security = {
|
||||
'min': minCheck,
|
||||
'capital': capitalCheck,
|
||||
'number': numberCheck,
|
||||
'special': specialCheck,
|
||||
};
|
||||
final raw = passwordController.text;
|
||||
final equalPasswords = raw == repeatedPasswordController.text;
|
||||
|
||||
state = state.copyWith(
|
||||
password: raw,
|
||||
errorMessage: '',
|
||||
equalPasswords: equalPasswords,
|
||||
securityChecks: security,
|
||||
securityChecks: {
|
||||
'min': raw.length >= 8,
|
||||
'capital': RegExp(r'[A-Z]').hasMatch(raw),
|
||||
'number': RegExp(r'[0-9]').hasMatch(raw),
|
||||
'special': RegExp(r'[^A-Za-z0-9]').hasMatch(raw),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void _onRepeatedPasswordChanged() {
|
||||
final String raw = repeatedPasswordController.text;
|
||||
final bool equalPasswords = raw == passwordController.text;
|
||||
final raw = repeatedPasswordController.text;
|
||||
state = state.copyWith(
|
||||
repeatedPassword: raw,
|
||||
errorMessage: '',
|
||||
equalPasswords: equalPasswords,
|
||||
equalPasswords: raw == passwordController.text,
|
||||
);
|
||||
}
|
||||
|
||||
void updateDialCode(String dialCode) {
|
||||
state = state.copyWith(dialCode: dialCode, errorMessage: '');
|
||||
}
|
||||
|
||||
void updateNewDialCode(String dialCode) {
|
||||
state = state.copyWith(newDialCode: dialCode, errorMessage: '');
|
||||
}
|
||||
|
||||
void togglePasswordVisible() {
|
||||
state = state.copyWith(passwordVisible: !state.passwordVisible);
|
||||
}
|
||||
@@ -125,6 +84,11 @@ class LegacyRecoverPasswordViewModel
|
||||
Future<void> requestRecovery() async {
|
||||
final email = state.email.trim();
|
||||
|
||||
if (email.isEmpty) {
|
||||
state = state.copyWith(errorMessage: 'errorMessageContactIsEmpty');
|
||||
return;
|
||||
}
|
||||
|
||||
state = state.copyWith(
|
||||
isLoading: true,
|
||||
errorMessage: '',
|
||||
@@ -133,41 +97,22 @@ class LegacyRecoverPasswordViewModel
|
||||
|
||||
unawaited(_tracking.legacyAuthPasswordResetRequested());
|
||||
|
||||
if (email.isNotEmpty) {
|
||||
await requestEmail();
|
||||
} else {
|
||||
state = state.copyWith(
|
||||
isLoading: false,
|
||||
errorMessage: 'errorMessageContactIsEmpty',
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> requestEmail() async {
|
||||
final email = state.email.trim();
|
||||
|
||||
try {
|
||||
final String token = await _recoverPasswordUseCase.requestEmail(
|
||||
email: email,
|
||||
);
|
||||
final token = await _recoverPasswordUseCase.requestEmail(email: email);
|
||||
if (!ref.mounted) return;
|
||||
|
||||
unawaited(_tracking.legacyAuthPasswordResetEmailSent());
|
||||
|
||||
state = state.copyWith(
|
||||
isLoading: false,
|
||||
errorMessage: '',
|
||||
recoveryRequested: true,
|
||||
token: token,
|
||||
recoveryFormat: 'email',
|
||||
);
|
||||
} catch (e) {
|
||||
if (!ref.mounted) return;
|
||||
|
||||
state = state.copyWith(
|
||||
isLoading: false,
|
||||
errorMessage: e.toString(),
|
||||
errorMessage: I18n.errorGeneric,
|
||||
recoveryRequested: false,
|
||||
passwordChanged: false,
|
||||
);
|
||||
@@ -175,9 +120,6 @@ class LegacyRecoverPasswordViewModel
|
||||
}
|
||||
|
||||
Future<void> recoverPassword() async {
|
||||
//final String fullPhone = state.newDialCode + state.newPhoneNumber;
|
||||
final String password = state.password;
|
||||
|
||||
if (!state.equalPasswords) {
|
||||
unawaited(_tracking.legacyAuthPasswordResetFailed('unequal_passwords'));
|
||||
state = state.copyWith(
|
||||
@@ -224,9 +166,10 @@ class LegacyRecoverPasswordViewModel
|
||||
}
|
||||
|
||||
state = state.copyWith(isLoading: true, passwordChanged: false);
|
||||
|
||||
try {
|
||||
await _recoverPasswordUseCase.recoverPassword(
|
||||
newPassword: password,
|
||||
newPassword: state.password,
|
||||
token: state.token,
|
||||
);
|
||||
unawaited(_tracking.legacyAuthPasswordResetCompleted());
|
||||
@@ -234,7 +177,7 @@ class LegacyRecoverPasswordViewModel
|
||||
} catch (error) {
|
||||
unawaited(_tracking.legacyAuthPasswordResetFailed(error.toString()));
|
||||
state = state.copyWith(
|
||||
errorMessage: error.toString(),
|
||||
errorMessage: I18n.errorGeneric,
|
||||
isLoading: false,
|
||||
passwordChanged: false,
|
||||
);
|
||||
@@ -242,15 +185,11 @@ class LegacyRecoverPasswordViewModel
|
||||
}
|
||||
|
||||
void disposeControllers() {
|
||||
phoneNumberController.removeListener(_onPhoneNumberChanged);
|
||||
phoneNumberController.dispose();
|
||||
emailController.removeListener(_onPhoneNumberChanged);
|
||||
emailController.removeListener(_onEmailChanged);
|
||||
emailController.dispose();
|
||||
passwordController.removeListener(_onPasswordChanged);
|
||||
passwordController.dispose();
|
||||
repeatedPasswordController.removeListener(_onRepeatedPasswordChanged);
|
||||
repeatedPasswordController.dispose();
|
||||
newPhoneNumberController.removeListener(_onNewPhoneNumberChanged);
|
||||
newPhoneNumberController.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,8 @@ part 'recover_password_view_state.freezed.dart';
|
||||
abstract class LegacyRecoverPasswordViewState
|
||||
with _$LegacyRecoverPasswordViewState {
|
||||
const factory LegacyRecoverPasswordViewState({
|
||||
@Default('') String phoneNumber,
|
||||
@Default('+34') String dialCode,
|
||||
@Default('') String email,
|
||||
@Default('') String errorMessage,
|
||||
@Default('') String recoveryFormat,
|
||||
@Default(false) bool isLoading,
|
||||
@Default(false) bool recoveryRequested,
|
||||
@Default(false) bool passwordChanged,
|
||||
@@ -19,8 +16,6 @@ abstract class LegacyRecoverPasswordViewState
|
||||
@Default('') String repeatedPassword,
|
||||
@Default(false) bool passwordVisible,
|
||||
@Default(true) bool equalPasswords,
|
||||
@Default('+34') String newDialCode,
|
||||
@Default('') String newPhoneNumber,
|
||||
@Default({
|
||||
'min': false,
|
||||
'capital': false,
|
||||
|
||||
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$LegacyRecoverPasswordViewState {
|
||||
|
||||
String get phoneNumber; String get dialCode; String get email; String get errorMessage; String get recoveryFormat; bool get isLoading; bool get recoveryRequested; bool get passwordChanged; String get token; String get password; String get repeatedPassword; bool get passwordVisible; bool get equalPasswords; String get newDialCode; String get newPhoneNumber; Map<String, bool> get securityChecks;
|
||||
String get email; String get errorMessage; bool get isLoading; bool get recoveryRequested; bool get passwordChanged; String get token; String get password; String get repeatedPassword; bool get passwordVisible; bool get equalPasswords; Map<String, bool> get securityChecks;
|
||||
/// Create a copy of LegacyRecoverPasswordViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -25,16 +25,16 @@ $LegacyRecoverPasswordViewStateCopyWith<LegacyRecoverPasswordViewState> get copy
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is LegacyRecoverPasswordViewState&&(identical(other.phoneNumber, phoneNumber) || other.phoneNumber == phoneNumber)&&(identical(other.dialCode, dialCode) || other.dialCode == dialCode)&&(identical(other.email, email) || other.email == email)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.recoveryFormat, recoveryFormat) || other.recoveryFormat == recoveryFormat)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.recoveryRequested, recoveryRequested) || other.recoveryRequested == recoveryRequested)&&(identical(other.passwordChanged, passwordChanged) || other.passwordChanged == passwordChanged)&&(identical(other.token, token) || other.token == token)&&(identical(other.password, password) || other.password == password)&&(identical(other.repeatedPassword, repeatedPassword) || other.repeatedPassword == repeatedPassword)&&(identical(other.passwordVisible, passwordVisible) || other.passwordVisible == passwordVisible)&&(identical(other.equalPasswords, equalPasswords) || other.equalPasswords == equalPasswords)&&(identical(other.newDialCode, newDialCode) || other.newDialCode == newDialCode)&&(identical(other.newPhoneNumber, newPhoneNumber) || other.newPhoneNumber == newPhoneNumber)&&const DeepCollectionEquality().equals(other.securityChecks, securityChecks));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is LegacyRecoverPasswordViewState&&(identical(other.email, email) || other.email == email)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.recoveryRequested, recoveryRequested) || other.recoveryRequested == recoveryRequested)&&(identical(other.passwordChanged, passwordChanged) || other.passwordChanged == passwordChanged)&&(identical(other.token, token) || other.token == token)&&(identical(other.password, password) || other.password == password)&&(identical(other.repeatedPassword, repeatedPassword) || other.repeatedPassword == repeatedPassword)&&(identical(other.passwordVisible, passwordVisible) || other.passwordVisible == passwordVisible)&&(identical(other.equalPasswords, equalPasswords) || other.equalPasswords == equalPasswords)&&const DeepCollectionEquality().equals(other.securityChecks, securityChecks));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,phoneNumber,dialCode,email,errorMessage,recoveryFormat,isLoading,recoveryRequested,passwordChanged,token,password,repeatedPassword,passwordVisible,equalPasswords,newDialCode,newPhoneNumber,const DeepCollectionEquality().hash(securityChecks));
|
||||
int get hashCode => Object.hash(runtimeType,email,errorMessage,isLoading,recoveryRequested,passwordChanged,token,password,repeatedPassword,passwordVisible,equalPasswords,const DeepCollectionEquality().hash(securityChecks));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LegacyRecoverPasswordViewState(phoneNumber: $phoneNumber, dialCode: $dialCode, email: $email, errorMessage: $errorMessage, recoveryFormat: $recoveryFormat, isLoading: $isLoading, recoveryRequested: $recoveryRequested, passwordChanged: $passwordChanged, token: $token, password: $password, repeatedPassword: $repeatedPassword, passwordVisible: $passwordVisible, equalPasswords: $equalPasswords, newDialCode: $newDialCode, newPhoneNumber: $newPhoneNumber, securityChecks: $securityChecks)';
|
||||
return 'LegacyRecoverPasswordViewState(email: $email, errorMessage: $errorMessage, isLoading: $isLoading, recoveryRequested: $recoveryRequested, passwordChanged: $passwordChanged, token: $token, password: $password, repeatedPassword: $repeatedPassword, passwordVisible: $passwordVisible, equalPasswords: $equalPasswords, securityChecks: $securityChecks)';
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ abstract mixin class $LegacyRecoverPasswordViewStateCopyWith<$Res> {
|
||||
factory $LegacyRecoverPasswordViewStateCopyWith(LegacyRecoverPasswordViewState value, $Res Function(LegacyRecoverPasswordViewState) _then) = _$LegacyRecoverPasswordViewStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String phoneNumber, String dialCode, String email, String errorMessage, String recoveryFormat, bool isLoading, bool recoveryRequested, bool passwordChanged, String token, String password, String repeatedPassword, bool passwordVisible, bool equalPasswords, String newDialCode, String newPhoneNumber, Map<String, bool> securityChecks
|
||||
String email, String errorMessage, bool isLoading, bool recoveryRequested, bool passwordChanged, String token, String password, String repeatedPassword, bool passwordVisible, bool equalPasswords, Map<String, bool> securityChecks
|
||||
});
|
||||
|
||||
|
||||
@@ -62,13 +62,10 @@ class _$LegacyRecoverPasswordViewStateCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of LegacyRecoverPasswordViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? phoneNumber = null,Object? dialCode = null,Object? email = null,Object? errorMessage = null,Object? recoveryFormat = null,Object? isLoading = null,Object? recoveryRequested = null,Object? passwordChanged = null,Object? token = null,Object? password = null,Object? repeatedPassword = null,Object? passwordVisible = null,Object? equalPasswords = null,Object? newDialCode = null,Object? newPhoneNumber = null,Object? securityChecks = null,}) {
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? email = null,Object? errorMessage = null,Object? isLoading = null,Object? recoveryRequested = null,Object? passwordChanged = null,Object? token = null,Object? password = null,Object? repeatedPassword = null,Object? passwordVisible = null,Object? equalPasswords = null,Object? securityChecks = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
phoneNumber: null == phoneNumber ? _self.phoneNumber : phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,dialCode: null == dialCode ? _self.dialCode : dialCode // ignore: cast_nullable_to_non_nullable
|
||||
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
||||
email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
||||
as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,recoveryFormat: null == recoveryFormat ? _self.recoveryFormat : recoveryFormat // ignore: cast_nullable_to_non_nullable
|
||||
as String,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,recoveryRequested: null == recoveryRequested ? _self.recoveryRequested : recoveryRequested // ignore: cast_nullable_to_non_nullable
|
||||
as bool,passwordChanged: null == passwordChanged ? _self.passwordChanged : passwordChanged // ignore: cast_nullable_to_non_nullable
|
||||
@@ -77,9 +74,7 @@ as String,password: null == password ? _self.password : password // ignore: cast
|
||||
as String,repeatedPassword: null == repeatedPassword ? _self.repeatedPassword : repeatedPassword // ignore: cast_nullable_to_non_nullable
|
||||
as String,passwordVisible: null == passwordVisible ? _self.passwordVisible : passwordVisible // ignore: cast_nullable_to_non_nullable
|
||||
as bool,equalPasswords: null == equalPasswords ? _self.equalPasswords : equalPasswords // ignore: cast_nullable_to_non_nullable
|
||||
as bool,newDialCode: null == newDialCode ? _self.newDialCode : newDialCode // ignore: cast_nullable_to_non_nullable
|
||||
as String,newPhoneNumber: null == newPhoneNumber ? _self.newPhoneNumber : newPhoneNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,securityChecks: null == securityChecks ? _self.securityChecks : securityChecks // ignore: cast_nullable_to_non_nullable
|
||||
as bool,securityChecks: null == securityChecks ? _self.securityChecks : securityChecks // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, bool>,
|
||||
));
|
||||
}
|
||||
@@ -165,10 +160,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String phoneNumber, String dialCode, String email, String errorMessage, String recoveryFormat, bool isLoading, bool recoveryRequested, bool passwordChanged, String token, String password, String repeatedPassword, bool passwordVisible, bool equalPasswords, String newDialCode, String newPhoneNumber, Map<String, bool> securityChecks)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String email, String errorMessage, bool isLoading, bool recoveryRequested, bool passwordChanged, String token, String password, String repeatedPassword, bool passwordVisible, bool equalPasswords, Map<String, bool> securityChecks)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyRecoverPasswordViewState() when $default != null:
|
||||
return $default(_that.phoneNumber,_that.dialCode,_that.email,_that.errorMessage,_that.recoveryFormat,_that.isLoading,_that.recoveryRequested,_that.passwordChanged,_that.token,_that.password,_that.repeatedPassword,_that.passwordVisible,_that.equalPasswords,_that.newDialCode,_that.newPhoneNumber,_that.securityChecks);case _:
|
||||
return $default(_that.email,_that.errorMessage,_that.isLoading,_that.recoveryRequested,_that.passwordChanged,_that.token,_that.password,_that.repeatedPassword,_that.passwordVisible,_that.equalPasswords,_that.securityChecks);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -186,10 +181,10 @@ return $default(_that.phoneNumber,_that.dialCode,_that.email,_that.errorMessage,
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String phoneNumber, String dialCode, String email, String errorMessage, String recoveryFormat, bool isLoading, bool recoveryRequested, bool passwordChanged, String token, String password, String repeatedPassword, bool passwordVisible, bool equalPasswords, String newDialCode, String newPhoneNumber, Map<String, bool> securityChecks) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String email, String errorMessage, bool isLoading, bool recoveryRequested, bool passwordChanged, String token, String password, String repeatedPassword, bool passwordVisible, bool equalPasswords, Map<String, bool> securityChecks) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyRecoverPasswordViewState():
|
||||
return $default(_that.phoneNumber,_that.dialCode,_that.email,_that.errorMessage,_that.recoveryFormat,_that.isLoading,_that.recoveryRequested,_that.passwordChanged,_that.token,_that.password,_that.repeatedPassword,_that.passwordVisible,_that.equalPasswords,_that.newDialCode,_that.newPhoneNumber,_that.securityChecks);case _:
|
||||
return $default(_that.email,_that.errorMessage,_that.isLoading,_that.recoveryRequested,_that.passwordChanged,_that.token,_that.password,_that.repeatedPassword,_that.passwordVisible,_that.equalPasswords,_that.securityChecks);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -206,10 +201,10 @@ return $default(_that.phoneNumber,_that.dialCode,_that.email,_that.errorMessage,
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String phoneNumber, String dialCode, String email, String errorMessage, String recoveryFormat, bool isLoading, bool recoveryRequested, bool passwordChanged, String token, String password, String repeatedPassword, bool passwordVisible, bool equalPasswords, String newDialCode, String newPhoneNumber, Map<String, bool> securityChecks)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String email, String errorMessage, bool isLoading, bool recoveryRequested, bool passwordChanged, String token, String password, String repeatedPassword, bool passwordVisible, bool equalPasswords, Map<String, bool> securityChecks)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyRecoverPasswordViewState() when $default != null:
|
||||
return $default(_that.phoneNumber,_that.dialCode,_that.email,_that.errorMessage,_that.recoveryFormat,_that.isLoading,_that.recoveryRequested,_that.passwordChanged,_that.token,_that.password,_that.repeatedPassword,_that.passwordVisible,_that.equalPasswords,_that.newDialCode,_that.newPhoneNumber,_that.securityChecks);case _:
|
||||
return $default(_that.email,_that.errorMessage,_that.isLoading,_that.recoveryRequested,_that.passwordChanged,_that.token,_that.password,_that.repeatedPassword,_that.passwordVisible,_that.equalPasswords,_that.securityChecks);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -221,14 +216,11 @@ return $default(_that.phoneNumber,_that.dialCode,_that.email,_that.errorMessage,
|
||||
|
||||
|
||||
class _LegacyRecoverPasswordViewState implements LegacyRecoverPasswordViewState {
|
||||
const _LegacyRecoverPasswordViewState({this.phoneNumber = '', this.dialCode = '+34', this.email = '', this.errorMessage = '', this.recoveryFormat = '', this.isLoading = false, this.recoveryRequested = false, this.passwordChanged = false, this.token = '', this.password = '', this.repeatedPassword = '', this.passwordVisible = false, this.equalPasswords = true, this.newDialCode = '+34', this.newPhoneNumber = '', final Map<String, bool> securityChecks = const {'min' : false, 'capital' : false, 'number' : false, 'special' : false}}): _securityChecks = securityChecks;
|
||||
const _LegacyRecoverPasswordViewState({this.email = '', this.errorMessage = '', this.isLoading = false, this.recoveryRequested = false, this.passwordChanged = false, this.token = '', this.password = '', this.repeatedPassword = '', this.passwordVisible = false, this.equalPasswords = true, final Map<String, bool> securityChecks = const {'min' : false, 'capital' : false, 'number' : false, 'special' : false}}): _securityChecks = securityChecks;
|
||||
|
||||
|
||||
@override@JsonKey() final String phoneNumber;
|
||||
@override@JsonKey() final String dialCode;
|
||||
@override@JsonKey() final String email;
|
||||
@override@JsonKey() final String errorMessage;
|
||||
@override@JsonKey() final String recoveryFormat;
|
||||
@override@JsonKey() final bool isLoading;
|
||||
@override@JsonKey() final bool recoveryRequested;
|
||||
@override@JsonKey() final bool passwordChanged;
|
||||
@@ -237,8 +229,6 @@ class _LegacyRecoverPasswordViewState implements LegacyRecoverPasswordViewState
|
||||
@override@JsonKey() final String repeatedPassword;
|
||||
@override@JsonKey() final bool passwordVisible;
|
||||
@override@JsonKey() final bool equalPasswords;
|
||||
@override@JsonKey() final String newDialCode;
|
||||
@override@JsonKey() final String newPhoneNumber;
|
||||
final Map<String, bool> _securityChecks;
|
||||
@override@JsonKey() Map<String, bool> get securityChecks {
|
||||
if (_securityChecks is EqualUnmodifiableMapView) return _securityChecks;
|
||||
@@ -257,16 +247,16 @@ _$LegacyRecoverPasswordViewStateCopyWith<_LegacyRecoverPasswordViewState> get co
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LegacyRecoverPasswordViewState&&(identical(other.phoneNumber, phoneNumber) || other.phoneNumber == phoneNumber)&&(identical(other.dialCode, dialCode) || other.dialCode == dialCode)&&(identical(other.email, email) || other.email == email)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.recoveryFormat, recoveryFormat) || other.recoveryFormat == recoveryFormat)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.recoveryRequested, recoveryRequested) || other.recoveryRequested == recoveryRequested)&&(identical(other.passwordChanged, passwordChanged) || other.passwordChanged == passwordChanged)&&(identical(other.token, token) || other.token == token)&&(identical(other.password, password) || other.password == password)&&(identical(other.repeatedPassword, repeatedPassword) || other.repeatedPassword == repeatedPassword)&&(identical(other.passwordVisible, passwordVisible) || other.passwordVisible == passwordVisible)&&(identical(other.equalPasswords, equalPasswords) || other.equalPasswords == equalPasswords)&&(identical(other.newDialCode, newDialCode) || other.newDialCode == newDialCode)&&(identical(other.newPhoneNumber, newPhoneNumber) || other.newPhoneNumber == newPhoneNumber)&&const DeepCollectionEquality().equals(other._securityChecks, _securityChecks));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LegacyRecoverPasswordViewState&&(identical(other.email, email) || other.email == email)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.recoveryRequested, recoveryRequested) || other.recoveryRequested == recoveryRequested)&&(identical(other.passwordChanged, passwordChanged) || other.passwordChanged == passwordChanged)&&(identical(other.token, token) || other.token == token)&&(identical(other.password, password) || other.password == password)&&(identical(other.repeatedPassword, repeatedPassword) || other.repeatedPassword == repeatedPassword)&&(identical(other.passwordVisible, passwordVisible) || other.passwordVisible == passwordVisible)&&(identical(other.equalPasswords, equalPasswords) || other.equalPasswords == equalPasswords)&&const DeepCollectionEquality().equals(other._securityChecks, _securityChecks));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,phoneNumber,dialCode,email,errorMessage,recoveryFormat,isLoading,recoveryRequested,passwordChanged,token,password,repeatedPassword,passwordVisible,equalPasswords,newDialCode,newPhoneNumber,const DeepCollectionEquality().hash(_securityChecks));
|
||||
int get hashCode => Object.hash(runtimeType,email,errorMessage,isLoading,recoveryRequested,passwordChanged,token,password,repeatedPassword,passwordVisible,equalPasswords,const DeepCollectionEquality().hash(_securityChecks));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LegacyRecoverPasswordViewState(phoneNumber: $phoneNumber, dialCode: $dialCode, email: $email, errorMessage: $errorMessage, recoveryFormat: $recoveryFormat, isLoading: $isLoading, recoveryRequested: $recoveryRequested, passwordChanged: $passwordChanged, token: $token, password: $password, repeatedPassword: $repeatedPassword, passwordVisible: $passwordVisible, equalPasswords: $equalPasswords, newDialCode: $newDialCode, newPhoneNumber: $newPhoneNumber, securityChecks: $securityChecks)';
|
||||
return 'LegacyRecoverPasswordViewState(email: $email, errorMessage: $errorMessage, isLoading: $isLoading, recoveryRequested: $recoveryRequested, passwordChanged: $passwordChanged, token: $token, password: $password, repeatedPassword: $repeatedPassword, passwordVisible: $passwordVisible, equalPasswords: $equalPasswords, securityChecks: $securityChecks)';
|
||||
}
|
||||
|
||||
|
||||
@@ -277,7 +267,7 @@ abstract mixin class _$LegacyRecoverPasswordViewStateCopyWith<$Res> implements $
|
||||
factory _$LegacyRecoverPasswordViewStateCopyWith(_LegacyRecoverPasswordViewState value, $Res Function(_LegacyRecoverPasswordViewState) _then) = __$LegacyRecoverPasswordViewStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String phoneNumber, String dialCode, String email, String errorMessage, String recoveryFormat, bool isLoading, bool recoveryRequested, bool passwordChanged, String token, String password, String repeatedPassword, bool passwordVisible, bool equalPasswords, String newDialCode, String newPhoneNumber, Map<String, bool> securityChecks
|
||||
String email, String errorMessage, bool isLoading, bool recoveryRequested, bool passwordChanged, String token, String password, String repeatedPassword, bool passwordVisible, bool equalPasswords, Map<String, bool> securityChecks
|
||||
});
|
||||
|
||||
|
||||
@@ -294,13 +284,10 @@ class __$LegacyRecoverPasswordViewStateCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of LegacyRecoverPasswordViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? phoneNumber = null,Object? dialCode = null,Object? email = null,Object? errorMessage = null,Object? recoveryFormat = null,Object? isLoading = null,Object? recoveryRequested = null,Object? passwordChanged = null,Object? token = null,Object? password = null,Object? repeatedPassword = null,Object? passwordVisible = null,Object? equalPasswords = null,Object? newDialCode = null,Object? newPhoneNumber = null,Object? securityChecks = null,}) {
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? email = null,Object? errorMessage = null,Object? isLoading = null,Object? recoveryRequested = null,Object? passwordChanged = null,Object? token = null,Object? password = null,Object? repeatedPassword = null,Object? passwordVisible = null,Object? equalPasswords = null,Object? securityChecks = null,}) {
|
||||
return _then(_LegacyRecoverPasswordViewState(
|
||||
phoneNumber: null == phoneNumber ? _self.phoneNumber : phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,dialCode: null == dialCode ? _self.dialCode : dialCode // ignore: cast_nullable_to_non_nullable
|
||||
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
||||
email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
||||
as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,recoveryFormat: null == recoveryFormat ? _self.recoveryFormat : recoveryFormat // ignore: cast_nullable_to_non_nullable
|
||||
as String,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,recoveryRequested: null == recoveryRequested ? _self.recoveryRequested : recoveryRequested // ignore: cast_nullable_to_non_nullable
|
||||
as bool,passwordChanged: null == passwordChanged ? _self.passwordChanged : passwordChanged // ignore: cast_nullable_to_non_nullable
|
||||
@@ -309,9 +296,7 @@ as String,password: null == password ? _self.password : password // ignore: cast
|
||||
as String,repeatedPassword: null == repeatedPassword ? _self.repeatedPassword : repeatedPassword // ignore: cast_nullable_to_non_nullable
|
||||
as String,passwordVisible: null == passwordVisible ? _self.passwordVisible : passwordVisible // ignore: cast_nullable_to_non_nullable
|
||||
as bool,equalPasswords: null == equalPasswords ? _self.equalPasswords : equalPasswords // ignore: cast_nullable_to_non_nullable
|
||||
as bool,newDialCode: null == newDialCode ? _self.newDialCode : newDialCode // ignore: cast_nullable_to_non_nullable
|
||||
as String,newPhoneNumber: null == newPhoneNumber ? _self.newPhoneNumber : newPhoneNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,securityChecks: null == securityChecks ? _self._securityChecks : securityChecks // ignore: cast_nullable_to_non_nullable
|
||||
as bool,securityChecks: null == securityChecks ? _self._securityChecks : securityChecks // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, bool>,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'address_entity.freezed.dart';
|
||||
|
||||
@freezed
|
||||
abstract class LegacyAddressEntity with _$LegacyAddressEntity {
|
||||
const factory LegacyAddressEntity({
|
||||
required String street,
|
||||
required String city,
|
||||
required String province,
|
||||
required String state,
|
||||
required String country,
|
||||
required int postCode,
|
||||
}) = _LegacyAddressEntity;
|
||||
}
|
||||
@@ -1,286 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// 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 'address_entity.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$LegacyAddressEntity {
|
||||
|
||||
String get street; String get city; String get province; String get state; String get country; int get postCode;
|
||||
/// Create a copy of LegacyAddressEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$LegacyAddressEntityCopyWith<LegacyAddressEntity> get copyWith => _$LegacyAddressEntityCopyWithImpl<LegacyAddressEntity>(this as LegacyAddressEntity, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is LegacyAddressEntity&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country)&&(identical(other.postCode, postCode) || other.postCode == postCode));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,street,city,province,state,country,postCode);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LegacyAddressEntity(street: $street, city: $city, province: $province, state: $state, country: $country, postCode: $postCode)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $LegacyAddressEntityCopyWith<$Res> {
|
||||
factory $LegacyAddressEntityCopyWith(LegacyAddressEntity value, $Res Function(LegacyAddressEntity) _then) = _$LegacyAddressEntityCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String street, String city, String province, String state, String country, int postCode
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$LegacyAddressEntityCopyWithImpl<$Res>
|
||||
implements $LegacyAddressEntityCopyWith<$Res> {
|
||||
_$LegacyAddressEntityCopyWithImpl(this._self, this._then);
|
||||
|
||||
final LegacyAddressEntity _self;
|
||||
final $Res Function(LegacyAddressEntity) _then;
|
||||
|
||||
/// Create a copy of LegacyAddressEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? street = null,Object? city = null,Object? province = null,Object? state = null,Object? country = null,Object? postCode = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
street: null == street ? _self.street : street // ignore: cast_nullable_to_non_nullable
|
||||
as String,city: null == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
|
||||
as String,province: null == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
|
||||
as String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
|
||||
as String,country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
|
||||
as String,postCode: null == postCode ? _self.postCode : postCode // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [LegacyAddressEntity].
|
||||
extension LegacyAddressEntityPatterns on LegacyAddressEntity {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _LegacyAddressEntity value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyAddressEntity() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _LegacyAddressEntity value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyAddressEntity():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _LegacyAddressEntity value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyAddressEntity() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String street, String city, String province, String state, String country, int postCode)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyAddressEntity() when $default != null:
|
||||
return $default(_that.street,_that.city,_that.province,_that.state,_that.country,_that.postCode);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String street, String city, String province, String state, String country, int postCode) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyAddressEntity():
|
||||
return $default(_that.street,_that.city,_that.province,_that.state,_that.country,_that.postCode);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String street, String city, String province, String state, String country, int postCode)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyAddressEntity() when $default != null:
|
||||
return $default(_that.street,_that.city,_that.province,_that.state,_that.country,_that.postCode);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _LegacyAddressEntity implements LegacyAddressEntity {
|
||||
const _LegacyAddressEntity({required this.street, required this.city, required this.province, required this.state, required this.country, required this.postCode});
|
||||
|
||||
|
||||
@override final String street;
|
||||
@override final String city;
|
||||
@override final String province;
|
||||
@override final String state;
|
||||
@override final String country;
|
||||
@override final int postCode;
|
||||
|
||||
/// Create a copy of LegacyAddressEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$LegacyAddressEntityCopyWith<_LegacyAddressEntity> get copyWith => __$LegacyAddressEntityCopyWithImpl<_LegacyAddressEntity>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LegacyAddressEntity&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country)&&(identical(other.postCode, postCode) || other.postCode == postCode));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,street,city,province,state,country,postCode);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LegacyAddressEntity(street: $street, city: $city, province: $province, state: $state, country: $country, postCode: $postCode)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$LegacyAddressEntityCopyWith<$Res> implements $LegacyAddressEntityCopyWith<$Res> {
|
||||
factory _$LegacyAddressEntityCopyWith(_LegacyAddressEntity value, $Res Function(_LegacyAddressEntity) _then) = __$LegacyAddressEntityCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String street, String city, String province, String state, String country, int postCode
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$LegacyAddressEntityCopyWithImpl<$Res>
|
||||
implements _$LegacyAddressEntityCopyWith<$Res> {
|
||||
__$LegacyAddressEntityCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _LegacyAddressEntity _self;
|
||||
final $Res Function(_LegacyAddressEntity) _then;
|
||||
|
||||
/// Create a copy of LegacyAddressEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? street = null,Object? city = null,Object? province = null,Object? state = null,Object? country = null,Object? postCode = null,}) {
|
||||
return _then(_LegacyAddressEntity(
|
||||
street: null == street ? _self.street : street // ignore: cast_nullable_to_non_nullable
|
||||
as String,city: null == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
|
||||
as String,province: null == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
|
||||
as String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
|
||||
as String,country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
|
||||
as String,postCode: null == postCode ? _self.postCode : postCode // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -1,24 +1,15 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'address_entity.dart';
|
||||
|
||||
part 'sign_up_request_entity.freezed.dart';
|
||||
|
||||
@freezed
|
||||
abstract class LegacySignUpRequestEntity with _$LegacySignUpRequestEntity {
|
||||
const factory LegacySignUpRequestEntity({
|
||||
required String documentType,
|
||||
required String document,
|
||||
required String relationType,
|
||||
required String firstName,
|
||||
required String lastName,
|
||||
required String email,
|
||||
required String phone,
|
||||
required String language,
|
||||
required String password,
|
||||
required List<LegacyAddressEntity> taxResidences,
|
||||
required List<LegacyAddressEntity> addresses,
|
||||
required int bornAt,
|
||||
required String placeOfBirth,
|
||||
required String birthCountry,
|
||||
}) = _LegacySignUpRequestEntity;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$LegacySignUpRequestEntity {
|
||||
|
||||
String get documentType; String get document; String get relationType; String get firstName; String get lastName; String get email; String get phone; String get language; String get password; List<LegacyAddressEntity> get taxResidences; List<LegacyAddressEntity> get addresses; int get bornAt; String get placeOfBirth; String get birthCountry;
|
||||
String get firstName; String get lastName; String get email; String get phone; String get language; String get password;
|
||||
/// Create a copy of LegacySignUpRequestEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -25,16 +25,16 @@ $LegacySignUpRequestEntityCopyWith<LegacySignUpRequestEntity> get copyWith => _$
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is LegacySignUpRequestEntity&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.document, document) || other.document == document)&&(identical(other.relationType, relationType) || other.relationType == relationType)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.language, language) || other.language == language)&&(identical(other.password, password) || other.password == password)&&const DeepCollectionEquality().equals(other.taxResidences, taxResidences)&&const DeepCollectionEquality().equals(other.addresses, addresses)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is LegacySignUpRequestEntity&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.language, language) || other.language == language)&&(identical(other.password, password) || other.password == password));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,documentType,document,relationType,firstName,lastName,email,phone,language,password,const DeepCollectionEquality().hash(taxResidences),const DeepCollectionEquality().hash(addresses),bornAt,placeOfBirth,birthCountry);
|
||||
int get hashCode => Object.hash(runtimeType,firstName,lastName,email,phone,language,password);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LegacySignUpRequestEntity(documentType: $documentType, document: $document, relationType: $relationType, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, password: $password, taxResidences: $taxResidences, addresses: $addresses, bornAt: $bornAt, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry)';
|
||||
return 'LegacySignUpRequestEntity(firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, password: $password)';
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ abstract mixin class $LegacySignUpRequestEntityCopyWith<$Res> {
|
||||
factory $LegacySignUpRequestEntityCopyWith(LegacySignUpRequestEntity value, $Res Function(LegacySignUpRequestEntity) _then) = _$LegacySignUpRequestEntityCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String documentType, String document, String relationType, String firstName, String lastName, String email, String phone, String language, String password, List<LegacyAddressEntity> taxResidences, List<LegacyAddressEntity> addresses, int bornAt, String placeOfBirth, String birthCountry
|
||||
String firstName, String lastName, String email, String phone, String language, String password
|
||||
});
|
||||
|
||||
|
||||
@@ -62,22 +62,14 @@ class _$LegacySignUpRequestEntityCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of LegacySignUpRequestEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? documentType = null,Object? document = null,Object? relationType = null,Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? language = null,Object? password = null,Object? taxResidences = null,Object? addresses = null,Object? bornAt = null,Object? placeOfBirth = null,Object? birthCountry = null,}) {
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? language = null,Object? password = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
documentType: null == documentType ? _self.documentType : documentType // ignore: cast_nullable_to_non_nullable
|
||||
as String,document: null == document ? _self.document : document // ignore: cast_nullable_to_non_nullable
|
||||
as String,relationType: null == relationType ? _self.relationType : relationType // ignore: cast_nullable_to_non_nullable
|
||||
as String,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
||||
firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
||||
as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
|
||||
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
||||
as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||
as String,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
|
||||
as String,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
|
||||
as String,taxResidences: null == taxResidences ? _self.taxResidences : taxResidences // ignore: cast_nullable_to_non_nullable
|
||||
as List<LegacyAddressEntity>,addresses: null == addresses ? _self.addresses : addresses // ignore: cast_nullable_to_non_nullable
|
||||
as List<LegacyAddressEntity>,bornAt: null == bornAt ? _self.bornAt : bornAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,placeOfBirth: null == placeOfBirth ? _self.placeOfBirth : placeOfBirth // ignore: cast_nullable_to_non_nullable
|
||||
as String,birthCountry: null == birthCountry ? _self.birthCountry : birthCountry // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
@@ -163,10 +155,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String documentType, String document, String relationType, String firstName, String lastName, String email, String phone, String language, String password, List<LegacyAddressEntity> taxResidences, List<LegacyAddressEntity> addresses, int bornAt, String placeOfBirth, String birthCountry)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String firstName, String lastName, String email, String phone, String language, String password)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacySignUpRequestEntity() when $default != null:
|
||||
return $default(_that.documentType,_that.document,_that.relationType,_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.placeOfBirth,_that.birthCountry);case _:
|
||||
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -184,10 +176,10 @@ return $default(_that.documentType,_that.document,_that.relationType,_that.first
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String documentType, String document, String relationType, String firstName, String lastName, String email, String phone, String language, String password, List<LegacyAddressEntity> taxResidences, List<LegacyAddressEntity> addresses, int bornAt, String placeOfBirth, String birthCountry) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String firstName, String lastName, String email, String phone, String language, String password) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacySignUpRequestEntity():
|
||||
return $default(_that.documentType,_that.document,_that.relationType,_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.placeOfBirth,_that.birthCountry);case _:
|
||||
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -204,10 +196,10 @@ return $default(_that.documentType,_that.document,_that.relationType,_that.first
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String documentType, String document, String relationType, String firstName, String lastName, String email, String phone, String language, String password, List<LegacyAddressEntity> taxResidences, List<LegacyAddressEntity> addresses, int bornAt, String placeOfBirth, String birthCountry)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String firstName, String lastName, String email, String phone, String language, String password)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacySignUpRequestEntity() when $default != null:
|
||||
return $default(_that.documentType,_that.document,_that.relationType,_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.placeOfBirth,_that.birthCountry);case _:
|
||||
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -219,35 +211,15 @@ return $default(_that.documentType,_that.document,_that.relationType,_that.first
|
||||
|
||||
|
||||
class _LegacySignUpRequestEntity implements LegacySignUpRequestEntity {
|
||||
const _LegacySignUpRequestEntity({required this.documentType, required this.document, required this.relationType, required this.firstName, required this.lastName, required this.email, required this.phone, required this.language, required this.password, required final List<LegacyAddressEntity> taxResidences, required final List<LegacyAddressEntity> addresses, required this.bornAt, required this.placeOfBirth, required this.birthCountry}): _taxResidences = taxResidences,_addresses = addresses;
|
||||
const _LegacySignUpRequestEntity({required this.firstName, required this.lastName, required this.email, required this.phone, required this.language, required this.password});
|
||||
|
||||
|
||||
@override final String documentType;
|
||||
@override final String document;
|
||||
@override final String relationType;
|
||||
@override final String firstName;
|
||||
@override final String lastName;
|
||||
@override final String email;
|
||||
@override final String phone;
|
||||
@override final String language;
|
||||
@override final String password;
|
||||
final List<LegacyAddressEntity> _taxResidences;
|
||||
@override List<LegacyAddressEntity> get taxResidences {
|
||||
if (_taxResidences is EqualUnmodifiableListView) return _taxResidences;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_taxResidences);
|
||||
}
|
||||
|
||||
final List<LegacyAddressEntity> _addresses;
|
||||
@override List<LegacyAddressEntity> get addresses {
|
||||
if (_addresses is EqualUnmodifiableListView) return _addresses;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_addresses);
|
||||
}
|
||||
|
||||
@override final int bornAt;
|
||||
@override final String placeOfBirth;
|
||||
@override final String birthCountry;
|
||||
|
||||
/// Create a copy of LegacySignUpRequestEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -259,16 +231,16 @@ _$LegacySignUpRequestEntityCopyWith<_LegacySignUpRequestEntity> get copyWith =>
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LegacySignUpRequestEntity&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.document, document) || other.document == document)&&(identical(other.relationType, relationType) || other.relationType == relationType)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.language, language) || other.language == language)&&(identical(other.password, password) || other.password == password)&&const DeepCollectionEquality().equals(other._taxResidences, _taxResidences)&&const DeepCollectionEquality().equals(other._addresses, _addresses)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LegacySignUpRequestEntity&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.language, language) || other.language == language)&&(identical(other.password, password) || other.password == password));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,documentType,document,relationType,firstName,lastName,email,phone,language,password,const DeepCollectionEquality().hash(_taxResidences),const DeepCollectionEquality().hash(_addresses),bornAt,placeOfBirth,birthCountry);
|
||||
int get hashCode => Object.hash(runtimeType,firstName,lastName,email,phone,language,password);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LegacySignUpRequestEntity(documentType: $documentType, document: $document, relationType: $relationType, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, password: $password, taxResidences: $taxResidences, addresses: $addresses, bornAt: $bornAt, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry)';
|
||||
return 'LegacySignUpRequestEntity(firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, password: $password)';
|
||||
}
|
||||
|
||||
|
||||
@@ -279,7 +251,7 @@ abstract mixin class _$LegacySignUpRequestEntityCopyWith<$Res> implements $Legac
|
||||
factory _$LegacySignUpRequestEntityCopyWith(_LegacySignUpRequestEntity value, $Res Function(_LegacySignUpRequestEntity) _then) = __$LegacySignUpRequestEntityCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String documentType, String document, String relationType, String firstName, String lastName, String email, String phone, String language, String password, List<LegacyAddressEntity> taxResidences, List<LegacyAddressEntity> addresses, int bornAt, String placeOfBirth, String birthCountry
|
||||
String firstName, String lastName, String email, String phone, String language, String password
|
||||
});
|
||||
|
||||
|
||||
@@ -296,22 +268,14 @@ class __$LegacySignUpRequestEntityCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of LegacySignUpRequestEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? documentType = null,Object? document = null,Object? relationType = null,Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? language = null,Object? password = null,Object? taxResidences = null,Object? addresses = null,Object? bornAt = null,Object? placeOfBirth = null,Object? birthCountry = null,}) {
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? language = null,Object? password = null,}) {
|
||||
return _then(_LegacySignUpRequestEntity(
|
||||
documentType: null == documentType ? _self.documentType : documentType // ignore: cast_nullable_to_non_nullable
|
||||
as String,document: null == document ? _self.document : document // ignore: cast_nullable_to_non_nullable
|
||||
as String,relationType: null == relationType ? _self.relationType : relationType // ignore: cast_nullable_to_non_nullable
|
||||
as String,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
||||
firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
||||
as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
|
||||
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
||||
as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||
as String,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
|
||||
as String,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
|
||||
as String,taxResidences: null == taxResidences ? _self._taxResidences : taxResidences // ignore: cast_nullable_to_non_nullable
|
||||
as List<LegacyAddressEntity>,addresses: null == addresses ? _self._addresses : addresses // ignore: cast_nullable_to_non_nullable
|
||||
as List<LegacyAddressEntity>,bornAt: null == bornAt ? _self.bornAt : bornAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,placeOfBirth: null == placeOfBirth ? _self.placeOfBirth : placeOfBirth // ignore: cast_nullable_to_non_nullable
|
||||
as String,birthCountry: null == birthCountry ? _self.birthCountry : birthCountry // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import 'package:legacy_auth/src/features/sign_up/domain/entities/address_entity.dart';
|
||||
import 'package:legacy_auth/src/features/sign_up/presentation/state/address_view_state.dart';
|
||||
|
||||
extension LegacyAddressViewStateMapper on LegacyAddressViewState {
|
||||
bool get isValid =>
|
||||
street.trim().isNotEmpty &&
|
||||
city.trim().isNotEmpty &&
|
||||
province.trim().isNotEmpty &&
|
||||
state.trim().isNotEmpty &&
|
||||
country.trim().isNotEmpty &&
|
||||
(postCode != null);
|
||||
|
||||
LegacyAddressEntity toEntity() {
|
||||
return LegacyAddressEntity(
|
||||
street: street.trim(),
|
||||
city: city.trim(),
|
||||
province: province.trim(),
|
||||
state: state.trim(),
|
||||
country: country.trim(),
|
||||
postCode: postCode ?? 0,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:legacy_auth/src/features/sign_up/presentation/mappers/address_view_state_mapper.dart';
|
||||
import 'package:legacy_auth/src/features/sign_up/presentation/state/address_view_state.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
|
||||
mixin SignUpFormValidation {
|
||||
static final RegExp _emailRegex = RegExp(
|
||||
@@ -8,10 +7,14 @@ mixin SignUpFormValidation {
|
||||
caseSensitive: false,
|
||||
);
|
||||
|
||||
static final RegExp _phoneRegex = RegExp(r'^\+?\d{6,15}$');
|
||||
|
||||
static final RegExp _nameRegex = RegExp(r"^[a-zA-ZÀ-ÿ\s\-']+$");
|
||||
|
||||
static final RegExp _upperRegex = RegExp(r'[A-Z]');
|
||||
static final RegExp _digitRegex = RegExp(r'[0-9]');
|
||||
static final RegExp _specialRegex = RegExp(
|
||||
r'[!@#$%^&*(),.?":{}|<>\-_+=\[\]\\\/~`]',
|
||||
);
|
||||
|
||||
String emailErrorFor(String value) {
|
||||
final email = value.trim();
|
||||
if (email.isEmpty) return I18n.errorEmailRequired;
|
||||
@@ -19,12 +22,6 @@ mixin SignUpFormValidation {
|
||||
return '';
|
||||
}
|
||||
|
||||
static final RegExp _upperRegex = RegExp(r'[A-Z]');
|
||||
static final RegExp _digitRegex = RegExp(r'[0-9]');
|
||||
static final RegExp _specialRegex = RegExp(
|
||||
r'[!@#$%^&*(),.?":{}|<>\-_+=\[\]\\\/~`]',
|
||||
);
|
||||
|
||||
String passwordErrorFor({
|
||||
required String password,
|
||||
required String repeatPassword,
|
||||
@@ -50,15 +47,14 @@ mixin SignUpFormValidation {
|
||||
bool hasNumber(String password) => _digitRegex.hasMatch(password);
|
||||
bool hasSpecialChar(String password) => _specialRegex.hasMatch(password);
|
||||
|
||||
String phoneErrorFor(String value) {
|
||||
String phoneErrorFor(String value, String isoCode) {
|
||||
final phone = value.trim();
|
||||
if (phone.isEmpty) return I18n.errorMessagePhoneIsEmpty;
|
||||
if (!_phoneRegex.hasMatch(phone)) return I18n.errorMessagePhoneIsEmpty;
|
||||
final parsed = SfPhoneNumber.tryParse(phone, defaultIsoCode: isoCode);
|
||||
if (parsed == null) return I18n.errorMessagePhoneIsInvalid;
|
||||
return '';
|
||||
}
|
||||
|
||||
bool isNameValid(String name) =>
|
||||
name.trim().isNotEmpty && _nameRegex.hasMatch(name.trim());
|
||||
|
||||
bool isAddressValid(LegacyAddressViewState address) => address.isValid;
|
||||
}
|
||||
|
||||
@@ -1,232 +0,0 @@
|
||||
import 'package:country_code_picker/country_code_picker.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
|
||||
class LegacySignupAddressScreen extends StatelessWidget {
|
||||
const LegacySignupAddressScreen({
|
||||
super.key,
|
||||
|
||||
required this.bornAtController,
|
||||
required this.onPickBornAt,
|
||||
required this.relationshipSelected,
|
||||
required this.onRelationshipChanged,
|
||||
required this.relationshipOptions,
|
||||
required this.relationshipHint,
|
||||
required this.relationshipLabel,
|
||||
|
||||
required this.placeOfBirthController,
|
||||
required this.birthCountryController,
|
||||
|
||||
required this.streetController,
|
||||
required this.cityController,
|
||||
required this.provinceController,
|
||||
required this.stateController,
|
||||
|
||||
required this.addressCountrySelected,
|
||||
required this.onAddressCountryChanged,
|
||||
required this.addressCountryController,
|
||||
required this.addressCountryLabel,
|
||||
|
||||
required this.postCodeController,
|
||||
|
||||
required this.birthDateLabel,
|
||||
required this.birthDateHint,
|
||||
|
||||
required this.placeOfBirthLabel,
|
||||
required this.placeOfBirthHint,
|
||||
|
||||
required this.birthCountryLabel,
|
||||
required this.birthCountryHint,
|
||||
required this.onBirthCountryChanged,
|
||||
|
||||
required this.streetLabel,
|
||||
required this.streetHint,
|
||||
|
||||
required this.cityLabel,
|
||||
required this.cityHint,
|
||||
|
||||
required this.provinceLabel,
|
||||
required this.provinceHint,
|
||||
|
||||
required this.stateLabel,
|
||||
required this.stateHint,
|
||||
|
||||
required this.postCodeLabel,
|
||||
required this.postCodeHint,
|
||||
});
|
||||
|
||||
final TextEditingController bornAtController;
|
||||
final VoidCallback onPickBornAt;
|
||||
|
||||
final String? relationshipSelected;
|
||||
final ValueChanged<String?> onRelationshipChanged;
|
||||
final List<String> relationshipOptions;
|
||||
final String relationshipHint;
|
||||
final String relationshipLabel;
|
||||
|
||||
final TextEditingController placeOfBirthController;
|
||||
final TextEditingController birthCountryController;
|
||||
|
||||
final TextEditingController streetController;
|
||||
final TextEditingController cityController;
|
||||
final TextEditingController provinceController;
|
||||
final TextEditingController stateController;
|
||||
|
||||
final String? addressCountrySelected;
|
||||
final ValueChanged<CountryCode> onAddressCountryChanged;
|
||||
final String addressCountryLabel;
|
||||
final TextEditingController addressCountryController;
|
||||
|
||||
final TextEditingController postCodeController;
|
||||
|
||||
final String birthDateLabel;
|
||||
final String birthDateHint;
|
||||
|
||||
final String placeOfBirthLabel;
|
||||
final String placeOfBirthHint;
|
||||
final ValueChanged<CountryCode> onBirthCountryChanged;
|
||||
|
||||
final String birthCountryLabel;
|
||||
final String birthCountryHint;
|
||||
|
||||
final String streetLabel;
|
||||
final String streetHint;
|
||||
|
||||
final String cityLabel;
|
||||
final String cityHint;
|
||||
|
||||
final String provinceLabel;
|
||||
final String provinceHint;
|
||||
|
||||
final String stateLabel;
|
||||
final String stateHint;
|
||||
|
||||
final String postCodeLabel;
|
||||
final String postCodeHint;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: onPickBornAt,
|
||||
child: AbsorbPointer(
|
||||
child: CustomTextField(
|
||||
label: birthDateLabel,
|
||||
hint: birthDateHint,
|
||||
controller: bornAtController,
|
||||
readOnly: true,
|
||||
keyboardType: TextInputType.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 8),
|
||||
|
||||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(relationshipLabel, style: const TextStyle(fontSize: 14)),
|
||||
),
|
||||
CustomDropdown(
|
||||
items: relationshipOptions.map(Text.new).toList(growable: false),
|
||||
values: relationshipOptions,
|
||||
value: relationshipSelected,
|
||||
hint: relationshipHint,
|
||||
onChanged: (v) => onRelationshipChanged(v as String?),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
CustomTextField(
|
||||
label: placeOfBirthLabel,
|
||||
hint: placeOfBirthHint,
|
||||
controller: placeOfBirthController,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(birthCountryLabel, style: const TextStyle(fontSize: 14)),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
CountryPrefixPicker(
|
||||
headerText: context.translate(I18n.selectYourCountry),
|
||||
onChanged: onBirthCountryChanged,
|
||||
),
|
||||
Expanded(
|
||||
child: CustomTextField(
|
||||
readOnly: true,
|
||||
controller: birthCountryController,
|
||||
hint: context.translate(I18n.birthCountryLabel),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
CustomTextField(
|
||||
label: streetLabel,
|
||||
hint: streetHint,
|
||||
controller: streetController,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
CustomTextField(
|
||||
label: cityLabel,
|
||||
hint: cityHint,
|
||||
controller: cityController,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
CustomTextField(
|
||||
label: provinceLabel,
|
||||
hint: provinceHint,
|
||||
controller: provinceController,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
CustomTextField(
|
||||
label: stateLabel,
|
||||
hint: stateHint,
|
||||
controller: stateController,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(
|
||||
addressCountryLabel,
|
||||
style: const TextStyle(fontSize: 14, letterSpacing: 0),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
CountryPrefixPicker(
|
||||
headerText: context.translate(I18n.selectYourCountry),
|
||||
onChanged: onAddressCountryChanged,
|
||||
),
|
||||
Expanded(
|
||||
child: CustomTextField(
|
||||
readOnly: true,
|
||||
controller: addressCountryController,
|
||||
hint: context.translate(I18n.addressCountryHint),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
CustomTextField(
|
||||
label: postCodeLabel,
|
||||
hint: postCodeHint,
|
||||
keyboardType: TextInputType.number,
|
||||
controller: postCodeController,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -6,28 +6,19 @@ import 'package:sf_localizations/sf_localizations.dart';
|
||||
class LegacySignupPersonalScreen extends StatelessWidget {
|
||||
final TextEditingController firstNameTextFieldController;
|
||||
final TextEditingController lastNameTextFieldController;
|
||||
final TextEditingController documentNumberTextFieldController;
|
||||
final TextEditingController phoneTextFieldController;
|
||||
final TextEditingController emailTextFieldController;
|
||||
|
||||
final String? documentTypeSelected;
|
||||
final ValueChanged<String?> onDocumentTypeChanged;
|
||||
|
||||
final String firstNameLabel;
|
||||
final String firstNameHint;
|
||||
|
||||
final String lastNameLabel;
|
||||
final String lastNameHint;
|
||||
|
||||
final List<String> documentTypeOptions;
|
||||
final String documentTypeHint;
|
||||
|
||||
final String documentNumberLabel;
|
||||
final String documentNumberHint;
|
||||
|
||||
final String phoneLabel;
|
||||
final String phoneHint;
|
||||
final ValueChanged<CountryCode> onDialCodeChanged;
|
||||
final String isoCode;
|
||||
final ValueChanged<CountryCode> onCountryChanged;
|
||||
|
||||
final String emailLabel;
|
||||
final String emailHint;
|
||||
@@ -41,22 +32,16 @@ class LegacySignupPersonalScreen extends StatelessWidget {
|
||||
super.key,
|
||||
required this.firstNameTextFieldController,
|
||||
required this.lastNameTextFieldController,
|
||||
required this.documentNumberTextFieldController,
|
||||
required this.phoneTextFieldController,
|
||||
required this.emailTextFieldController,
|
||||
required this.documentTypeSelected,
|
||||
required this.onDocumentTypeChanged,
|
||||
required this.firstNameLabel,
|
||||
required this.firstNameHint,
|
||||
required this.lastNameLabel,
|
||||
required this.lastNameHint,
|
||||
required this.documentTypeOptions,
|
||||
required this.documentTypeHint,
|
||||
required this.documentNumberLabel,
|
||||
required this.documentNumberHint,
|
||||
required this.phoneLabel,
|
||||
required this.phoneHint,
|
||||
required this.onDialCodeChanged,
|
||||
required this.isoCode,
|
||||
required this.onCountryChanged,
|
||||
required this.emailLabel,
|
||||
required this.emailHint,
|
||||
required this.acceptTerms,
|
||||
@@ -82,30 +67,6 @@ class LegacySignupPersonalScreen extends StatelessWidget {
|
||||
controller: lastNameTextFieldController,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CustomDropdown(
|
||||
items: documentTypeOptions
|
||||
.map(Text.new)
|
||||
.toList(growable: false),
|
||||
values: documentTypeOptions,
|
||||
value: documentTypeSelected,
|
||||
hint: documentTypeHint,
|
||||
onChanged: (v) => onDocumentTypeChanged(v as String?),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: CustomTextField(
|
||||
label: documentNumberLabel,
|
||||
hint: documentNumberHint,
|
||||
controller: documentNumberTextFieldController,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(phoneLabel, style: const TextStyle(fontSize: 14)),
|
||||
@@ -116,13 +77,14 @@ class LegacySignupPersonalScreen extends StatelessWidget {
|
||||
children: [
|
||||
CountryPrefixPicker(
|
||||
headerText: context.translate(I18n.selectYourCountry),
|
||||
onChanged: onDialCodeChanged,
|
||||
initialSelection: isoCode,
|
||||
onChanged: onCountryChanged,
|
||||
),
|
||||
Expanded(
|
||||
child: CustomTextField(
|
||||
controller: phoneTextFieldController,
|
||||
hint: context.translate(I18n.phoneNumber),
|
||||
keyboardType: TextInputType.number,
|
||||
keyboardType: TextInputType.phone,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -134,13 +96,12 @@ class LegacySignupPersonalScreen extends StatelessWidget {
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
controller: emailTextFieldController,
|
||||
),
|
||||
|
||||
CheckboxListTile(
|
||||
value: acceptTerms,
|
||||
onChanged: onAcceptTermsPressed,
|
||||
title: Text(
|
||||
termsText,
|
||||
style: TextStyle(fontSize: 16, letterSpacing: 0),
|
||||
style: const TextStyle(fontSize: 16, letterSpacing: 0),
|
||||
),
|
||||
checkboxScaleFactor: 1.5,
|
||||
contentPadding: EdgeInsets.zero,
|
||||
|
||||
@@ -1,24 +1,12 @@
|
||||
import 'package:legacy_auth/src/features/sign_up/models/sign_up_step_config.dart';
|
||||
import 'package:legacy_auth/src/features/sign_up/presentation/state/sign_up_view_model.dart';
|
||||
import 'package:legacy_auth/src/features/sign_up/presentation/screens/sign_up_address_screen.dart';
|
||||
import 'package:legacy_auth/src/features/sign_up/presentation/screens/sign_up_password_screen.dart';
|
||||
import 'package:legacy_auth/src/features/sign_up/presentation/screens/sign_up_personal_screen.dart';
|
||||
import 'package:country_code_picker/country_code_picker.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:legacy_auth/src/features/sign_up/models/sign_up_step_config.dart';
|
||||
import 'package:legacy_auth/src/features/sign_up/presentation/screens/sign_up_password_screen.dart';
|
||||
import 'package:legacy_auth/src/features/sign_up/presentation/screens/sign_up_personal_screen.dart';
|
||||
import 'package:legacy_auth/src/features/sign_up/presentation/state/sign_up_view_model.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
|
||||
const Map<String, String> documentType = <String, String>{
|
||||
'DNI': I18n.documentTypeDni,
|
||||
'NIE': I18n.documentTypeNie,
|
||||
'PASSPORT': I18n.documentTypePassport,
|
||||
};
|
||||
const Map<String, String> relationship = <String, String>{
|
||||
'FATHER': I18n.relationshipFather,
|
||||
'MOTHER': I18n.relationshipMother,
|
||||
'OTHER': I18n.relationshipTutor,
|
||||
};
|
||||
|
||||
List<LegacySignUpStepConfig> signUpSteps(BuildContext context) => [
|
||||
LegacySignUpStepConfig(
|
||||
supertitle: context.translate(I18n.stepUserContactSupertitle),
|
||||
@@ -28,31 +16,13 @@ List<LegacySignUpStepConfig> signUpSteps(BuildContext context) => [
|
||||
final theme = ref.watch(themePortProvider);
|
||||
final vm = ref.read(legacySignUpViewModelProvider.notifier);
|
||||
final state = ref.watch(legacySignUpViewModelProvider);
|
||||
final documentLabel = <String, String>{
|
||||
for (final e in documentType.entries) e.key: context.translate(e.value),
|
||||
};
|
||||
|
||||
final documentKeys = <String, String>{
|
||||
for (final e in documentLabel.entries) e.value: e.key,
|
||||
};
|
||||
|
||||
final String? documentTypeSelected = state.documentType.trim().isEmpty
|
||||
? null
|
||||
: documentLabel[state.documentType];
|
||||
return LegacySignupPersonalScreen(
|
||||
firstNameTextFieldController: vm.firstNameController,
|
||||
lastNameTextFieldController: vm.lastNameController,
|
||||
documentNumberTextFieldController: vm.documentNumberController,
|
||||
phoneTextFieldController: vm.phoneController,
|
||||
emailTextFieldController: vm.emailController,
|
||||
|
||||
documentTypeSelected: documentTypeSelected,
|
||||
|
||||
onDocumentTypeChanged: (label) {
|
||||
final documentKey = documentKeys[label ?? ''] ?? '';
|
||||
vm.setDocumentType(documentKey);
|
||||
},
|
||||
|
||||
acceptTerms: state.acceptTerms,
|
||||
onAcceptTermsPressed: (v) => vm.setAcceptTerms(v ?? false),
|
||||
termsText: context.translate(I18n.termsText),
|
||||
@@ -63,104 +33,19 @@ List<LegacySignUpStepConfig> signUpSteps(BuildContext context) => [
|
||||
lastNameLabel: context.translate(I18n.lastNameLabel),
|
||||
lastNameHint: context.translate(I18n.lastNameHint),
|
||||
|
||||
documentTypeOptions: documentLabel.values.toList(),
|
||||
documentTypeHint: context.translate(I18n.documentTypeHint),
|
||||
|
||||
documentNumberLabel: '',
|
||||
documentNumberHint: context.translate(I18n.documentNumberHint),
|
||||
phoneLabel: context.translate(I18n.phoneLabel),
|
||||
phoneHint: context.translate(I18n.phoneHint),
|
||||
emailLabel: context.translate(I18n.emailLabel),
|
||||
emailHint: context.translate(I18n.emailHint),
|
||||
|
||||
onDialCodeChanged: (CountryCode value) {
|
||||
vm.updateDialCode(value.dialCode ?? state.dialCode);
|
||||
isoCode: state.isoCode,
|
||||
onCountryChanged: (CountryCode value) {
|
||||
final code = value.code;
|
||||
if (code != null) vm.updateCountry(code);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
LegacySignUpStepConfig(
|
||||
supertitle: context.translate(I18n.stepPersonalDataSupertitle),
|
||||
title: context.translate(I18n.stepPersonalDataTitle),
|
||||
subtitle: context.translate(I18n.stepPersonalDataSubtitle),
|
||||
bodyBuilder: (context, ref) {
|
||||
final vm = ref.read(legacySignUpViewModelProvider.notifier);
|
||||
final state = ref.watch(legacySignUpViewModelProvider);
|
||||
|
||||
final relationshipLabel = <String, String>{
|
||||
for (final e in relationship.entries) e.key: context.translate(e.value),
|
||||
};
|
||||
final relationshipKeys = <String, String>{
|
||||
for (final e in relationshipLabel.entries) e.value: e.key,
|
||||
};
|
||||
final String? relationshipSelected = state.relationType.trim().isEmpty
|
||||
? null
|
||||
: relationshipLabel[state.relationType];
|
||||
|
||||
return LegacySignupAddressScreen(
|
||||
bornAtController: vm.bornAtController,
|
||||
onPickBornAt: () => vm.pickBornAt(context),
|
||||
|
||||
relationshipSelected: relationshipSelected,
|
||||
onRelationshipChanged: (label) {
|
||||
final key = relationshipKeys[label ?? ''] ?? '';
|
||||
vm.setRelationship(key);
|
||||
},
|
||||
relationshipOptions: relationshipLabel.values.toList(),
|
||||
relationshipHint: context.translate(I18n.relationshipHint),
|
||||
relationshipLabel: context.translate(I18n.relationshipLabel),
|
||||
|
||||
placeOfBirthController: vm.placeOfBirthController,
|
||||
birthCountryController: vm.birthCountryController,
|
||||
|
||||
streetController: vm.addressStreetController,
|
||||
cityController: vm.addressCityController,
|
||||
provinceController: vm.addressProvinceController,
|
||||
stateController: vm.addressStateController,
|
||||
|
||||
addressCountrySelected: state.address.country.trim().isEmpty
|
||||
? null
|
||||
: state.address.country,
|
||||
onAddressCountryChanged: (CountryCode value) {
|
||||
vm.setAddressCountry(name: value.name ?? '', code: value.code ?? '');
|
||||
},
|
||||
addressCountryLabel: context.translate(I18n.addressCountryLabel),
|
||||
addressCountryController: vm.addressCountryController,
|
||||
|
||||
postCodeController: vm.addressPostCodeController,
|
||||
|
||||
birthDateLabel: context.translate(I18n.birthDateLabel),
|
||||
birthDateHint: context.translate(I18n.birthDateHint),
|
||||
|
||||
placeOfBirthLabel: context.translate(I18n.placeOfBirthLabel),
|
||||
placeOfBirthHint: context.translate(I18n.placeOfBirthHint),
|
||||
|
||||
birthCountryLabel: context.translate(I18n.birthCountryLabel),
|
||||
birthCountryHint: context.translate(I18n.birthCountryHint),
|
||||
onBirthCountryChanged: (CountryCode value) {
|
||||
vm.setBirthCountryFromPicker(
|
||||
name: value.name ?? '',
|
||||
code: value.code ?? '',
|
||||
);
|
||||
},
|
||||
|
||||
streetLabel: context.translate(I18n.streetLabel),
|
||||
streetHint: context.translate(I18n.streetHint),
|
||||
|
||||
cityLabel: context.translate(I18n.cityLabel),
|
||||
cityHint: context.translate(I18n.cityHint),
|
||||
|
||||
provinceLabel: context.translate(I18n.provinceLabel),
|
||||
provinceHint: context.translate(I18n.provinceHint),
|
||||
|
||||
stateLabel: context.translate(I18n.stateLabel),
|
||||
stateHint: context.translate(I18n.stateHint),
|
||||
|
||||
postCodeLabel: context.translate(I18n.postCodeLabel),
|
||||
postCodeHint: context.translate(I18n.postCodeHint),
|
||||
);
|
||||
},
|
||||
),
|
||||
LegacySignUpStepConfig(
|
||||
supertitle: context.translate(I18n.stepAddressSupertitle),
|
||||
title: context.translate(I18n.stepAddressTitle),
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'address_view_state.freezed.dart';
|
||||
|
||||
@freezed
|
||||
abstract class LegacyAddressViewState with _$LegacyAddressViewState {
|
||||
const factory LegacyAddressViewState({
|
||||
@Default('') String street,
|
||||
@Default('') String city,
|
||||
@Default('') String province,
|
||||
@Default('') String state,
|
||||
@Default('España') String country,
|
||||
@Default('ES') String countryCode,
|
||||
int? postCode,
|
||||
}) = _LegacyAddressViewState;
|
||||
}
|
||||
@@ -1,289 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// 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 'address_view_state.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$LegacyAddressViewState {
|
||||
|
||||
String get street; String get city; String get province; String get state; String get country; String get countryCode; int? get postCode;
|
||||
/// Create a copy of LegacyAddressViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$LegacyAddressViewStateCopyWith<LegacyAddressViewState> get copyWith => _$LegacyAddressViewStateCopyWithImpl<LegacyAddressViewState>(this as LegacyAddressViewState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is LegacyAddressViewState&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country)&&(identical(other.countryCode, countryCode) || other.countryCode == countryCode)&&(identical(other.postCode, postCode) || other.postCode == postCode));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,street,city,province,state,country,countryCode,postCode);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LegacyAddressViewState(street: $street, city: $city, province: $province, state: $state, country: $country, countryCode: $countryCode, postCode: $postCode)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $LegacyAddressViewStateCopyWith<$Res> {
|
||||
factory $LegacyAddressViewStateCopyWith(LegacyAddressViewState value, $Res Function(LegacyAddressViewState) _then) = _$LegacyAddressViewStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String street, String city, String province, String state, String country, String countryCode, int? postCode
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$LegacyAddressViewStateCopyWithImpl<$Res>
|
||||
implements $LegacyAddressViewStateCopyWith<$Res> {
|
||||
_$LegacyAddressViewStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final LegacyAddressViewState _self;
|
||||
final $Res Function(LegacyAddressViewState) _then;
|
||||
|
||||
/// Create a copy of LegacyAddressViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? street = null,Object? city = null,Object? province = null,Object? state = null,Object? country = null,Object? countryCode = null,Object? postCode = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
street: null == street ? _self.street : street // ignore: cast_nullable_to_non_nullable
|
||||
as String,city: null == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
|
||||
as String,province: null == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
|
||||
as String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
|
||||
as String,country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
|
||||
as String,countryCode: null == countryCode ? _self.countryCode : countryCode // ignore: cast_nullable_to_non_nullable
|
||||
as String,postCode: freezed == postCode ? _self.postCode : postCode // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [LegacyAddressViewState].
|
||||
extension LegacyAddressViewStatePatterns on LegacyAddressViewState {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _LegacyAddressViewState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyAddressViewState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _LegacyAddressViewState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyAddressViewState():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _LegacyAddressViewState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyAddressViewState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String street, String city, String province, String state, String country, String countryCode, int? postCode)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyAddressViewState() when $default != null:
|
||||
return $default(_that.street,_that.city,_that.province,_that.state,_that.country,_that.countryCode,_that.postCode);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String street, String city, String province, String state, String country, String countryCode, int? postCode) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyAddressViewState():
|
||||
return $default(_that.street,_that.city,_that.province,_that.state,_that.country,_that.countryCode,_that.postCode);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String street, String city, String province, String state, String country, String countryCode, int? postCode)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacyAddressViewState() when $default != null:
|
||||
return $default(_that.street,_that.city,_that.province,_that.state,_that.country,_that.countryCode,_that.postCode);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _LegacyAddressViewState implements LegacyAddressViewState {
|
||||
const _LegacyAddressViewState({this.street = '', this.city = '', this.province = '', this.state = '', this.country = 'España', this.countryCode = 'ES', this.postCode});
|
||||
|
||||
|
||||
@override@JsonKey() final String street;
|
||||
@override@JsonKey() final String city;
|
||||
@override@JsonKey() final String province;
|
||||
@override@JsonKey() final String state;
|
||||
@override@JsonKey() final String country;
|
||||
@override@JsonKey() final String countryCode;
|
||||
@override final int? postCode;
|
||||
|
||||
/// Create a copy of LegacyAddressViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$LegacyAddressViewStateCopyWith<_LegacyAddressViewState> get copyWith => __$LegacyAddressViewStateCopyWithImpl<_LegacyAddressViewState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LegacyAddressViewState&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country)&&(identical(other.countryCode, countryCode) || other.countryCode == countryCode)&&(identical(other.postCode, postCode) || other.postCode == postCode));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,street,city,province,state,country,countryCode,postCode);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LegacyAddressViewState(street: $street, city: $city, province: $province, state: $state, country: $country, countryCode: $countryCode, postCode: $postCode)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$LegacyAddressViewStateCopyWith<$Res> implements $LegacyAddressViewStateCopyWith<$Res> {
|
||||
factory _$LegacyAddressViewStateCopyWith(_LegacyAddressViewState value, $Res Function(_LegacyAddressViewState) _then) = __$LegacyAddressViewStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String street, String city, String province, String state, String country, String countryCode, int? postCode
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$LegacyAddressViewStateCopyWithImpl<$Res>
|
||||
implements _$LegacyAddressViewStateCopyWith<$Res> {
|
||||
__$LegacyAddressViewStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _LegacyAddressViewState _self;
|
||||
final $Res Function(_LegacyAddressViewState) _then;
|
||||
|
||||
/// Create a copy of LegacyAddressViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? street = null,Object? city = null,Object? province = null,Object? state = null,Object? country = null,Object? countryCode = null,Object? postCode = freezed,}) {
|
||||
return _then(_LegacyAddressViewState(
|
||||
street: null == street ? _self.street : street // ignore: cast_nullable_to_non_nullable
|
||||
as String,city: null == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
|
||||
as String,province: null == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
|
||||
as String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
|
||||
as String,country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
|
||||
as String,countryCode: null == countryCode ? _self.countryCode : countryCode // ignore: cast_nullable_to_non_nullable
|
||||
as String,postCode: freezed == postCode ? _self.postCode : postCode // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -1,18 +1,17 @@
|
||||
import 'dart:async';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:legacy_auth/src/core/domain/repositories/sign_up_repository.dart';
|
||||
import 'package:legacy_auth/src/core/providers/sign_up_repository_provider.dart';
|
||||
import 'package:legacy_shared/legacy_shared.dart';
|
||||
import 'package:legacy_auth/src/core/utils/text_format_utils.dart';
|
||||
import 'package:legacy_auth/src/features/sign_up/domain/entities/address_entity.dart';
|
||||
import 'package:legacy_auth/src/features/sign_up/domain/entities/sign_up_request_entity.dart';
|
||||
import 'package:legacy_auth/src/features/sign_up/presentation/mixins/sign_up_form_validation.dart';
|
||||
import 'package:legacy_auth/src/features/sign_up/presentation/state/address_view_state.dart';
|
||||
import 'package:legacy_auth/src/features/sign_up/presentation/state/sign_up_view_state.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:sealed_countries/sealed_countries.dart';
|
||||
import 'package:legacy_auth/src/core/domain/repositories/sign_up_repository.dart';
|
||||
import 'package:legacy_auth/src/core/providers/sign_up_repository_provider.dart';
|
||||
import 'package:legacy_auth/src/core/utils/text_format_utils.dart';
|
||||
import 'package:legacy_auth/src/features/sign_up/domain/entities/sign_up_request_entity.dart';
|
||||
import 'package:legacy_auth/src/features/sign_up/presentation/mixins/sign_up_form_validation.dart';
|
||||
import 'package:legacy_auth/src/features/sign_up/presentation/state/sign_up_view_state.dart';
|
||||
import 'package:legacy_shared/legacy_shared.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
import 'package:sf_tracking/sf_tracking.dart';
|
||||
|
||||
final legacySignUpViewModelProvider =
|
||||
@@ -27,200 +26,71 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
|
||||
|
||||
late final TextEditingController firstNameController;
|
||||
late final TextEditingController lastNameController;
|
||||
late final TextEditingController documentNumberController;
|
||||
late final TextEditingController documentTypeController;
|
||||
late final TextEditingController phoneController;
|
||||
late final TextEditingController emailController;
|
||||
|
||||
late final TextEditingController relationshipController;
|
||||
late final TextEditingController bornAtController;
|
||||
late final TextEditingController placeOfBirthController;
|
||||
late final TextEditingController birthCountryController;
|
||||
|
||||
late final TextEditingController addressStreetController;
|
||||
late final TextEditingController addressCityController;
|
||||
late final TextEditingController addressProvinceController;
|
||||
late final TextEditingController addressStateController;
|
||||
late final TextEditingController addressCountryController;
|
||||
late final TextEditingController addressPostCodeController;
|
||||
|
||||
late final TextEditingController passwordController;
|
||||
late final TextEditingController repeatPasswordController;
|
||||
|
||||
static const int _lastIndex = 2;
|
||||
static const int _lastIndex = 1;
|
||||
|
||||
@override
|
||||
LegacySignUpViewState build() {
|
||||
_repository = ref.read(legacySignUpRepositoryProvider);
|
||||
_tracking = ref.read(sfTrackingProvider);
|
||||
|
||||
final initial = LegacySignUpViewState();
|
||||
_initControllers(initial);
|
||||
_initControllers();
|
||||
_addListeners();
|
||||
|
||||
ref.onDispose(_disposeControllers);
|
||||
|
||||
return initial;
|
||||
return const LegacySignUpViewState();
|
||||
}
|
||||
|
||||
void _initControllers(LegacySignUpViewState s) {
|
||||
firstNameController = TextEditingController(text: s.firstName);
|
||||
lastNameController = TextEditingController(text: s.lastName);
|
||||
documentNumberController = TextEditingController(text: s.document);
|
||||
documentTypeController = TextEditingController(text: s.documentType);
|
||||
phoneController = TextEditingController(text: s.phone);
|
||||
emailController = TextEditingController(text: s.email);
|
||||
|
||||
relationshipController = TextEditingController(text: s.relationType);
|
||||
|
||||
bornAtController = TextEditingController(
|
||||
text: s.bornAt == null ? '' : _formatDate(s.bornAt!),
|
||||
);
|
||||
|
||||
placeOfBirthController = TextEditingController(text: s.placeOfBirth);
|
||||
birthCountryController = TextEditingController(text: s.birthCountry);
|
||||
|
||||
addressStreetController = TextEditingController(text: s.address.street);
|
||||
addressCityController = TextEditingController(text: s.address.city);
|
||||
addressProvinceController = TextEditingController(text: s.address.province);
|
||||
addressStateController = TextEditingController(text: s.address.state);
|
||||
addressCountryController = TextEditingController(text: s.address.country);
|
||||
addressPostCodeController = TextEditingController(
|
||||
text: s.address.postCode?.toString() ?? '',
|
||||
);
|
||||
|
||||
passwordController = TextEditingController(text: s.password);
|
||||
repeatPasswordController = TextEditingController(text: s.repeatPassword);
|
||||
}
|
||||
|
||||
void _syncField(
|
||||
String text, {
|
||||
required String current,
|
||||
required LegacySignUpViewState Function() update,
|
||||
}) {
|
||||
if (text == current) return;
|
||||
state = update();
|
||||
}
|
||||
|
||||
void _syncAddressField(
|
||||
String text, {
|
||||
required String current,
|
||||
required LegacyAddressViewState Function() updateAddress,
|
||||
}) {
|
||||
if (text == current) return;
|
||||
state = state.copyWith(address: updateAddress(), errorMessage: '');
|
||||
void _initControllers() {
|
||||
firstNameController = TextEditingController();
|
||||
lastNameController = TextEditingController();
|
||||
phoneController = TextEditingController();
|
||||
emailController = TextEditingController();
|
||||
passwordController = TextEditingController();
|
||||
repeatPasswordController = TextEditingController();
|
||||
}
|
||||
|
||||
void _addListeners() {
|
||||
firstNameController.addListener(_onFirstNameChanged);
|
||||
lastNameController.addListener(_onLastNameChanged);
|
||||
documentNumberController.addListener(_onDocumentNumberChanged);
|
||||
documentTypeController.addListener(_onDocumentTypeChanged);
|
||||
phoneController.addListener(_onPhoneChanged);
|
||||
emailController.addListener(_onEmailChanged);
|
||||
|
||||
relationshipController.addListener(_onRelationshipChanged);
|
||||
bornAtController.addListener(_onBornAtTextChanged);
|
||||
placeOfBirthController.addListener(_onPlaceOfBirthChanged);
|
||||
birthCountryController.addListener(_onBirthCountryChanged);
|
||||
|
||||
addressStreetController.addListener(_onAddressStreetChanged);
|
||||
addressCityController.addListener(_onAddressCityChanged);
|
||||
addressProvinceController.addListener(_onAddressProvinceChanged);
|
||||
addressStateController.addListener(_onAddressStateChanged);
|
||||
addressCountryController.addListener(_onAddressCountryChanged);
|
||||
addressPostCodeController.addListener(_onAddressPostCodeChanged);
|
||||
|
||||
passwordController.addListener(_onPasswordChanged);
|
||||
repeatPasswordController.addListener(_onRepeatPasswordChanged);
|
||||
}
|
||||
|
||||
void _onFirstNameChanged() {
|
||||
toCapitalizedController(firstNameController);
|
||||
_syncField(
|
||||
firstNameController.text,
|
||||
current: state.firstName,
|
||||
update: () =>
|
||||
state.copyWith(firstName: firstNameController.text, errorMessage: ''),
|
||||
);
|
||||
final text = firstNameController.text;
|
||||
if (text == state.firstName) return;
|
||||
state = state.copyWith(firstName: text, errorMessage: '');
|
||||
}
|
||||
|
||||
void _onLastNameChanged() {
|
||||
toCapitalizedController(lastNameController);
|
||||
_syncField(
|
||||
lastNameController.text,
|
||||
current: state.lastName,
|
||||
update: () =>
|
||||
state.copyWith(lastName: lastNameController.text, errorMessage: ''),
|
||||
);
|
||||
final text = lastNameController.text;
|
||||
if (text == state.lastName) return;
|
||||
state = state.copyWith(lastName: text, errorMessage: '');
|
||||
}
|
||||
|
||||
void _onDocumentNumberChanged() {
|
||||
toUpperCaseController(documentNumberController);
|
||||
_syncField(
|
||||
documentNumberController.text,
|
||||
current: state.document,
|
||||
update: () => state.copyWith(
|
||||
document: documentNumberController.text,
|
||||
errorMessage: '',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _onDocumentTypeChanged() => _syncField(
|
||||
documentTypeController.text,
|
||||
current: state.documentType,
|
||||
update: () => state.copyWith(
|
||||
documentType: documentTypeController.text,
|
||||
errorMessage: '',
|
||||
),
|
||||
);
|
||||
|
||||
void _onRelationshipChanged() => _syncField(
|
||||
relationshipController.text,
|
||||
current: state.relationType,
|
||||
update: () => state.copyWith(
|
||||
relationType: relationshipController.text,
|
||||
errorMessage: '',
|
||||
),
|
||||
);
|
||||
|
||||
void _onPlaceOfBirthChanged() {
|
||||
toCapitalizedController(placeOfBirthController);
|
||||
_syncField(
|
||||
placeOfBirthController.text,
|
||||
current: state.placeOfBirth,
|
||||
update: () => state.copyWith(
|
||||
placeOfBirth: placeOfBirthController.text,
|
||||
errorMessage: '',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _onBirthCountryChanged() => _syncField(
|
||||
birthCountryController.text,
|
||||
current: state.birthCountry,
|
||||
update: () => state.copyWith(
|
||||
birthCountry: birthCountryController.text,
|
||||
errorMessage: '',
|
||||
),
|
||||
);
|
||||
|
||||
void _onPhoneChanged() {
|
||||
final text = phoneController.text;
|
||||
if (text == state.phone) return;
|
||||
|
||||
state = state.copyWith(phone: text);
|
||||
|
||||
if (state.showErrors) {
|
||||
state = state.copyWith(phoneError: phoneErrorFor(text));
|
||||
state = state.copyWith(phoneError: phoneErrorFor(text, state.isoCode));
|
||||
}
|
||||
}
|
||||
|
||||
void _onEmailChanged() {
|
||||
final text = emailController.text;
|
||||
if (text == state.email) return;
|
||||
|
||||
state = state.copyWith(email: text, errorMessage: '');
|
||||
|
||||
if (state.showErrors) {
|
||||
@@ -231,7 +101,6 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
|
||||
void _onPasswordChanged() {
|
||||
final text = passwordController.text;
|
||||
if (text == state.password) return;
|
||||
|
||||
state = state.copyWith(password: text, errorMessage: '');
|
||||
|
||||
if (state.showErrors) {
|
||||
@@ -247,7 +116,6 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
|
||||
void _onRepeatPasswordChanged() {
|
||||
final text = repeatPasswordController.text;
|
||||
if (text == state.repeatPassword) return;
|
||||
|
||||
state = state.copyWith(repeatPassword: text, errorMessage: '');
|
||||
|
||||
if (state.showErrors) {
|
||||
@@ -260,91 +128,26 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
|
||||
}
|
||||
}
|
||||
|
||||
void _onBornAtTextChanged() {
|
||||
final text = bornAtController.text;
|
||||
final parsed = _tryParseDate(text);
|
||||
void updateCountry(String isoCode) {
|
||||
if (isoCode == state.isoCode) return;
|
||||
state = state.copyWith(isoCode: isoCode);
|
||||
|
||||
if (text.trim().isEmpty) {
|
||||
if (state.bornAt != null) {
|
||||
state = state.copyWith(bornAt: null, errorMessage: '');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (parsed != null && parsed != state.bornAt) {
|
||||
state = state.copyWith(bornAt: parsed, errorMessage: '');
|
||||
}
|
||||
}
|
||||
|
||||
void _onAddressStreetChanged() {
|
||||
toCapitalizedController(addressStreetController);
|
||||
_syncAddressField(
|
||||
addressStreetController.text,
|
||||
current: state.address.street,
|
||||
updateAddress: () =>
|
||||
state.address.copyWith(street: addressStreetController.text),
|
||||
);
|
||||
}
|
||||
|
||||
void _onAddressCityChanged() {
|
||||
toCapitalizedController(addressCityController);
|
||||
_syncAddressField(
|
||||
addressCityController.text,
|
||||
current: state.address.city,
|
||||
updateAddress: () =>
|
||||
state.address.copyWith(city: addressCityController.text),
|
||||
);
|
||||
}
|
||||
|
||||
void _onAddressProvinceChanged() {
|
||||
toCapitalizedController(addressProvinceController);
|
||||
_syncAddressField(
|
||||
addressProvinceController.text,
|
||||
current: state.address.province,
|
||||
updateAddress: () =>
|
||||
state.address.copyWith(province: addressProvinceController.text),
|
||||
);
|
||||
}
|
||||
|
||||
void _onAddressStateChanged() {
|
||||
toCapitalizedController(addressStateController);
|
||||
_syncAddressField(
|
||||
addressStateController.text,
|
||||
current: state.address.state,
|
||||
updateAddress: () =>
|
||||
state.address.copyWith(state: addressStateController.text),
|
||||
);
|
||||
}
|
||||
|
||||
void _onAddressCountryChanged() => _syncAddressField(
|
||||
addressCountryController.text,
|
||||
current: state.address.country,
|
||||
updateAddress: () =>
|
||||
state.address.copyWith(country: addressCountryController.text),
|
||||
);
|
||||
|
||||
void _onAddressPostCodeChanged() {
|
||||
final text = addressPostCodeController.text.trim();
|
||||
final parsed = int.tryParse(text);
|
||||
|
||||
if (text.isEmpty) {
|
||||
if (state.address.postCode != null) {
|
||||
state = state.copyWith(
|
||||
address: state.address.copyWith(postCode: null),
|
||||
errorMessage: '',
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (parsed != null && parsed != state.address.postCode) {
|
||||
if (state.showErrors && state.phone.isNotEmpty) {
|
||||
state = state.copyWith(
|
||||
address: state.address.copyWith(postCode: parsed),
|
||||
errorMessage: '',
|
||||
phoneError: phoneErrorFor(state.phone, isoCode),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void setAcceptTerms(bool value) {
|
||||
if (value == state.acceptTerms) return;
|
||||
state = state.copyWith(acceptTerms: value, errorMessage: '');
|
||||
}
|
||||
|
||||
void toggleShowPassword() {
|
||||
state = state.copyWith(isShowPassword: !state.isShowPassword);
|
||||
}
|
||||
|
||||
void next() {
|
||||
if (state.isLoading) return;
|
||||
|
||||
@@ -352,7 +155,6 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
|
||||
final ok = switch (currentStep) {
|
||||
0 => _validateStep0(),
|
||||
1 => _validateStep1(),
|
||||
2 => _validateStep2(),
|
||||
_ => true,
|
||||
};
|
||||
|
||||
@@ -384,70 +186,10 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
|
||||
);
|
||||
}
|
||||
|
||||
void updateDialCode(String dialCode) {
|
||||
state = state.copyWith(dialCode: dialCode);
|
||||
}
|
||||
|
||||
void setBirthCountryFromPicker({required String name, required String code}) {
|
||||
birthCountryController.text = name;
|
||||
state = state.copyWith(birthCountry: name, birthCountryCode: code);
|
||||
}
|
||||
|
||||
Future<void> pickBornAt(BuildContext context) async {
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
|
||||
final now = DateTime.now();
|
||||
final initial = state.bornAt ?? DateTime(now.year - 18, now.month, now.day);
|
||||
final safeInitial = initial.isAfter(now) ? now : initial;
|
||||
|
||||
final picked = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: safeInitial,
|
||||
firstDate: DateTime(1900, 1, 1),
|
||||
lastDate: now,
|
||||
);
|
||||
|
||||
if (!ref.mounted || picked == null) return;
|
||||
|
||||
setBornAt(picked);
|
||||
}
|
||||
|
||||
void setBornAt(DateTime date) {
|
||||
bornAtController.text = _formatDate(date);
|
||||
state = state.copyWith(bornAt: date, errorMessage: '');
|
||||
}
|
||||
|
||||
void setDocumentType(String? value) {
|
||||
final v = value ?? '';
|
||||
if (documentTypeController.text == v) return;
|
||||
documentTypeController.text = v;
|
||||
}
|
||||
|
||||
void setRelationship(String? value) {
|
||||
final v = value ?? '';
|
||||
if (relationshipController.text == v) return;
|
||||
relationshipController.text = v;
|
||||
}
|
||||
|
||||
void setAddressCountry({required String name, required String code}) {
|
||||
addressCountryController.text = name;
|
||||
state = state.copyWith(
|
||||
address: state.address.copyWith(country: name, countryCode: code),
|
||||
);
|
||||
}
|
||||
|
||||
void setAcceptTerms(bool value) {
|
||||
if (value == state.acceptTerms) return;
|
||||
state = state.copyWith(acceptTerms: value, errorMessage: '');
|
||||
}
|
||||
|
||||
void toggleShowPassword() {
|
||||
state = state.copyWith(isShowPassword: !state.isShowPassword);
|
||||
}
|
||||
|
||||
bool _validateStep0() {
|
||||
final emailErr = emailErrorFor(state.email);
|
||||
final phoneErr = phoneErrorFor(state.phone);
|
||||
final phoneErr = phoneErrorFor(state.phone, state.isoCode);
|
||||
|
||||
state = state.copyWith(
|
||||
showErrors: true,
|
||||
emailError: emailErr,
|
||||
@@ -471,14 +213,6 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
|
||||
state = state.copyWith(errorMessage: I18n.errorNameInvalidChars);
|
||||
return false;
|
||||
}
|
||||
if (state.documentType.trim().isEmpty) {
|
||||
state = state.copyWith(errorMessage: I18n.errorDocumentTypeRequired);
|
||||
return false;
|
||||
}
|
||||
if (state.document.trim().isEmpty) {
|
||||
state = state.copyWith(errorMessage: I18n.errorDocumentNumberRequired);
|
||||
return false;
|
||||
}
|
||||
if (phoneErr.isNotEmpty) {
|
||||
state = state.copyWith(errorMessage: phoneErr);
|
||||
return false;
|
||||
@@ -495,32 +229,6 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
|
||||
}
|
||||
|
||||
bool _validateStep1() {
|
||||
state = state.copyWith(showErrors: true, errorMessage: '');
|
||||
|
||||
if (state.bornAt == null) {
|
||||
state = state.copyWith(errorMessage: I18n.errorBirthDateRequired);
|
||||
return false;
|
||||
}
|
||||
if (state.relationType.trim().isEmpty) {
|
||||
state = state.copyWith(errorMessage: I18n.errorRelationshipRequired);
|
||||
return false;
|
||||
}
|
||||
if (state.placeOfBirth.trim().isEmpty) {
|
||||
state = state.copyWith(errorMessage: I18n.errorPlaceOfBirthRequired);
|
||||
return false;
|
||||
}
|
||||
if (state.birthCountry.trim().isEmpty) {
|
||||
state = state.copyWith(errorMessage: I18n.errorBirthCountryRequired);
|
||||
return false;
|
||||
}
|
||||
if (!isAddressValid(state.address)) {
|
||||
state = state.copyWith(errorMessage: I18n.errorAddressRequired);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool _validateStep2() {
|
||||
final passwordErr = passwordErrorFor(
|
||||
password: state.password,
|
||||
repeatPassword: state.repeatPassword,
|
||||
@@ -535,13 +243,24 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
|
||||
return passwordErr.isEmpty;
|
||||
}
|
||||
|
||||
bool _validateForm() =>
|
||||
_validateStep0() && _validateStep1() && _validateStep2();
|
||||
bool _validateForm() => _validateStep0() && _validateStep1();
|
||||
|
||||
Future<bool> signUp() async {
|
||||
if (state.isLoading) return false;
|
||||
if (!_validateForm()) return false;
|
||||
|
||||
final parsedPhone = SfPhoneNumber.tryParse(
|
||||
state.phone,
|
||||
defaultIsoCode: state.isoCode,
|
||||
);
|
||||
if (parsedPhone == null) {
|
||||
state = state.copyWith(
|
||||
errorMessage: I18n.errorMessagePhoneIsInvalid,
|
||||
phoneError: I18n.errorMessagePhoneIsInvalid,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
state = state.copyWith(
|
||||
isLoading: true,
|
||||
errorMessage: '',
|
||||
@@ -551,9 +270,16 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
|
||||
unawaited(_tracking.legacyAuthSignupStarted());
|
||||
|
||||
try {
|
||||
final request = _toRequest();
|
||||
final response = await _repository.signUp(request: request);
|
||||
final request = LegacySignUpRequestEntity(
|
||||
firstName: state.firstName.trim().toUpperCase(),
|
||||
lastName: state.lastName.trim().toUpperCase(),
|
||||
email: state.email.trim(),
|
||||
phone: parsedPhone.e164,
|
||||
language: _deviceLanguage(),
|
||||
password: state.password,
|
||||
);
|
||||
|
||||
final response = await _repository.signUp(request: request);
|
||||
if (!ref.mounted) return false;
|
||||
|
||||
unawaited(_tracking.legacyAuthSignupCompleted());
|
||||
@@ -580,115 +306,25 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
|
||||
}
|
||||
}
|
||||
|
||||
LegacySignUpRequestEntity _toRequest() {
|
||||
final bornAt = state.bornAt;
|
||||
if (bornAt == null) throw Exception('bornAt is required');
|
||||
|
||||
return LegacySignUpRequestEntity(
|
||||
documentType: state.documentType.trim(),
|
||||
document: state.document.trim(),
|
||||
relationType: state.relationType.trim(),
|
||||
firstName: state.firstName.trim().toUpperCase(),
|
||||
lastName: state.lastName.trim().toUpperCase(),
|
||||
email: state.email.trim(),
|
||||
phone: state.dialCode.trim() + state.phone.trim(),
|
||||
language: state.language.trim().isEmpty ? 'es' : state.language.trim(),
|
||||
password: state.password,
|
||||
bornAt: DateTime.utc(
|
||||
bornAt.year,
|
||||
bornAt.month,
|
||||
bornAt.day,
|
||||
).millisecondsSinceEpoch,
|
||||
placeOfBirth: state.placeOfBirth.trim().toUpperCase(),
|
||||
birthCountry: state.birthCountryCode.trim(),
|
||||
addresses: <LegacyAddressEntity>[_toLegacyAddressEntity(state.address)],
|
||||
taxResidences: <LegacyAddressEntity>[
|
||||
_toLegacyAddressEntity(state.address),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
LegacyAddressEntity _toLegacyAddressEntity(LegacyAddressViewState a) {
|
||||
final country = WorldCountry.fromCodeShort(a.countryCode.toUpperCase());
|
||||
|
||||
return LegacyAddressEntity(
|
||||
street: a.street.trim().toUpperCase(),
|
||||
city: a.city.trim().toUpperCase(),
|
||||
province: a.province.trim().toUpperCase(),
|
||||
state: a.state.trim().toUpperCase(),
|
||||
country: country.name.common.toUpperCase(),
|
||||
postCode: a.postCode ?? 0,
|
||||
);
|
||||
}
|
||||
|
||||
DateTime? _tryParseDate(String value) {
|
||||
final v = value.trim();
|
||||
if (v.isEmpty) return null;
|
||||
|
||||
final parts = v.split('/');
|
||||
if (parts.length != 3) return null;
|
||||
|
||||
final d = int.tryParse(parts[0]);
|
||||
final m = int.tryParse(parts[1]);
|
||||
final y = int.tryParse(parts[2]);
|
||||
|
||||
if (d == null || m == null || y == null) return null;
|
||||
|
||||
final date = DateTime(y, m, d);
|
||||
if (date.year != y || date.month != m || date.day != d) return null;
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
String _formatDate(DateTime date) {
|
||||
final dd = date.day.toString().padLeft(2, '0');
|
||||
final mm = date.month.toString().padLeft(2, '0');
|
||||
final yyyy = date.year.toString();
|
||||
return '$dd/$mm/$yyyy';
|
||||
String _deviceLanguage() {
|
||||
final code = PlatformDispatcher.instance.locale.languageCode
|
||||
.trim()
|
||||
.toLowerCase();
|
||||
return code.isEmpty ? 'es' : code;
|
||||
}
|
||||
|
||||
void _disposeControllers() {
|
||||
firstNameController.removeListener(_onFirstNameChanged);
|
||||
lastNameController.removeListener(_onLastNameChanged);
|
||||
documentNumberController.removeListener(_onDocumentNumberChanged);
|
||||
documentTypeController.removeListener(_onDocumentTypeChanged);
|
||||
phoneController.removeListener(_onPhoneChanged);
|
||||
emailController.removeListener(_onEmailChanged);
|
||||
|
||||
relationshipController.removeListener(_onRelationshipChanged);
|
||||
bornAtController.removeListener(_onBornAtTextChanged);
|
||||
placeOfBirthController.removeListener(_onPlaceOfBirthChanged);
|
||||
birthCountryController.removeListener(_onBirthCountryChanged);
|
||||
|
||||
addressStreetController.removeListener(_onAddressStreetChanged);
|
||||
addressCityController.removeListener(_onAddressCityChanged);
|
||||
addressProvinceController.removeListener(_onAddressProvinceChanged);
|
||||
addressStateController.removeListener(_onAddressStateChanged);
|
||||
addressCountryController.removeListener(_onAddressCountryChanged);
|
||||
addressPostCodeController.removeListener(_onAddressPostCodeChanged);
|
||||
|
||||
passwordController.removeListener(_onPasswordChanged);
|
||||
repeatPasswordController.removeListener(_onRepeatPasswordChanged);
|
||||
|
||||
firstNameController.dispose();
|
||||
lastNameController.dispose();
|
||||
documentNumberController.dispose();
|
||||
documentTypeController.dispose();
|
||||
phoneController.dispose();
|
||||
emailController.dispose();
|
||||
|
||||
relationshipController.dispose();
|
||||
bornAtController.dispose();
|
||||
placeOfBirthController.dispose();
|
||||
birthCountryController.dispose();
|
||||
|
||||
addressStreetController.dispose();
|
||||
addressCityController.dispose();
|
||||
addressProvinceController.dispose();
|
||||
addressStateController.dispose();
|
||||
addressCountryController.dispose();
|
||||
addressPostCodeController.dispose();
|
||||
|
||||
passwordController.dispose();
|
||||
repeatPasswordController.dispose();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'address_view_state.dart';
|
||||
|
||||
part 'sign_up_view_state.freezed.dart';
|
||||
|
||||
@@ -8,27 +7,17 @@ abstract class LegacySignUpViewState with _$LegacySignUpViewState {
|
||||
const factory LegacySignUpViewState({
|
||||
@Default(0) int currentIndex,
|
||||
|
||||
@Default('') String document,
|
||||
@Default('') String documentType,
|
||||
@Default(false) bool acceptTerms,
|
||||
@Default('') String relationType,
|
||||
|
||||
@Default('') String firstName,
|
||||
@Default('') String lastName,
|
||||
@Default('') String email,
|
||||
@Default('') String phone,
|
||||
@Default('+34') String dialCode,
|
||||
@Default('') String language,
|
||||
DateTime? bornAt,
|
||||
@Default('ES') String isoCode,
|
||||
|
||||
@Default('') String password,
|
||||
@Default('') String repeatPassword,
|
||||
@Default(false) bool isShowPassword,
|
||||
@Default(false) bool isCreated,
|
||||
@Default('') String placeOfBirth,
|
||||
@Default('España') String birthCountry,
|
||||
@Default('ES') String birthCountryCode,
|
||||
|
||||
@Default(LegacyAddressViewState()) LegacyAddressViewState address,
|
||||
@Default(false) bool acceptTerms,
|
||||
|
||||
@Default('') String emailError,
|
||||
@Default('') String passwordError,
|
||||
@@ -36,6 +25,7 @@ abstract class LegacySignUpViewState with _$LegacySignUpViewState {
|
||||
@Default('') String errorMessage,
|
||||
@Default(false) bool isLoading,
|
||||
@Default(false) bool showErrors,
|
||||
@Default(false) bool isCreated,
|
||||
@Default(false) bool showAccountCreated,
|
||||
}) = _LegacySignUpViewState;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$LegacySignUpViewState {
|
||||
|
||||
int get currentIndex; String get document; String get documentType; bool get acceptTerms; String get relationType; String get firstName; String get lastName; String get email; String get phone; String get dialCode; String get language; DateTime? get bornAt; String get password; String get repeatPassword; bool get isShowPassword; bool get isCreated; String get placeOfBirth; String get birthCountry; String get birthCountryCode; LegacyAddressViewState get address; String get emailError; String get passwordError; String get phoneError; String get errorMessage; bool get isLoading; bool get showErrors; bool get showAccountCreated;
|
||||
int get currentIndex; String get firstName; String get lastName; String get email; String get phone; String get isoCode; String get password; String get repeatPassword; bool get isShowPassword; bool get acceptTerms; String get emailError; String get passwordError; String get phoneError; String get errorMessage; bool get isLoading; bool get showErrors; bool get isCreated; bool get showAccountCreated;
|
||||
/// Create a copy of LegacySignUpViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -25,16 +25,16 @@ $LegacySignUpViewStateCopyWith<LegacySignUpViewState> get copyWith => _$LegacySi
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is LegacySignUpViewState&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex)&&(identical(other.document, document) || other.document == document)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.acceptTerms, acceptTerms) || other.acceptTerms == acceptTerms)&&(identical(other.relationType, relationType) || other.relationType == relationType)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.dialCode, dialCode) || other.dialCode == dialCode)&&(identical(other.language, language) || other.language == language)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.password, password) || other.password == password)&&(identical(other.repeatPassword, repeatPassword) || other.repeatPassword == repeatPassword)&&(identical(other.isShowPassword, isShowPassword) || other.isShowPassword == isShowPassword)&&(identical(other.isCreated, isCreated) || other.isCreated == isCreated)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(identical(other.birthCountryCode, birthCountryCode) || other.birthCountryCode == birthCountryCode)&&(identical(other.address, address) || other.address == address)&&(identical(other.emailError, emailError) || other.emailError == emailError)&&(identical(other.passwordError, passwordError) || other.passwordError == passwordError)&&(identical(other.phoneError, phoneError) || other.phoneError == phoneError)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.showErrors, showErrors) || other.showErrors == showErrors)&&(identical(other.showAccountCreated, showAccountCreated) || other.showAccountCreated == showAccountCreated));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is LegacySignUpViewState&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.isoCode, isoCode) || other.isoCode == isoCode)&&(identical(other.password, password) || other.password == password)&&(identical(other.repeatPassword, repeatPassword) || other.repeatPassword == repeatPassword)&&(identical(other.isShowPassword, isShowPassword) || other.isShowPassword == isShowPassword)&&(identical(other.acceptTerms, acceptTerms) || other.acceptTerms == acceptTerms)&&(identical(other.emailError, emailError) || other.emailError == emailError)&&(identical(other.passwordError, passwordError) || other.passwordError == passwordError)&&(identical(other.phoneError, phoneError) || other.phoneError == phoneError)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.showErrors, showErrors) || other.showErrors == showErrors)&&(identical(other.isCreated, isCreated) || other.isCreated == isCreated)&&(identical(other.showAccountCreated, showAccountCreated) || other.showAccountCreated == showAccountCreated));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hashAll([runtimeType,currentIndex,document,documentType,acceptTerms,relationType,firstName,lastName,email,phone,dialCode,language,bornAt,password,repeatPassword,isShowPassword,isCreated,placeOfBirth,birthCountry,birthCountryCode,address,emailError,passwordError,phoneError,errorMessage,isLoading,showErrors,showAccountCreated]);
|
||||
int get hashCode => Object.hash(runtimeType,currentIndex,firstName,lastName,email,phone,isoCode,password,repeatPassword,isShowPassword,acceptTerms,emailError,passwordError,phoneError,errorMessage,isLoading,showErrors,isCreated,showAccountCreated);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LegacySignUpViewState(currentIndex: $currentIndex, document: $document, documentType: $documentType, acceptTerms: $acceptTerms, relationType: $relationType, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, dialCode: $dialCode, language: $language, bornAt: $bornAt, password: $password, repeatPassword: $repeatPassword, isShowPassword: $isShowPassword, isCreated: $isCreated, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, birthCountryCode: $birthCountryCode, address: $address, emailError: $emailError, passwordError: $passwordError, phoneError: $phoneError, errorMessage: $errorMessage, isLoading: $isLoading, showErrors: $showErrors, showAccountCreated: $showAccountCreated)';
|
||||
return 'LegacySignUpViewState(currentIndex: $currentIndex, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, isoCode: $isoCode, password: $password, repeatPassword: $repeatPassword, isShowPassword: $isShowPassword, acceptTerms: $acceptTerms, emailError: $emailError, passwordError: $passwordError, phoneError: $phoneError, errorMessage: $errorMessage, isLoading: $isLoading, showErrors: $showErrors, isCreated: $isCreated, showAccountCreated: $showAccountCreated)';
|
||||
}
|
||||
|
||||
|
||||
@@ -45,11 +45,11 @@ abstract mixin class $LegacySignUpViewStateCopyWith<$Res> {
|
||||
factory $LegacySignUpViewStateCopyWith(LegacySignUpViewState value, $Res Function(LegacySignUpViewState) _then) = _$LegacySignUpViewStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
int currentIndex, String document, String documentType, bool acceptTerms, String relationType, String firstName, String lastName, String email, String phone, String dialCode, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, bool isCreated, String placeOfBirth, String birthCountry, String birthCountryCode, LegacyAddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, bool showAccountCreated
|
||||
int currentIndex, String firstName, String lastName, String email, String phone, String isoCode, String password, String repeatPassword, bool isShowPassword, bool acceptTerms, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, bool isCreated, bool showAccountCreated
|
||||
});
|
||||
|
||||
|
||||
$LegacyAddressViewStateCopyWith<$Res> get address;
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
@@ -62,48 +62,30 @@ class _$LegacySignUpViewStateCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of LegacySignUpViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? currentIndex = null,Object? document = null,Object? documentType = null,Object? acceptTerms = null,Object? relationType = null,Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? dialCode = null,Object? language = null,Object? bornAt = freezed,Object? password = null,Object? repeatPassword = null,Object? isShowPassword = null,Object? isCreated = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? birthCountryCode = null,Object? address = null,Object? emailError = null,Object? passwordError = null,Object? phoneError = null,Object? errorMessage = null,Object? isLoading = null,Object? showErrors = null,Object? showAccountCreated = null,}) {
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? currentIndex = null,Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? isoCode = null,Object? password = null,Object? repeatPassword = null,Object? isShowPassword = null,Object? acceptTerms = null,Object? emailError = null,Object? passwordError = null,Object? phoneError = null,Object? errorMessage = null,Object? isLoading = null,Object? showErrors = null,Object? isCreated = null,Object? showAccountCreated = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
currentIndex: null == currentIndex ? _self.currentIndex : currentIndex // ignore: cast_nullable_to_non_nullable
|
||||
as int,document: null == document ? _self.document : document // ignore: cast_nullable_to_non_nullable
|
||||
as String,documentType: null == documentType ? _self.documentType : documentType // ignore: cast_nullable_to_non_nullable
|
||||
as String,acceptTerms: null == acceptTerms ? _self.acceptTerms : acceptTerms // ignore: cast_nullable_to_non_nullable
|
||||
as bool,relationType: null == relationType ? _self.relationType : relationType // ignore: cast_nullable_to_non_nullable
|
||||
as String,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
||||
as int,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
||||
as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
|
||||
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
||||
as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||
as String,dialCode: null == dialCode ? _self.dialCode : dialCode // ignore: cast_nullable_to_non_nullable
|
||||
as String,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
|
||||
as String,bornAt: freezed == bornAt ? _self.bornAt : bornAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
|
||||
as String,isoCode: null == isoCode ? _self.isoCode : isoCode // ignore: cast_nullable_to_non_nullable
|
||||
as String,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
|
||||
as String,repeatPassword: null == repeatPassword ? _self.repeatPassword : repeatPassword // ignore: cast_nullable_to_non_nullable
|
||||
as String,isShowPassword: null == isShowPassword ? _self.isShowPassword : isShowPassword // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isCreated: null == isCreated ? _self.isCreated : isCreated // ignore: cast_nullable_to_non_nullable
|
||||
as bool,placeOfBirth: null == placeOfBirth ? _self.placeOfBirth : placeOfBirth // ignore: cast_nullable_to_non_nullable
|
||||
as String,birthCountry: null == birthCountry ? _self.birthCountry : birthCountry // ignore: cast_nullable_to_non_nullable
|
||||
as String,birthCountryCode: null == birthCountryCode ? _self.birthCountryCode : birthCountryCode // ignore: cast_nullable_to_non_nullable
|
||||
as String,address: null == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
|
||||
as LegacyAddressViewState,emailError: null == emailError ? _self.emailError : emailError // ignore: cast_nullable_to_non_nullable
|
||||
as bool,acceptTerms: null == acceptTerms ? _self.acceptTerms : acceptTerms // ignore: cast_nullable_to_non_nullable
|
||||
as bool,emailError: null == emailError ? _self.emailError : emailError // ignore: cast_nullable_to_non_nullable
|
||||
as String,passwordError: null == passwordError ? _self.passwordError : passwordError // ignore: cast_nullable_to_non_nullable
|
||||
as String,phoneError: null == phoneError ? _self.phoneError : phoneError // ignore: cast_nullable_to_non_nullable
|
||||
as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,showErrors: null == showErrors ? _self.showErrors : showErrors // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isCreated: null == isCreated ? _self.isCreated : isCreated // ignore: cast_nullable_to_non_nullable
|
||||
as bool,showAccountCreated: null == showAccountCreated ? _self.showAccountCreated : showAccountCreated // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
/// Create a copy of LegacySignUpViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$LegacyAddressViewStateCopyWith<$Res> get address {
|
||||
|
||||
return $LegacyAddressViewStateCopyWith<$Res>(_self.address, (value) {
|
||||
return _then(_self.copyWith(address: value));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -185,10 +167,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int currentIndex, String document, String documentType, bool acceptTerms, String relationType, String firstName, String lastName, String email, String phone, String dialCode, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, bool isCreated, String placeOfBirth, String birthCountry, String birthCountryCode, LegacyAddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, bool showAccountCreated)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int currentIndex, String firstName, String lastName, String email, String phone, String isoCode, String password, String repeatPassword, bool isShowPassword, bool acceptTerms, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, bool isCreated, bool showAccountCreated)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacySignUpViewState() when $default != null:
|
||||
return $default(_that.currentIndex,_that.document,_that.documentType,_that.acceptTerms,_that.relationType,_that.firstName,_that.lastName,_that.email,_that.phone,_that.dialCode,_that.language,_that.bornAt,_that.password,_that.repeatPassword,_that.isShowPassword,_that.isCreated,_that.placeOfBirth,_that.birthCountry,_that.birthCountryCode,_that.address,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.showAccountCreated);case _:
|
||||
return $default(_that.currentIndex,_that.firstName,_that.lastName,_that.email,_that.phone,_that.isoCode,_that.password,_that.repeatPassword,_that.isShowPassword,_that.acceptTerms,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.isCreated,_that.showAccountCreated);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -206,10 +188,10 @@ return $default(_that.currentIndex,_that.document,_that.documentType,_that.accep
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int currentIndex, String document, String documentType, bool acceptTerms, String relationType, String firstName, String lastName, String email, String phone, String dialCode, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, bool isCreated, String placeOfBirth, String birthCountry, String birthCountryCode, LegacyAddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, bool showAccountCreated) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int currentIndex, String firstName, String lastName, String email, String phone, String isoCode, String password, String repeatPassword, bool isShowPassword, bool acceptTerms, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, bool isCreated, bool showAccountCreated) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacySignUpViewState():
|
||||
return $default(_that.currentIndex,_that.document,_that.documentType,_that.acceptTerms,_that.relationType,_that.firstName,_that.lastName,_that.email,_that.phone,_that.dialCode,_that.language,_that.bornAt,_that.password,_that.repeatPassword,_that.isShowPassword,_that.isCreated,_that.placeOfBirth,_that.birthCountry,_that.birthCountryCode,_that.address,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.showAccountCreated);case _:
|
||||
return $default(_that.currentIndex,_that.firstName,_that.lastName,_that.email,_that.phone,_that.isoCode,_that.password,_that.repeatPassword,_that.isShowPassword,_that.acceptTerms,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.isCreated,_that.showAccountCreated);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -226,10 +208,10 @@ return $default(_that.currentIndex,_that.document,_that.documentType,_that.accep
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int currentIndex, String document, String documentType, bool acceptTerms, String relationType, String firstName, String lastName, String email, String phone, String dialCode, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, bool isCreated, String placeOfBirth, String birthCountry, String birthCountryCode, LegacyAddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, bool showAccountCreated)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int currentIndex, String firstName, String lastName, String email, String phone, String isoCode, String password, String repeatPassword, bool isShowPassword, bool acceptTerms, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, bool isCreated, bool showAccountCreated)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LegacySignUpViewState() when $default != null:
|
||||
return $default(_that.currentIndex,_that.document,_that.documentType,_that.acceptTerms,_that.relationType,_that.firstName,_that.lastName,_that.email,_that.phone,_that.dialCode,_that.language,_that.bornAt,_that.password,_that.repeatPassword,_that.isShowPassword,_that.isCreated,_that.placeOfBirth,_that.birthCountry,_that.birthCountryCode,_that.address,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.showAccountCreated);case _:
|
||||
return $default(_that.currentIndex,_that.firstName,_that.lastName,_that.email,_that.phone,_that.isoCode,_that.password,_that.repeatPassword,_that.isShowPassword,_that.acceptTerms,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.isCreated,_that.showAccountCreated);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -241,35 +223,26 @@ return $default(_that.currentIndex,_that.document,_that.documentType,_that.accep
|
||||
|
||||
|
||||
class _LegacySignUpViewState implements LegacySignUpViewState {
|
||||
const _LegacySignUpViewState({this.currentIndex = 0, this.document = '', this.documentType = '', this.acceptTerms = false, this.relationType = '', this.firstName = '', this.lastName = '', this.email = '', this.phone = '', this.dialCode = '+34', this.language = '', this.bornAt, this.password = '', this.repeatPassword = '', this.isShowPassword = false, this.isCreated = false, this.placeOfBirth = '', this.birthCountry = 'España', this.birthCountryCode = 'ES', this.address = const LegacyAddressViewState(), this.emailError = '', this.passwordError = '', this.phoneError = '', this.errorMessage = '', this.isLoading = false, this.showErrors = false, this.showAccountCreated = false});
|
||||
const _LegacySignUpViewState({this.currentIndex = 0, this.firstName = '', this.lastName = '', this.email = '', this.phone = '', this.isoCode = 'ES', this.password = '', this.repeatPassword = '', this.isShowPassword = false, this.acceptTerms = false, this.emailError = '', this.passwordError = '', this.phoneError = '', this.errorMessage = '', this.isLoading = false, this.showErrors = false, this.isCreated = false, this.showAccountCreated = false});
|
||||
|
||||
|
||||
@override@JsonKey() final int currentIndex;
|
||||
@override@JsonKey() final String document;
|
||||
@override@JsonKey() final String documentType;
|
||||
@override@JsonKey() final bool acceptTerms;
|
||||
@override@JsonKey() final String relationType;
|
||||
@override@JsonKey() final String firstName;
|
||||
@override@JsonKey() final String lastName;
|
||||
@override@JsonKey() final String email;
|
||||
@override@JsonKey() final String phone;
|
||||
@override@JsonKey() final String dialCode;
|
||||
@override@JsonKey() final String language;
|
||||
@override final DateTime? bornAt;
|
||||
@override@JsonKey() final String isoCode;
|
||||
@override@JsonKey() final String password;
|
||||
@override@JsonKey() final String repeatPassword;
|
||||
@override@JsonKey() final bool isShowPassword;
|
||||
@override@JsonKey() final bool isCreated;
|
||||
@override@JsonKey() final String placeOfBirth;
|
||||
@override@JsonKey() final String birthCountry;
|
||||
@override@JsonKey() final String birthCountryCode;
|
||||
@override@JsonKey() final LegacyAddressViewState address;
|
||||
@override@JsonKey() final bool acceptTerms;
|
||||
@override@JsonKey() final String emailError;
|
||||
@override@JsonKey() final String passwordError;
|
||||
@override@JsonKey() final String phoneError;
|
||||
@override@JsonKey() final String errorMessage;
|
||||
@override@JsonKey() final bool isLoading;
|
||||
@override@JsonKey() final bool showErrors;
|
||||
@override@JsonKey() final bool isCreated;
|
||||
@override@JsonKey() final bool showAccountCreated;
|
||||
|
||||
/// Create a copy of LegacySignUpViewState
|
||||
@@ -282,16 +255,16 @@ _$LegacySignUpViewStateCopyWith<_LegacySignUpViewState> get copyWith => __$Legac
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LegacySignUpViewState&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex)&&(identical(other.document, document) || other.document == document)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.acceptTerms, acceptTerms) || other.acceptTerms == acceptTerms)&&(identical(other.relationType, relationType) || other.relationType == relationType)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.dialCode, dialCode) || other.dialCode == dialCode)&&(identical(other.language, language) || other.language == language)&&(identical(other.bornAt, bornAt) || other.bornAt == bornAt)&&(identical(other.password, password) || other.password == password)&&(identical(other.repeatPassword, repeatPassword) || other.repeatPassword == repeatPassword)&&(identical(other.isShowPassword, isShowPassword) || other.isShowPassword == isShowPassword)&&(identical(other.isCreated, isCreated) || other.isCreated == isCreated)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(identical(other.birthCountryCode, birthCountryCode) || other.birthCountryCode == birthCountryCode)&&(identical(other.address, address) || other.address == address)&&(identical(other.emailError, emailError) || other.emailError == emailError)&&(identical(other.passwordError, passwordError) || other.passwordError == passwordError)&&(identical(other.phoneError, phoneError) || other.phoneError == phoneError)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.showErrors, showErrors) || other.showErrors == showErrors)&&(identical(other.showAccountCreated, showAccountCreated) || other.showAccountCreated == showAccountCreated));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LegacySignUpViewState&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.isoCode, isoCode) || other.isoCode == isoCode)&&(identical(other.password, password) || other.password == password)&&(identical(other.repeatPassword, repeatPassword) || other.repeatPassword == repeatPassword)&&(identical(other.isShowPassword, isShowPassword) || other.isShowPassword == isShowPassword)&&(identical(other.acceptTerms, acceptTerms) || other.acceptTerms == acceptTerms)&&(identical(other.emailError, emailError) || other.emailError == emailError)&&(identical(other.passwordError, passwordError) || other.passwordError == passwordError)&&(identical(other.phoneError, phoneError) || other.phoneError == phoneError)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.showErrors, showErrors) || other.showErrors == showErrors)&&(identical(other.isCreated, isCreated) || other.isCreated == isCreated)&&(identical(other.showAccountCreated, showAccountCreated) || other.showAccountCreated == showAccountCreated));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hashAll([runtimeType,currentIndex,document,documentType,acceptTerms,relationType,firstName,lastName,email,phone,dialCode,language,bornAt,password,repeatPassword,isShowPassword,isCreated,placeOfBirth,birthCountry,birthCountryCode,address,emailError,passwordError,phoneError,errorMessage,isLoading,showErrors,showAccountCreated]);
|
||||
int get hashCode => Object.hash(runtimeType,currentIndex,firstName,lastName,email,phone,isoCode,password,repeatPassword,isShowPassword,acceptTerms,emailError,passwordError,phoneError,errorMessage,isLoading,showErrors,isCreated,showAccountCreated);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LegacySignUpViewState(currentIndex: $currentIndex, document: $document, documentType: $documentType, acceptTerms: $acceptTerms, relationType: $relationType, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, dialCode: $dialCode, language: $language, bornAt: $bornAt, password: $password, repeatPassword: $repeatPassword, isShowPassword: $isShowPassword, isCreated: $isCreated, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, birthCountryCode: $birthCountryCode, address: $address, emailError: $emailError, passwordError: $passwordError, phoneError: $phoneError, errorMessage: $errorMessage, isLoading: $isLoading, showErrors: $showErrors, showAccountCreated: $showAccountCreated)';
|
||||
return 'LegacySignUpViewState(currentIndex: $currentIndex, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, isoCode: $isoCode, password: $password, repeatPassword: $repeatPassword, isShowPassword: $isShowPassword, acceptTerms: $acceptTerms, emailError: $emailError, passwordError: $passwordError, phoneError: $phoneError, errorMessage: $errorMessage, isLoading: $isLoading, showErrors: $showErrors, isCreated: $isCreated, showAccountCreated: $showAccountCreated)';
|
||||
}
|
||||
|
||||
|
||||
@@ -302,11 +275,11 @@ abstract mixin class _$LegacySignUpViewStateCopyWith<$Res> implements $LegacySig
|
||||
factory _$LegacySignUpViewStateCopyWith(_LegacySignUpViewState value, $Res Function(_LegacySignUpViewState) _then) = __$LegacySignUpViewStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
int currentIndex, String document, String documentType, bool acceptTerms, String relationType, String firstName, String lastName, String email, String phone, String dialCode, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, bool isCreated, String placeOfBirth, String birthCountry, String birthCountryCode, LegacyAddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, bool showAccountCreated
|
||||
int currentIndex, String firstName, String lastName, String email, String phone, String isoCode, String password, String repeatPassword, bool isShowPassword, bool acceptTerms, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, bool isCreated, bool showAccountCreated
|
||||
});
|
||||
|
||||
|
||||
@override $LegacyAddressViewStateCopyWith<$Res> get address;
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
@@ -319,49 +292,31 @@ class __$LegacySignUpViewStateCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of LegacySignUpViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? currentIndex = null,Object? document = null,Object? documentType = null,Object? acceptTerms = null,Object? relationType = null,Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? dialCode = null,Object? language = null,Object? bornAt = freezed,Object? password = null,Object? repeatPassword = null,Object? isShowPassword = null,Object? isCreated = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? birthCountryCode = null,Object? address = null,Object? emailError = null,Object? passwordError = null,Object? phoneError = null,Object? errorMessage = null,Object? isLoading = null,Object? showErrors = null,Object? showAccountCreated = null,}) {
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? currentIndex = null,Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? isoCode = null,Object? password = null,Object? repeatPassword = null,Object? isShowPassword = null,Object? acceptTerms = null,Object? emailError = null,Object? passwordError = null,Object? phoneError = null,Object? errorMessage = null,Object? isLoading = null,Object? showErrors = null,Object? isCreated = null,Object? showAccountCreated = null,}) {
|
||||
return _then(_LegacySignUpViewState(
|
||||
currentIndex: null == currentIndex ? _self.currentIndex : currentIndex // ignore: cast_nullable_to_non_nullable
|
||||
as int,document: null == document ? _self.document : document // ignore: cast_nullable_to_non_nullable
|
||||
as String,documentType: null == documentType ? _self.documentType : documentType // ignore: cast_nullable_to_non_nullable
|
||||
as String,acceptTerms: null == acceptTerms ? _self.acceptTerms : acceptTerms // ignore: cast_nullable_to_non_nullable
|
||||
as bool,relationType: null == relationType ? _self.relationType : relationType // ignore: cast_nullable_to_non_nullable
|
||||
as String,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
||||
as int,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
||||
as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
|
||||
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
||||
as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||
as String,dialCode: null == dialCode ? _self.dialCode : dialCode // ignore: cast_nullable_to_non_nullable
|
||||
as String,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
|
||||
as String,bornAt: freezed == bornAt ? _self.bornAt : bornAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
|
||||
as String,isoCode: null == isoCode ? _self.isoCode : isoCode // ignore: cast_nullable_to_non_nullable
|
||||
as String,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
|
||||
as String,repeatPassword: null == repeatPassword ? _self.repeatPassword : repeatPassword // ignore: cast_nullable_to_non_nullable
|
||||
as String,isShowPassword: null == isShowPassword ? _self.isShowPassword : isShowPassword // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isCreated: null == isCreated ? _self.isCreated : isCreated // ignore: cast_nullable_to_non_nullable
|
||||
as bool,placeOfBirth: null == placeOfBirth ? _self.placeOfBirth : placeOfBirth // ignore: cast_nullable_to_non_nullable
|
||||
as String,birthCountry: null == birthCountry ? _self.birthCountry : birthCountry // ignore: cast_nullable_to_non_nullable
|
||||
as String,birthCountryCode: null == birthCountryCode ? _self.birthCountryCode : birthCountryCode // ignore: cast_nullable_to_non_nullable
|
||||
as String,address: null == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
|
||||
as LegacyAddressViewState,emailError: null == emailError ? _self.emailError : emailError // ignore: cast_nullable_to_non_nullable
|
||||
as bool,acceptTerms: null == acceptTerms ? _self.acceptTerms : acceptTerms // ignore: cast_nullable_to_non_nullable
|
||||
as bool,emailError: null == emailError ? _self.emailError : emailError // ignore: cast_nullable_to_non_nullable
|
||||
as String,passwordError: null == passwordError ? _self.passwordError : passwordError // ignore: cast_nullable_to_non_nullable
|
||||
as String,phoneError: null == phoneError ? _self.phoneError : phoneError // ignore: cast_nullable_to_non_nullable
|
||||
as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,showErrors: null == showErrors ? _self.showErrors : showErrors // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isCreated: null == isCreated ? _self.isCreated : isCreated // ignore: cast_nullable_to_non_nullable
|
||||
as bool,showAccountCreated: null == showAccountCreated ? _self.showAccountCreated : showAccountCreated // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of LegacySignUpViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$LegacyAddressViewStateCopyWith<$Res> get address {
|
||||
|
||||
return $LegacyAddressViewStateCopyWith<$Res>(_self.address, (value) {
|
||||
return _then(_self.copyWith(address: value));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
|
||||
Reference in New Issue
Block a user