sign up feature second version done
This commit is contained in:
@@ -20,14 +20,18 @@ abstract class SignUpRequestModel with _$SignUpRequestModel {
|
||||
required String userId,
|
||||
required String placeOfBirth,
|
||||
required String birthCountry,
|
||||
|
||||
// ignore: invalid_annotation_target
|
||||
@JsonKey(name: 'dni') required String documentNumber,
|
||||
|
||||
required String documentType,
|
||||
required String relationship,
|
||||
}) = _SignUpRequestModel;
|
||||
|
||||
factory SignUpRequestModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$SignUpRequestModelFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'dni')
|
||||
String get documentNumber;
|
||||
}
|
||||
|
||||
extension SignUpRequestModelMapper on SignUpRequestEntity {
|
||||
@@ -47,7 +51,7 @@ extension SignUpRequestModelMapper on SignUpRequestEntity {
|
||||
placeOfBirth: placeOfBirth,
|
||||
birthCountry: birthCountry,
|
||||
documentNumber: documentNumber,
|
||||
|
||||
documentType: documentType,
|
||||
relationship: relationship,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$SignUpRequestModel {
|
||||
|
||||
String get firstName; String get lastName; String get email; String get phone; String get language; String get password; List<AddressModel> get taxResidences; List<AddressModel> get addresses; int get bornAt; String get userId; String get placeOfBirth; String get birthCountry;@JsonKey(name: 'dni') String get documentNumber; String get relationship;
|
||||
String get firstName; String get lastName; String get email; String get phone; String get language; String get password; List<AddressModel> get taxResidences; List<AddressModel> get addresses; int get bornAt; String get userId; String get placeOfBirth; String get birthCountry;@JsonKey(name: 'dni') String get documentNumber; String get documentType; String get relationship;
|
||||
/// Create a copy of SignUpRequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -28,16 +28,16 @@ $SignUpRequestModelCopyWith<SignUpRequestModel> get copyWith => _$SignUpRequestM
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is SignUpRequestModel&&(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.userId, userId) || other.userId == userId)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(identical(other.documentNumber, documentNumber) || other.documentNumber == documentNumber)&&(identical(other.relationship, relationship) || other.relationship == relationship));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is SignUpRequestModel&&(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.userId, userId) || other.userId == userId)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(identical(other.documentNumber, documentNumber) || other.documentNumber == documentNumber)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.relationship, relationship) || other.relationship == relationship));
|
||||
}
|
||||
|
||||
@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,userId,placeOfBirth,birthCountry,documentNumber,relationship);
|
||||
int get hashCode => Object.hash(runtimeType,firstName,lastName,email,phone,language,password,const DeepCollectionEquality().hash(taxResidences),const DeepCollectionEquality().hash(addresses),bornAt,userId,placeOfBirth,birthCountry,documentNumber,documentType,relationship);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SignUpRequestModel(firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, password: $password, taxResidences: $taxResidences, addresses: $addresses, bornAt: $bornAt, userId: $userId, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, documentNumber: $documentNumber, relationship: $relationship)';
|
||||
return 'SignUpRequestModel(firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, password: $password, taxResidences: $taxResidences, addresses: $addresses, bornAt: $bornAt, userId: $userId, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, documentNumber: $documentNumber, documentType: $documentType, relationship: $relationship)';
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ abstract mixin class $SignUpRequestModelCopyWith<$Res> {
|
||||
factory $SignUpRequestModelCopyWith(SignUpRequestModel value, $Res Function(SignUpRequestModel) _then) = _$SignUpRequestModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String firstName, String lastName, String email, String phone, String language, String password, List<AddressModel> taxResidences, List<AddressModel> addresses, int bornAt, String userId, String placeOfBirth, String birthCountry,@JsonKey(name: 'dni') String documentNumber, String relationship
|
||||
String firstName, String lastName, String email, String phone, String language, String password, List<AddressModel> taxResidences, List<AddressModel> addresses, int bornAt, String userId, String placeOfBirth, String birthCountry,@JsonKey(name: 'dni') String documentNumber, String documentType, String relationship
|
||||
});
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class _$SignUpRequestModelCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of SignUpRequestModel
|
||||
/// 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? userId = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? documentNumber = null,Object? relationship = 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,Object? taxResidences = null,Object? addresses = null,Object? bornAt = null,Object? userId = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? documentNumber = null,Object? documentType = null,Object? relationship = 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
|
||||
@@ -80,6 +80,7 @@ as int,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_t
|
||||
as String,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,documentNumber: null == documentNumber ? _self.documentNumber : documentNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,documentType: null == documentType ? _self.documentType : documentType // ignore: cast_nullable_to_non_nullable
|
||||
as String,relationship: null == relationship ? _self.relationship : relationship // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
@@ -166,10 +167,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<AddressModel> taxResidences, List<AddressModel> addresses, int bornAt, String userId, String placeOfBirth, String birthCountry, @JsonKey(name: 'dni') String documentNumber, String relationship)? $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, List<AddressModel> taxResidences, List<AddressModel> addresses, int bornAt, String userId, String placeOfBirth, String birthCountry, @JsonKey(name: 'dni') String documentNumber, String documentType, String relationship)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _SignUpRequestModel() when $default != null:
|
||||
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.userId,_that.placeOfBirth,_that.birthCountry,_that.documentNumber,_that.relationship);case _:
|
||||
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.userId,_that.placeOfBirth,_that.birthCountry,_that.documentNumber,_that.documentType,_that.relationship);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -187,10 +188,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<AddressModel> taxResidences, List<AddressModel> addresses, int bornAt, String userId, String placeOfBirth, String birthCountry, @JsonKey(name: 'dni') String documentNumber, String relationship) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String firstName, String lastName, String email, String phone, String language, String password, List<AddressModel> taxResidences, List<AddressModel> addresses, int bornAt, String userId, String placeOfBirth, String birthCountry, @JsonKey(name: 'dni') String documentNumber, String documentType, String relationship) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _SignUpRequestModel():
|
||||
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.userId,_that.placeOfBirth,_that.birthCountry,_that.documentNumber,_that.relationship);case _:
|
||||
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.userId,_that.placeOfBirth,_that.birthCountry,_that.documentNumber,_that.documentType,_that.relationship);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -207,10 +208,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<AddressModel> taxResidences, List<AddressModel> addresses, int bornAt, String userId, String placeOfBirth, String birthCountry, @JsonKey(name: 'dni') String documentNumber, String relationship)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String firstName, String lastName, String email, String phone, String language, String password, List<AddressModel> taxResidences, List<AddressModel> addresses, int bornAt, String userId, String placeOfBirth, String birthCountry, @JsonKey(name: 'dni') String documentNumber, String documentType, String relationship)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _SignUpRequestModel() when $default != null:
|
||||
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.userId,_that.placeOfBirth,_that.birthCountry,_that.documentNumber,_that.relationship);case _:
|
||||
return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.password,_that.taxResidences,_that.addresses,_that.bornAt,_that.userId,_that.placeOfBirth,_that.birthCountry,_that.documentNumber,_that.documentType,_that.relationship);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -222,7 +223,7 @@ return $default(_that.firstName,_that.lastName,_that.email,_that.phone,_that.lan
|
||||
@JsonSerializable()
|
||||
|
||||
class _SignUpRequestModel implements SignUpRequestModel {
|
||||
const _SignUpRequestModel({required this.firstName, required this.lastName, required this.email, required this.phone, required this.language, required this.password, required final List<AddressModel> taxResidences, required final List<AddressModel> addresses, required this.bornAt, required this.userId, required this.placeOfBirth, required this.birthCountry, @JsonKey(name: 'dni') required this.documentNumber, required this.relationship}): _taxResidences = taxResidences,_addresses = addresses;
|
||||
const _SignUpRequestModel({required this.firstName, required this.lastName, required this.email, required this.phone, required this.language, required this.password, required final List<AddressModel> taxResidences, required final List<AddressModel> addresses, required this.bornAt, required this.userId, required this.placeOfBirth, required this.birthCountry, @JsonKey(name: 'dni') required this.documentNumber, required this.documentType, required this.relationship}): _taxResidences = taxResidences,_addresses = addresses;
|
||||
factory _SignUpRequestModel.fromJson(Map<String, dynamic> json) => _$SignUpRequestModelFromJson(json);
|
||||
|
||||
@override final String firstName;
|
||||
@@ -250,6 +251,7 @@ class _SignUpRequestModel implements SignUpRequestModel {
|
||||
@override final String placeOfBirth;
|
||||
@override final String birthCountry;
|
||||
@override@JsonKey(name: 'dni') final String documentNumber;
|
||||
@override final String documentType;
|
||||
@override final String relationship;
|
||||
|
||||
/// Create a copy of SignUpRequestModel
|
||||
@@ -265,16 +267,16 @@ Map<String, dynamic> toJson() {
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SignUpRequestModel&&(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.userId, userId) || other.userId == userId)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(identical(other.documentNumber, documentNumber) || other.documentNumber == documentNumber)&&(identical(other.relationship, relationship) || other.relationship == relationship));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SignUpRequestModel&&(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.userId, userId) || other.userId == userId)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(identical(other.documentNumber, documentNumber) || other.documentNumber == documentNumber)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.relationship, relationship) || other.relationship == relationship));
|
||||
}
|
||||
|
||||
@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,userId,placeOfBirth,birthCountry,documentNumber,relationship);
|
||||
int get hashCode => Object.hash(runtimeType,firstName,lastName,email,phone,language,password,const DeepCollectionEquality().hash(_taxResidences),const DeepCollectionEquality().hash(_addresses),bornAt,userId,placeOfBirth,birthCountry,documentNumber,documentType,relationship);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SignUpRequestModel(firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, password: $password, taxResidences: $taxResidences, addresses: $addresses, bornAt: $bornAt, userId: $userId, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, documentNumber: $documentNumber, relationship: $relationship)';
|
||||
return 'SignUpRequestModel(firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, password: $password, taxResidences: $taxResidences, addresses: $addresses, bornAt: $bornAt, userId: $userId, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, documentNumber: $documentNumber, documentType: $documentType, relationship: $relationship)';
|
||||
}
|
||||
|
||||
|
||||
@@ -285,7 +287,7 @@ abstract mixin class _$SignUpRequestModelCopyWith<$Res> implements $SignUpReques
|
||||
factory _$SignUpRequestModelCopyWith(_SignUpRequestModel value, $Res Function(_SignUpRequestModel) _then) = __$SignUpRequestModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String firstName, String lastName, String email, String phone, String language, String password, List<AddressModel> taxResidences, List<AddressModel> addresses, int bornAt, String userId, String placeOfBirth, String birthCountry,@JsonKey(name: 'dni') String documentNumber, String relationship
|
||||
String firstName, String lastName, String email, String phone, String language, String password, List<AddressModel> taxResidences, List<AddressModel> addresses, int bornAt, String userId, String placeOfBirth, String birthCountry,@JsonKey(name: 'dni') String documentNumber, String documentType, String relationship
|
||||
});
|
||||
|
||||
|
||||
@@ -302,7 +304,7 @@ class __$SignUpRequestModelCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of SignUpRequestModel
|
||||
/// 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? userId = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? documentNumber = null,Object? relationship = 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,Object? taxResidences = null,Object? addresses = null,Object? bornAt = null,Object? userId = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? documentNumber = null,Object? documentType = null,Object? relationship = null,}) {
|
||||
return _then(_SignUpRequestModel(
|
||||
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
|
||||
@@ -317,6 +319,7 @@ as int,userId: null == userId ? _self.userId : userId // ignore: cast_nullable_t
|
||||
as String,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,documentNumber: null == documentNumber ? _self.documentNumber : documentNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,documentType: null == documentType ? _self.documentType : documentType // ignore: cast_nullable_to_non_nullable
|
||||
as String,relationship: null == relationship ? _self.relationship : relationship // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
|
||||
@@ -25,6 +25,7 @@ _SignUpRequestModel _$SignUpRequestModelFromJson(Map<String, dynamic> json) =>
|
||||
placeOfBirth: json['placeOfBirth'] as String,
|
||||
birthCountry: json['birthCountry'] as String,
|
||||
documentNumber: json['dni'] as String,
|
||||
documentType: json['documentType'] as String,
|
||||
relationship: json['relationship'] as String,
|
||||
);
|
||||
|
||||
@@ -43,5 +44,6 @@ Map<String, dynamic> _$SignUpRequestModelToJson(_SignUpRequestModel instance) =>
|
||||
'placeOfBirth': instance.placeOfBirth,
|
||||
'birthCountry': instance.birthCountry,
|
||||
'dni': instance.documentNumber,
|
||||
'documentType': instance.documentType,
|
||||
'relationship': instance.relationship,
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'package:auth/auth.dart';
|
||||
import 'package:auth/src/features/device_sign_up/add_kid_screen.dart';
|
||||
import 'package:auth/src/features/device_sign_up/link_watch/link_watch_screen.dart';
|
||||
import 'package:auth/src/features/device_sign_up/link_watch/link_watch_previous_screen.dart';
|
||||
import 'package:auth/src/features/sign_up/presentation/account_created_screen.dart';
|
||||
import 'package:auth/src/features/sign_up/presentation/screens/account_created_screen.dart';
|
||||
import 'package:auth/src/widgets/layouts/form_step_layout.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
import 'package:auth/src/features/sign_up/presentation/state/sign_up_view_model.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
|
||||
class AccountCreatedScreen extends ConsumerWidget {
|
||||
final NavigationContract navigationContract;
|
||||
|
||||
const AccountCreatedScreen({super.key, required this.navigationContract});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
|
||||
final state = ref.watch(signUpViewModelProvider);
|
||||
|
||||
final String email = state.email;
|
||||
final String fullName = '${state.firstName} ${state.lastName}'.trim();
|
||||
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
child: Scaffold(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
body: Container(
|
||||
margin: const EdgeInsets.all(30),
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
const Spacer(flex: 10),
|
||||
Icon(
|
||||
Icons.check,
|
||||
color: theme.getColorFor(ThemeCode.buttonPrimary),
|
||||
size: 50,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const Text(
|
||||
"Cuenta creada",
|
||||
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
Text.rich(
|
||||
textAlign: TextAlign.center,
|
||||
TextSpan(
|
||||
text: "Has creado la cuenta para:\n",
|
||||
children: [
|
||||
TextSpan(
|
||||
text: fullName,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
Text.rich(
|
||||
textAlign: TextAlign.center,
|
||||
TextSpan(
|
||||
text: "Hemos enviado un email de verificación a:\n",
|
||||
children: [
|
||||
TextSpan(
|
||||
text: email,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
const Text(
|
||||
"Crea la cuenta de tu peque e ingresa su \nprimera paga para utilizarla con su reloj",
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
PrimaryButton(
|
||||
onPressed: () {
|
||||
navigationContract.goTo(AppRoutes.login);
|
||||
},
|
||||
text: "Continuar",
|
||||
color: theme.getColorFor(ThemeCode.buttonPrimary),
|
||||
),
|
||||
const Spacer(flex: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
import 'package:auth/src/features/sign_up/presentation/state/sign_up_view_model.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
|
||||
class AccountCreatedScreen extends ConsumerWidget {
|
||||
final NavigationContract navigationContract;
|
||||
|
||||
const AccountCreatedScreen({super.key, required this.navigationContract});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
|
||||
final state = ref.watch(signUpViewModelProvider);
|
||||
|
||||
final String email = state.email;
|
||||
final String fullName = '${state.firstName} ${state.lastName}'.trim();
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
body: Container(
|
||||
margin: const EdgeInsets.all(30),
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
const Spacer(flex: 10),
|
||||
Icon(
|
||||
Icons.check,
|
||||
color: theme.getColorFor(ThemeCode.buttonPrimary),
|
||||
size: 50,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
context.translate(I18n.accountCreatedTitle),
|
||||
style: const TextStyle(
|
||||
fontSize: 30,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
Text.rich(
|
||||
textAlign: TextAlign.center,
|
||||
TextSpan(
|
||||
text: '${context.translate(I18n.accountCreatedForLabel)}\n',
|
||||
children: [
|
||||
TextSpan(
|
||||
text: fullName,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
Text.rich(
|
||||
textAlign: TextAlign.center,
|
||||
TextSpan(
|
||||
text:
|
||||
'${context.translate(I18n.accountCreatedEmailVerificationSentLabel)}\n',
|
||||
children: [
|
||||
TextSpan(
|
||||
text: email,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
context.translate(I18n.accountCreatedChildSetupHint),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
PrimaryButton(
|
||||
onPressed: () => navigationContract.goTo(AppRoutes.login),
|
||||
text: context.translate(I18n.accountCreatedContinue),
|
||||
color: theme.getColorFor(ThemeCode.buttonPrimary),
|
||||
),
|
||||
const Spacer(flex: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,281 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:auth/src/features/login/presentation/widgets/two_factor_bottom_sheet.dart';
|
||||
import 'package:auth/src/features/sign_up/presentation/state/sign_up_view_model.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
|
||||
class SecretCodeScreen extends ConsumerWidget {
|
||||
final NavigationContract navigationContract;
|
||||
|
||||
const SecretCodeScreen({super.key, required this.navigationContract});
|
||||
|
||||
Uint8List? _qrBytes(String? dataUri) {
|
||||
final value = (dataUri ?? '').trim();
|
||||
if (value.isEmpty) return null;
|
||||
|
||||
final idx = value.indexOf('base64,');
|
||||
final b64 = idx == -1 ? value : value.substring(idx + 7);
|
||||
|
||||
try {
|
||||
return base64Decode(b64);
|
||||
} catch (_) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool?> _openTwoFactorSignUpBottomSheet(
|
||||
BuildContext context,
|
||||
WidgetRef ref,
|
||||
) async {
|
||||
final token = ref.read(signUpViewModelProvider).token;
|
||||
if (token.trim().isEmpty) return false;
|
||||
|
||||
return showModalBottomSheet<bool>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
useSafeArea: true,
|
||||
isDismissible: false,
|
||||
enableDrag: false,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (context) {
|
||||
return Consumer(
|
||||
builder: (context, ref, _) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
final vm = ref.read(signUpViewModelProvider.notifier);
|
||||
|
||||
final otpErrorKey = ref.watch(
|
||||
signUpViewModelProvider.select((s) => s.otpError),
|
||||
);
|
||||
final isOtpLoading = ref.watch(
|
||||
signUpViewModelProvider.select((s) => s.isOtpLoading),
|
||||
);
|
||||
final otpCode = ref.watch(
|
||||
signUpViewModelProvider.select((s) => s.otpCode),
|
||||
);
|
||||
|
||||
final otpErrorText = otpErrorKey.isEmpty
|
||||
? ''
|
||||
: context.translate(otpErrorKey);
|
||||
|
||||
Future<void> onVerify() async {
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
|
||||
final ok = await vm.verifyTwoFACodeSignUp(token: token);
|
||||
if (!context.mounted) return;
|
||||
|
||||
if (ok) Navigator.of(context).pop(true);
|
||||
}
|
||||
|
||||
return TwoFactorBottomSheetView(
|
||||
theme: theme,
|
||||
title: context.translate(I18n.twoFactorTitle),
|
||||
subtitle: context.translate(I18n.twoFactorSubtitle),
|
||||
verifyText: context.translate(I18n.twoFactorVerify),
|
||||
closeText: context.translate(I18n.close),
|
||||
isOtpLoading: isOtpLoading,
|
||||
otpCode: otpCode,
|
||||
otpErrorText: otpErrorText,
|
||||
onChanged: vm.setOtpCode,
|
||||
onVerify: onVerify,
|
||||
onClose: () => Navigator.of(context).pop(false),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
final vm = ref.read(signUpViewModelProvider.notifier);
|
||||
final state = ref.watch(signUpViewModelProvider);
|
||||
|
||||
final secret = state.twoFASecret?.item.secret.trim() ?? '';
|
||||
final qrDataUri = state.twoFASecret?.item.qr;
|
||||
final qrBytes = _qrBytes(qrDataUri);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
body: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.fromLTRB(24, 8, 24, 24),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
context.translate(I18n.secretCodeTitle),
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: theme.getColorFor(ThemeCode.textPrimary),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
_StepBlock(
|
||||
theme: theme,
|
||||
number: '1.',
|
||||
title: context.translate(I18n.secretCodeStep1Title),
|
||||
body: context.translate(I18n.secretCodeStep1Body),
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
|
||||
_StepBlock(
|
||||
theme: theme,
|
||||
number: '2.',
|
||||
title: context.translate(I18n.secretCodeStep2Title),
|
||||
body: context.translate(I18n.secretCodeStep2Body),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
Center(
|
||||
child: Container(
|
||||
width: 150,
|
||||
height: 150,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(width: 1, color: Colors.black),
|
||||
color: theme.getColorFor(ThemeCode.backgroundSecondary),
|
||||
),
|
||||
child: qrBytes == null
|
||||
? const Center(child: Icon(Icons.qr_code_2, size: 60))
|
||||
: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Image.memory(qrBytes, fit: BoxFit.cover),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
Center(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 14,
|
||||
vertical: 10,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: theme.getColorFor(ThemeCode.backgroundSecondary),
|
||||
border: Border.all(width: 1, color: Colors.black),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
secret,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: 1.1,
|
||||
color: theme.getColorFor(ThemeCode.textPrimary),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
IconButton(
|
||||
visualDensity: VisualDensity.compact,
|
||||
padding: EdgeInsets.zero,
|
||||
constraints: const BoxConstraints(),
|
||||
icon: const Icon(Icons.copy, size: 18),
|
||||
onPressed: secret.isEmpty
|
||||
? null
|
||||
: () async {
|
||||
await Clipboard.setData(
|
||||
ClipboardData(text: secret),
|
||||
);
|
||||
if (!context.mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
context.translate(
|
||||
I18n.secretCodeKeyCopied,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 18),
|
||||
_StepBlock(
|
||||
theme: theme,
|
||||
number: '3.',
|
||||
title: context.translate(I18n.secretCodeStep3Title),
|
||||
body: context.translate(I18n.secretCodeStep3Body),
|
||||
),
|
||||
|
||||
const SizedBox(height: 26),
|
||||
PrimaryButton(
|
||||
onPressed: () async {
|
||||
final verified = await _openTwoFactorSignUpBottomSheet(
|
||||
context,
|
||||
ref,
|
||||
);
|
||||
if (!context.mounted) return;
|
||||
|
||||
if (verified == true) {
|
||||
vm.showAccountCreated();
|
||||
}
|
||||
},
|
||||
text: context.translate(I18n.secretCodeConfigure),
|
||||
color: theme.getColorFor(ThemeCode.buttonPrimary),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _StepBlock extends StatelessWidget {
|
||||
final ThemePort theme;
|
||||
final String number;
|
||||
final String title;
|
||||
final String body;
|
||||
|
||||
const _StepBlock({
|
||||
required this.theme,
|
||||
required this.number,
|
||||
required this.title,
|
||||
required this.body,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RichText(
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
height: 1.35,
|
||||
fontSize: 14,
|
||||
color: theme.getColorFor(ThemeCode.textPrimary),
|
||||
),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: '$number ',
|
||||
style: const TextStyle(fontWeight: FontWeight.w700),
|
||||
),
|
||||
TextSpan(
|
||||
text: '$title\n',
|
||||
style: const TextStyle(fontWeight: FontWeight.w700),
|
||||
),
|
||||
TextSpan(
|
||||
text: body,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w400,
|
||||
color: theme.getColorFor(ThemeCode.textSecondary),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
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 SignupAddressScreen extends StatelessWidget {
|
||||
const SignupAddressScreen({
|
||||
super.key,
|
||||
|
||||
required this.bornAtController,
|
||||
|
||||
required this.onPickBornAt,
|
||||
required this.relationshipSelected,
|
||||
required this.onRelationshipChanged,
|
||||
required this.relationshipOptions,
|
||||
@@ -23,8 +25,7 @@ class SignupAddressScreen extends StatelessWidget {
|
||||
|
||||
required this.addressCountrySelected,
|
||||
required this.onAddressCountryChanged,
|
||||
required this.addressCountryOptions,
|
||||
required this.addressCountryHint,
|
||||
required this.addressCountryController,
|
||||
required this.addressCountryLabel,
|
||||
|
||||
required this.postCodeController,
|
||||
@@ -37,6 +38,7 @@ class SignupAddressScreen extends StatelessWidget {
|
||||
|
||||
required this.birthCountryLabel,
|
||||
required this.birthCountryHint,
|
||||
required this.onBirthCountryChanged,
|
||||
|
||||
required this.streetLabel,
|
||||
required this.streetHint,
|
||||
@@ -55,6 +57,7 @@ class SignupAddressScreen extends StatelessWidget {
|
||||
});
|
||||
|
||||
final TextEditingController bornAtController;
|
||||
final VoidCallback onPickBornAt;
|
||||
|
||||
final String? relationshipSelected;
|
||||
final ValueChanged<String?> onRelationshipChanged;
|
||||
@@ -71,10 +74,9 @@ class SignupAddressScreen extends StatelessWidget {
|
||||
final TextEditingController stateController;
|
||||
|
||||
final String? addressCountrySelected;
|
||||
final ValueChanged<String?> onAddressCountryChanged;
|
||||
final List<String> addressCountryOptions;
|
||||
final String addressCountryHint;
|
||||
final ValueChanged<CountryCode> onAddressCountryChanged;
|
||||
final String addressCountryLabel;
|
||||
final TextEditingController addressCountryController;
|
||||
|
||||
final TextEditingController postCodeController;
|
||||
|
||||
@@ -83,6 +85,7 @@ class SignupAddressScreen extends StatelessWidget {
|
||||
|
||||
final String placeOfBirthLabel;
|
||||
final String placeOfBirthHint;
|
||||
final ValueChanged<CountryCode> onBirthCountryChanged;
|
||||
|
||||
final String birthCountryLabel;
|
||||
final String birthCountryHint;
|
||||
@@ -106,12 +109,19 @@ class SignupAddressScreen extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
CustomTextField(
|
||||
label: birthDateLabel,
|
||||
hint: birthDateHint,
|
||||
keyboardType: TextInputType.number,
|
||||
controller: bornAtController,
|
||||
GestureDetector(
|
||||
onTap: onPickBornAt,
|
||||
child: AbsorbPointer(
|
||||
child: CustomTextField(
|
||||
label: birthDateLabel,
|
||||
hint: birthDateHint,
|
||||
controller: bornAtController,
|
||||
readOnly: true,
|
||||
keyboardType: TextInputType.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 8),
|
||||
|
||||
Align(
|
||||
@@ -133,11 +143,26 @@ class SignupAddressScreen extends StatelessWidget {
|
||||
controller: placeOfBirthController,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
CustomTextField(
|
||||
label: birthCountryLabel,
|
||||
hint: birthCountryHint,
|
||||
controller: birthCountryController,
|
||||
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),
|
||||
|
||||
@@ -176,12 +201,22 @@ class SignupAddressScreen extends StatelessWidget {
|
||||
style: const TextStyle(fontSize: 14, letterSpacing: 0),
|
||||
),
|
||||
),
|
||||
CustomDropdown(
|
||||
items: addressCountryOptions.map(Text.new).toList(growable: false),
|
||||
values: addressCountryOptions,
|
||||
value: addressCountrySelected,
|
||||
hint: addressCountryHint,
|
||||
onChanged: (v) => onAddressCountryChanged(v as String?),
|
||||
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),
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
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 SignupPersonalScreen extends StatelessWidget {
|
||||
final TextEditingController firstNameTextFieldController;
|
||||
@@ -25,6 +27,7 @@ class SignupPersonalScreen extends StatelessWidget {
|
||||
|
||||
final String phoneLabel;
|
||||
final String phoneHint;
|
||||
final ValueChanged<CountryCode> onDialCodeChanged;
|
||||
|
||||
final String emailLabel;
|
||||
final String emailHint;
|
||||
@@ -53,6 +56,7 @@ class SignupPersonalScreen extends StatelessWidget {
|
||||
required this.documentNumberHint,
|
||||
required this.phoneLabel,
|
||||
required this.phoneHint,
|
||||
required this.onDialCodeChanged,
|
||||
required this.emailLabel,
|
||||
required this.emailHint,
|
||||
required this.acceptTerms,
|
||||
@@ -102,11 +106,26 @@ class SignupPersonalScreen extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
CustomTextField(
|
||||
label: phoneLabel,
|
||||
hint: phoneHint,
|
||||
keyboardType: TextInputType.number,
|
||||
controller: phoneTextFieldController,
|
||||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(phoneLabel, style: const TextStyle(fontSize: 14)),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
CountryPrefixPicker(
|
||||
headerText: context.translate(I18n.selectYourCountry),
|
||||
onChanged: onDialCodeChanged,
|
||||
),
|
||||
Expanded(
|
||||
child: CustomTextField(
|
||||
controller: phoneTextFieldController,
|
||||
hint: context.translate(I18n.phoneNumber),
|
||||
keyboardType: TextInputType.number,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
CustomTextField(
|
||||
@@ -1,13 +1,12 @@
|
||||
import 'package:auth/src/features/login/presentation/widgets/two_factor_bottom_sheet.dart';
|
||||
import 'package:auth/src/features/sign_up/presentation/account_created_screen.dart';
|
||||
import 'package:auth/src/features/sign_up/presentation/sign_up_steps.dart';
|
||||
import 'package:auth/src/features/sign_up/presentation/state/sign_up_view_model.dart';
|
||||
import 'package:auth/src/features/sign_up/presentation/screens/account_created_screen.dart';
|
||||
import 'package:auth/src/features/sign_up/presentation/screens/secret_code_screen.dart';
|
||||
import 'package:auth/src/widgets/layouts/sign_up_layout.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
|
||||
class SignupScreen extends ConsumerWidget {
|
||||
final NavigationContract navigationContract;
|
||||
@@ -20,7 +19,7 @@ class SignupScreen extends ConsumerWidget {
|
||||
final vm = ref.read(signUpViewModelProvider.notifier);
|
||||
final state = ref.read(signUpViewModelProvider);
|
||||
|
||||
final steps = signUpSteps();
|
||||
final steps = signUpSteps(context);
|
||||
final isLastStep = state.currentIndex >= steps.length - 1;
|
||||
|
||||
if (!isLastStep) {
|
||||
@@ -28,79 +27,10 @@ class SignupScreen extends ConsumerWidget {
|
||||
return;
|
||||
}
|
||||
|
||||
final isSignUp = await vm.signUp();
|
||||
final ok = await vm.signUp();
|
||||
if (!context.mounted) return;
|
||||
|
||||
if (!isSignUp) return;
|
||||
|
||||
final verified = await _openTwoFactorSignUpBottomSheet(context, ref);
|
||||
if (!context.mounted) return;
|
||||
|
||||
if (verified == true) {
|
||||
vm.showAccountCreated();
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool?> _openTwoFactorSignUpBottomSheet(
|
||||
BuildContext context,
|
||||
WidgetRef ref,
|
||||
) async {
|
||||
final token = ref.read(signUpViewModelProvider).token;
|
||||
if (token.trim().isEmpty) return false;
|
||||
|
||||
return showModalBottomSheet<bool>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
useSafeArea: true,
|
||||
isDismissible: false,
|
||||
enableDrag: false,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (context) {
|
||||
return Consumer(
|
||||
builder: (context, ref, _) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
final vm = ref.read(signUpViewModelProvider.notifier);
|
||||
|
||||
final otpErrorKey = ref.watch(
|
||||
signUpViewModelProvider.select((s) => s.otpError),
|
||||
);
|
||||
final isOtpLoading = ref.watch(
|
||||
signUpViewModelProvider.select((s) => s.isOtpLoading),
|
||||
);
|
||||
final otpCode = ref.watch(
|
||||
signUpViewModelProvider.select((s) => s.otpCode),
|
||||
);
|
||||
|
||||
final otpErrorText = otpErrorKey.isEmpty
|
||||
? ''
|
||||
: context.translate(otpErrorKey);
|
||||
|
||||
Future<void> onVerify() async {
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
|
||||
final ok = await vm.verifyTwoFACodeSignUp(token: token);
|
||||
if (!context.mounted) return;
|
||||
|
||||
if (ok) Navigator.of(context).pop(true);
|
||||
}
|
||||
|
||||
return TwoFactorBottomSheetView(
|
||||
theme: theme,
|
||||
title: context.translate(I18n.twoFactorTitle),
|
||||
subtitle: context.translate(I18n.twoFactorSubtitle),
|
||||
verifyText: context.translate(I18n.twoFactorVerify),
|
||||
closeText: context.translate(I18n.close),
|
||||
isOtpLoading: isOtpLoading,
|
||||
otpCode: otpCode,
|
||||
otpErrorText: otpErrorText,
|
||||
onChanged: vm.setOtpCode,
|
||||
onVerify: onVerify,
|
||||
onClose: () => Navigator.of(context).pop(false),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
if (!ok) return;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -109,10 +39,14 @@ class SignupScreen extends ConsumerWidget {
|
||||
final vm = ref.read(signUpViewModelProvider.notifier);
|
||||
final state = ref.watch(signUpViewModelProvider);
|
||||
|
||||
final steps = signUpSteps();
|
||||
final steps = signUpSteps(context);
|
||||
final index = state.currentIndex.clamp(0, steps.length - 1);
|
||||
final step = steps[index];
|
||||
|
||||
if (state.showSecretCode) {
|
||||
return SecretCodeScreen(navigationContract: navigationContract);
|
||||
}
|
||||
|
||||
if (state.showAccountCreated) {
|
||||
return AccountCreatedScreen(navigationContract: navigationContract);
|
||||
}
|
||||
|
||||
@@ -1,68 +1,114 @@
|
||||
import 'package:auth/src/features/sign_up/models/sign_up_step_config.dart';
|
||||
import 'package:auth/src/features/sign_up/presentation/sign_up_address_screen.dart';
|
||||
import 'package:auth/src/features/sign_up/presentation/sign_up_password_screen.dart';
|
||||
import 'package:auth/src/features/sign_up/presentation/sign_up_personal_screen.dart';
|
||||
import 'package:auth/src/features/sign_up/presentation/state/sign_up_view_model.dart';
|
||||
import 'package:auth/src/features/sign_up/presentation/screens/sign_up_address_screen.dart';
|
||||
import 'package:auth/src/features/sign_up/presentation/screens/sign_up_password_screen.dart';
|
||||
import 'package: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:sf_localizations/sf_localizations.dart';
|
||||
|
||||
List<SignUpStepConfig> signUpSteps() => [
|
||||
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,
|
||||
'tutor': I18n.relationshipTutor,
|
||||
};
|
||||
|
||||
List<SignUpStepConfig> signUpSteps(BuildContext context) => [
|
||||
SignUpStepConfig(
|
||||
supertitle: 'Usuario y contacto',
|
||||
title: 'Crea tu usuario',
|
||||
subtitle: 'Con tu email y tu número podremos mantenerte siempre informado',
|
||||
supertitle: context.translate(I18n.stepUserContactSupertitle),
|
||||
title: context.translate(I18n.stepUserContactTitle),
|
||||
subtitle: context.translate(I18n.stepUserContactSubtitle),
|
||||
bodyBuilder: (context, ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
final vm = ref.read(signUpViewModelProvider.notifier);
|
||||
final state = ref.watch(signUpViewModelProvider);
|
||||
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 SignupPersonalScreen(
|
||||
firstNameTextFieldController: vm.firstNameController,
|
||||
lastNameTextFieldController: vm.lastNameController,
|
||||
documentNumberTextFieldController: vm.documentNumberController,
|
||||
phoneTextFieldController: vm.phoneController,
|
||||
emailTextFieldController: vm.emailController,
|
||||
documentTypeSelected: state.documentType.trim().isEmpty
|
||||
? null
|
||||
: state.documentType,
|
||||
onDocumentTypeChanged: vm.setDocumentType,
|
||||
|
||||
documentTypeSelected: documentTypeSelected,
|
||||
|
||||
onDocumentTypeChanged: (label) {
|
||||
final documentKey = documentKeys[label ?? ''] ?? '';
|
||||
vm.setDocumentType(documentKey);
|
||||
},
|
||||
|
||||
acceptTerms: state.acceptTerms,
|
||||
onAcceptTermsPressed: (v) => vm.setAcceptTerms(v ?? false),
|
||||
termsText: 'Acepto los términos y condiciones',
|
||||
termsText: context.translate(I18n.termsText),
|
||||
theme: theme,
|
||||
firstNameLabel: 'Nombre',
|
||||
firstNameHint: 'Nombre',
|
||||
lastNameLabel: 'Apellido',
|
||||
lastNameHint: 'Apellido',
|
||||
documentTypeOptions: const ['DNI', 'NIE', 'Pasaporte'],
|
||||
documentTypeHint: 'Documento',
|
||||
|
||||
firstNameLabel: context.translate(I18n.firstNameLabel),
|
||||
firstNameHint: context.translate(I18n.firstNameHint),
|
||||
lastNameLabel: context.translate(I18n.lastNameLabel),
|
||||
lastNameHint: context.translate(I18n.lastNameHint),
|
||||
|
||||
documentTypeOptions: documentLabel.values.toList(),
|
||||
documentTypeHint: context.translate(I18n.documentTypeHint),
|
||||
|
||||
documentNumberLabel: '',
|
||||
documentNumberHint: 'DNI/NIE/Pasaporte',
|
||||
phoneLabel: 'Teléfono móvil',
|
||||
phoneHint: 'Teléfono móvil',
|
||||
emailLabel: 'Correo electrónico',
|
||||
emailHint: 'Correo electrónico',
|
||||
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);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
SignUpStepConfig(
|
||||
supertitle: 'Datos personales',
|
||||
title: 'Identifícate',
|
||||
subtitle:
|
||||
'Nos aseguraremos de que la cuenta esté a nombre del adulto responsable',
|
||||
supertitle: context.translate(I18n.stepPersonalDataSupertitle),
|
||||
title: context.translate(I18n.stepPersonalDataTitle),
|
||||
subtitle: context.translate(I18n.stepPersonalDataSubtitle),
|
||||
bodyBuilder: (context, ref) {
|
||||
final vm = ref.read(signUpViewModelProvider.notifier);
|
||||
final state = ref.watch(signUpViewModelProvider);
|
||||
|
||||
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.relationship.trim().isEmpty
|
||||
? null
|
||||
: relationshipLabel[state.relationship];
|
||||
|
||||
return SignupAddressScreen(
|
||||
bornAtController: vm.bornAtController,
|
||||
onPickBornAt: () => vm.pickBornAt(context),
|
||||
|
||||
relationshipSelected: state.relationship.trim().isEmpty
|
||||
? null
|
||||
: state.relationship,
|
||||
onRelationshipChanged: vm.setRelationship,
|
||||
relationshipOptions: const ['father', 'mother', 'tutor'],
|
||||
relationshipHint: 'Selecciona una opción',
|
||||
relationshipLabel: '¿Qué familiar eres?',
|
||||
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,
|
||||
@@ -75,45 +121,47 @@ List<SignUpStepConfig> signUpSteps() => [
|
||||
addressCountrySelected: state.address.country.trim().isEmpty
|
||||
? null
|
||||
: state.address.country,
|
||||
onAddressCountryChanged: vm.setAddressCountry,
|
||||
addressCountryOptions: const ['Spain', 'France', 'Portugal'],
|
||||
addressCountryHint: 'País',
|
||||
addressCountryLabel: 'País (dirección)',
|
||||
onAddressCountryChanged: (CountryCode value) {
|
||||
vm.setAddressCountry(name: value.name ?? '');
|
||||
},
|
||||
addressCountryLabel: context.translate(I18n.addressCountryLabel),
|
||||
addressCountryController: vm.addressCountryController,
|
||||
|
||||
postCodeController: vm.addressPostCodeController,
|
||||
|
||||
birthDateLabel: 'Fecha de nacimiento',
|
||||
birthDateHint: 'DD/MM/AAAA',
|
||||
birthDateLabel: context.translate(I18n.birthDateLabel),
|
||||
birthDateHint: context.translate(I18n.birthDateHint),
|
||||
|
||||
placeOfBirthLabel: 'Lugar de nacimiento',
|
||||
placeOfBirthHint: 'Ciudad de nacimiento',
|
||||
placeOfBirthLabel: context.translate(I18n.placeOfBirthLabel),
|
||||
placeOfBirthHint: context.translate(I18n.placeOfBirthHint),
|
||||
|
||||
birthCountryLabel: 'País de nacimiento',
|
||||
birthCountryHint: 'País de nacimiento',
|
||||
birthCountryLabel: context.translate(I18n.birthCountryLabel),
|
||||
birthCountryHint: context.translate(I18n.birthCountryHint),
|
||||
onBirthCountryChanged: (CountryCode value) {
|
||||
vm.setBirthCountryFromPicker(name: value.name ?? '');
|
||||
},
|
||||
|
||||
streetLabel: 'Calle / Dirección',
|
||||
streetHint: 'Calle Gran Vía 30 6º',
|
||||
streetLabel: context.translate(I18n.streetLabel),
|
||||
streetHint: context.translate(I18n.streetHint),
|
||||
|
||||
cityLabel: 'Ciudad',
|
||||
cityHint: 'Ciudad',
|
||||
cityLabel: context.translate(I18n.cityLabel),
|
||||
cityHint: context.translate(I18n.cityHint),
|
||||
|
||||
provinceLabel: 'Provincia',
|
||||
provinceHint: 'Provincia',
|
||||
provinceLabel: context.translate(I18n.provinceLabel),
|
||||
provinceHint: context.translate(I18n.provinceHint),
|
||||
|
||||
stateLabel: 'Comunidad / Estado',
|
||||
stateHint: 'Comunidad / Estado',
|
||||
stateLabel: context.translate(I18n.stateLabel),
|
||||
stateHint: context.translate(I18n.stateHint),
|
||||
|
||||
postCodeLabel: 'Código postal',
|
||||
postCodeHint: '28013',
|
||||
postCodeLabel: context.translate(I18n.postCodeLabel),
|
||||
postCodeHint: context.translate(I18n.postCodeHint),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
SignUpStepConfig(
|
||||
supertitle: 'Domicilio',
|
||||
title: 'Tu dirección',
|
||||
subtitle:
|
||||
'Contraseña mínima de 8 caracteres, con una mayúscula, un número y un carácter especial',
|
||||
supertitle: context.translate(I18n.stepAddressSupertitle),
|
||||
title: context.translate(I18n.stepAddressTitle),
|
||||
subtitle: context.translate(I18n.passwordRulesSubtitle),
|
||||
bodyBuilder: (context, ref) {
|
||||
final vm = ref.read(signUpViewModelProvider.notifier);
|
||||
final state = ref.watch(signUpViewModelProvider);
|
||||
|
||||
@@ -9,7 +9,7 @@ abstract class AddressViewState with _$AddressViewState {
|
||||
@Default('') String city,
|
||||
@Default('') String province,
|
||||
@Default('') String state,
|
||||
@Default('') String country,
|
||||
@Default('España') String country,
|
||||
int? postCode,
|
||||
}) = _AddressViewState;
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ return $default(_that.street,_that.city,_that.province,_that.state,_that.country
|
||||
|
||||
|
||||
class _AddressViewState implements AddressViewState {
|
||||
const _AddressViewState({this.street = '', this.city = '', this.province = '', this.state = '', this.country = '', this.postCode});
|
||||
const _AddressViewState({this.street = '', this.city = '', this.province = '', this.state = '', this.country = 'España', this.postCode});
|
||||
|
||||
|
||||
@override@JsonKey() final String street;
|
||||
|
||||
@@ -158,6 +158,36 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
|
||||
);
|
||||
}
|
||||
|
||||
void updateDialCode(String dialCode) {
|
||||
state = state.copyWith(dialCode: dialCode);
|
||||
}
|
||||
|
||||
void setBirthCountryFromPicker({required String name}) {
|
||||
birthCountryController.text = name;
|
||||
state = state.copyWith(birthCountry: name);
|
||||
}
|
||||
|
||||
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) return;
|
||||
if (picked == null) return;
|
||||
|
||||
setBornAt(picked);
|
||||
}
|
||||
|
||||
void setDocumentType(String? value) {
|
||||
final v = value ?? '';
|
||||
if (documentTypeController.text == v) return;
|
||||
@@ -170,10 +200,9 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
|
||||
relationshipController.text = v;
|
||||
}
|
||||
|
||||
void setAddressCountry(String? value) {
|
||||
final v = value ?? '';
|
||||
if (addressCountryController.text == v) return;
|
||||
addressCountryController.text = v;
|
||||
void setAddressCountry({required String name}) {
|
||||
addressCountryController.text = name;
|
||||
state = state.copyWith(address: state.address.copyWith(country: name));
|
||||
}
|
||||
|
||||
void setAcceptTerms(bool value) {
|
||||
@@ -219,7 +248,7 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
|
||||
final text = phoneController.text;
|
||||
if (text == state.phone) return;
|
||||
|
||||
state = state.copyWith(phone: text, errorMessage: '');
|
||||
state = state.copyWith(phone: text);
|
||||
|
||||
if (state.showErrors) {
|
||||
state = state.copyWith(phoneError: _phoneErrorFor(text));
|
||||
@@ -420,18 +449,16 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
|
||||
} else {
|
||||
state = state.copyWith(errorMessage: '');
|
||||
}
|
||||
|
||||
if (state.relationship.trim().isEmpty) {
|
||||
state = state.copyWith(errorMessage: 'La relación es obligatoria');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (state.bornAt == null) {
|
||||
state = state.copyWith(
|
||||
errorMessage: 'Selecciona una fecha de nacimiento válida (DD/MM/AAAA)',
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (state.relationship.trim().isEmpty) {
|
||||
state = state.copyWith(errorMessage: 'La relación es obligatoria');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (state.placeOfBirth.trim().isEmpty) {
|
||||
state = state.copyWith(errorMessage: 'Falta el lugar de nacimiento');
|
||||
@@ -537,7 +564,7 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
|
||||
firstName: state.firstName.trim(),
|
||||
lastName: state.lastName.trim(),
|
||||
email: state.email.trim(),
|
||||
phone: state.phone.trim(),
|
||||
phone: state.dialCode.trim() + state.phone.trim(),
|
||||
language: state.language.trim().isEmpty ? 'es' : state.language.trim(),
|
||||
password: state.password,
|
||||
bornAt: bornAt.millisecondsSinceEpoch,
|
||||
@@ -569,7 +596,7 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
|
||||
_finishWithError(token: token, message: validationError);
|
||||
return false;
|
||||
}
|
||||
|
||||
state = state.copyWith(showSecretCode: true);
|
||||
_finishWithSuccess(token: token, twoFASecret: secretEntity);
|
||||
return true;
|
||||
} catch (e) {
|
||||
@@ -584,6 +611,8 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
|
||||
isLoading: true,
|
||||
errorMessage: '',
|
||||
twoFASecret: null,
|
||||
showSecretCode: false,
|
||||
showAccountCreated: false,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -658,7 +687,7 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
|
||||
}
|
||||
|
||||
void showAccountCreated() {
|
||||
state = state.copyWith(showAccountCreated: true, errorMessage: '');
|
||||
state = state.copyWith(showAccountCreated: true, showSecretCode: false);
|
||||
}
|
||||
|
||||
DateTime? _tryParseDate(String value) {
|
||||
@@ -680,10 +709,10 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
|
||||
return date;
|
||||
}
|
||||
|
||||
String _formatDate(DateTime d) {
|
||||
final dd = d.day.toString().padLeft(2, '0');
|
||||
final mm = d.month.toString().padLeft(2, '0');
|
||||
final yyyy = d.year.toString();
|
||||
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';
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ abstract class SignUpViewState with _$SignUpViewState {
|
||||
@Default('') String lastName,
|
||||
@Default('') String email,
|
||||
@Default('') String phone,
|
||||
@Default('+34') String dialCode,
|
||||
@Default('') String language,
|
||||
DateTime? bornAt,
|
||||
@Default('') String password,
|
||||
@@ -25,7 +26,7 @@ abstract class SignUpViewState with _$SignUpViewState {
|
||||
@Default(false) bool isShowPassword,
|
||||
@Default('') String userId,
|
||||
@Default('') String placeOfBirth,
|
||||
@Default('') String birthCountry,
|
||||
@Default('España') String birthCountry,
|
||||
|
||||
@Default(AddressViewState()) AddressViewState address,
|
||||
|
||||
@@ -41,5 +42,6 @@ abstract class SignUpViewState with _$SignUpViewState {
|
||||
@Default('') String otpError,
|
||||
@Default(false) bool isOtpLoading,
|
||||
@Default(false) bool showAccountCreated,
|
||||
@Default(false) bool showSecretCode,
|
||||
}) = _SignUpViewState;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$SignUpViewState {
|
||||
|
||||
int get currentIndex; String get documentNumber; String get documentType; bool get acceptTerms; String get relationship; String get firstName; String get lastName; String get email; String get phone; String get language; DateTime? get bornAt; String get password; String get repeatPassword; bool get isShowPassword; String get userId; String get placeOfBirth; String get birthCountry; AddressViewState get address; String get emailError; String get passwordError; String get phoneError; String get errorMessage; bool get isLoading; bool get showErrors; String get token; TwoFASecretEntity? get twoFASecret; String get otpCode; String get otpError; bool get isOtpLoading; bool get showAccountCreated;
|
||||
int get currentIndex; String get documentNumber; String get documentType; bool get acceptTerms; String get relationship; 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; String get userId; String get placeOfBirth; String get birthCountry; AddressViewState get address; String get emailError; String get passwordError; String get phoneError; String get errorMessage; bool get isLoading; bool get showErrors; String get token; TwoFASecretEntity? get twoFASecret; String get otpCode; String get otpError; bool get isOtpLoading; bool get showAccountCreated; bool get showSecretCode;
|
||||
/// Create a copy of SignUpViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -25,16 +25,16 @@ $SignUpViewStateCopyWith<SignUpViewState> get copyWith => _$SignUpViewStateCopyW
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is SignUpViewState&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex)&&(identical(other.documentNumber, documentNumber) || other.documentNumber == documentNumber)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.acceptTerms, acceptTerms) || other.acceptTerms == acceptTerms)&&(identical(other.relationship, relationship) || other.relationship == relationship)&&(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.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.userId, userId) || other.userId == userId)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(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.token, token) || other.token == token)&&(identical(other.twoFASecret, twoFASecret) || other.twoFASecret == twoFASecret)&&(identical(other.otpCode, otpCode) || other.otpCode == otpCode)&&(identical(other.otpError, otpError) || other.otpError == otpError)&&(identical(other.isOtpLoading, isOtpLoading) || other.isOtpLoading == isOtpLoading)&&(identical(other.showAccountCreated, showAccountCreated) || other.showAccountCreated == showAccountCreated));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is SignUpViewState&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex)&&(identical(other.documentNumber, documentNumber) || other.documentNumber == documentNumber)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.acceptTerms, acceptTerms) || other.acceptTerms == acceptTerms)&&(identical(other.relationship, relationship) || other.relationship == relationship)&&(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.userId, userId) || other.userId == userId)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(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.token, token) || other.token == token)&&(identical(other.twoFASecret, twoFASecret) || other.twoFASecret == twoFASecret)&&(identical(other.otpCode, otpCode) || other.otpCode == otpCode)&&(identical(other.otpError, otpError) || other.otpError == otpError)&&(identical(other.isOtpLoading, isOtpLoading) || other.isOtpLoading == isOtpLoading)&&(identical(other.showAccountCreated, showAccountCreated) || other.showAccountCreated == showAccountCreated)&&(identical(other.showSecretCode, showSecretCode) || other.showSecretCode == showSecretCode));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hashAll([runtimeType,currentIndex,documentNumber,documentType,acceptTerms,relationship,firstName,lastName,email,phone,language,bornAt,password,repeatPassword,isShowPassword,userId,placeOfBirth,birthCountry,address,emailError,passwordError,phoneError,errorMessage,isLoading,showErrors,token,twoFASecret,otpCode,otpError,isOtpLoading,showAccountCreated]);
|
||||
int get hashCode => Object.hashAll([runtimeType,currentIndex,documentNumber,documentType,acceptTerms,relationship,firstName,lastName,email,phone,dialCode,language,bornAt,password,repeatPassword,isShowPassword,userId,placeOfBirth,birthCountry,address,emailError,passwordError,phoneError,errorMessage,isLoading,showErrors,token,twoFASecret,otpCode,otpError,isOtpLoading,showAccountCreated,showSecretCode]);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SignUpViewState(currentIndex: $currentIndex, documentNumber: $documentNumber, documentType: $documentType, acceptTerms: $acceptTerms, relationship: $relationship, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, bornAt: $bornAt, password: $password, repeatPassword: $repeatPassword, isShowPassword: $isShowPassword, userId: $userId, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, address: $address, emailError: $emailError, passwordError: $passwordError, phoneError: $phoneError, errorMessage: $errorMessage, isLoading: $isLoading, showErrors: $showErrors, token: $token, twoFASecret: $twoFASecret, otpCode: $otpCode, otpError: $otpError, isOtpLoading: $isOtpLoading, showAccountCreated: $showAccountCreated)';
|
||||
return 'SignUpViewState(currentIndex: $currentIndex, documentNumber: $documentNumber, documentType: $documentType, acceptTerms: $acceptTerms, relationship: $relationship, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, dialCode: $dialCode, language: $language, bornAt: $bornAt, password: $password, repeatPassword: $repeatPassword, isShowPassword: $isShowPassword, userId: $userId, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, address: $address, emailError: $emailError, passwordError: $passwordError, phoneError: $phoneError, errorMessage: $errorMessage, isLoading: $isLoading, showErrors: $showErrors, token: $token, twoFASecret: $twoFASecret, otpCode: $otpCode, otpError: $otpError, isOtpLoading: $isOtpLoading, showAccountCreated: $showAccountCreated, showSecretCode: $showSecretCode)';
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ abstract mixin class $SignUpViewStateCopyWith<$Res> {
|
||||
factory $SignUpViewStateCopyWith(SignUpViewState value, $Res Function(SignUpViewState) _then) = _$SignUpViewStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
int currentIndex, String documentNumber, String documentType, bool acceptTerms, String relationship, String firstName, String lastName, String email, String phone, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, String userId, String placeOfBirth, String birthCountry, AddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, String token, TwoFASecretEntity? twoFASecret, String otpCode, String otpError, bool isOtpLoading, bool showAccountCreated
|
||||
int currentIndex, String documentNumber, String documentType, bool acceptTerms, String relationship, String firstName, String lastName, String email, String phone, String dialCode, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, String userId, String placeOfBirth, String birthCountry, AddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, String token, TwoFASecretEntity? twoFASecret, String otpCode, String otpError, bool isOtpLoading, bool showAccountCreated, bool showSecretCode
|
||||
});
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class _$SignUpViewStateCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of SignUpViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? currentIndex = null,Object? documentNumber = null,Object? documentType = null,Object? acceptTerms = null,Object? relationship = null,Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? language = null,Object? bornAt = freezed,Object? password = null,Object? repeatPassword = null,Object? isShowPassword = null,Object? userId = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? address = null,Object? emailError = null,Object? passwordError = null,Object? phoneError = null,Object? errorMessage = null,Object? isLoading = null,Object? showErrors = null,Object? token = null,Object? twoFASecret = freezed,Object? otpCode = null,Object? otpError = null,Object? isOtpLoading = null,Object? showAccountCreated = null,}) {
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? currentIndex = null,Object? documentNumber = null,Object? documentType = null,Object? acceptTerms = null,Object? relationship = 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? userId = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? address = null,Object? emailError = null,Object? passwordError = null,Object? phoneError = null,Object? errorMessage = null,Object? isLoading = null,Object? showErrors = null,Object? token = null,Object? twoFASecret = freezed,Object? otpCode = null,Object? otpError = null,Object? isOtpLoading = null,Object? showAccountCreated = null,Object? showSecretCode = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
currentIndex: null == currentIndex ? _self.currentIndex : currentIndex // ignore: cast_nullable_to_non_nullable
|
||||
as int,documentNumber: null == documentNumber ? _self.documentNumber : documentNumber // ignore: cast_nullable_to_non_nullable
|
||||
@@ -73,6 +73,7 @@ as String,firstName: null == firstName ? _self.firstName : firstName // ignore:
|
||||
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
|
||||
@@ -94,6 +95,7 @@ as TwoFASecretEntity?,otpCode: null == otpCode ? _self.otpCode : otpCode // igno
|
||||
as String,otpError: null == otpError ? _self.otpError : otpError // ignore: cast_nullable_to_non_nullable
|
||||
as String,isOtpLoading: null == isOtpLoading ? _self.isOtpLoading : isOtpLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,showAccountCreated: null == showAccountCreated ? _self.showAccountCreated : showAccountCreated // ignore: cast_nullable_to_non_nullable
|
||||
as bool,showSecretCode: null == showSecretCode ? _self.showSecretCode : showSecretCode // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
@@ -200,10 +202,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int currentIndex, String documentNumber, String documentType, bool acceptTerms, String relationship, String firstName, String lastName, String email, String phone, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, String userId, String placeOfBirth, String birthCountry, AddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, String token, TwoFASecretEntity? twoFASecret, String otpCode, String otpError, bool isOtpLoading, bool showAccountCreated)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int currentIndex, String documentNumber, String documentType, bool acceptTerms, String relationship, String firstName, String lastName, String email, String phone, String dialCode, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, String userId, String placeOfBirth, String birthCountry, AddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, String token, TwoFASecretEntity? twoFASecret, String otpCode, String otpError, bool isOtpLoading, bool showAccountCreated, bool showSecretCode)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _SignUpViewState() when $default != null:
|
||||
return $default(_that.currentIndex,_that.documentNumber,_that.documentType,_that.acceptTerms,_that.relationship,_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.bornAt,_that.password,_that.repeatPassword,_that.isShowPassword,_that.userId,_that.placeOfBirth,_that.birthCountry,_that.address,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.token,_that.twoFASecret,_that.otpCode,_that.otpError,_that.isOtpLoading,_that.showAccountCreated);case _:
|
||||
return $default(_that.currentIndex,_that.documentNumber,_that.documentType,_that.acceptTerms,_that.relationship,_that.firstName,_that.lastName,_that.email,_that.phone,_that.dialCode,_that.language,_that.bornAt,_that.password,_that.repeatPassword,_that.isShowPassword,_that.userId,_that.placeOfBirth,_that.birthCountry,_that.address,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.token,_that.twoFASecret,_that.otpCode,_that.otpError,_that.isOtpLoading,_that.showAccountCreated,_that.showSecretCode);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -221,10 +223,10 @@ return $default(_that.currentIndex,_that.documentNumber,_that.documentType,_that
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int currentIndex, String documentNumber, String documentType, bool acceptTerms, String relationship, String firstName, String lastName, String email, String phone, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, String userId, String placeOfBirth, String birthCountry, AddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, String token, TwoFASecretEntity? twoFASecret, String otpCode, String otpError, bool isOtpLoading, bool showAccountCreated) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int currentIndex, String documentNumber, String documentType, bool acceptTerms, String relationship, String firstName, String lastName, String email, String phone, String dialCode, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, String userId, String placeOfBirth, String birthCountry, AddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, String token, TwoFASecretEntity? twoFASecret, String otpCode, String otpError, bool isOtpLoading, bool showAccountCreated, bool showSecretCode) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _SignUpViewState():
|
||||
return $default(_that.currentIndex,_that.documentNumber,_that.documentType,_that.acceptTerms,_that.relationship,_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.bornAt,_that.password,_that.repeatPassword,_that.isShowPassword,_that.userId,_that.placeOfBirth,_that.birthCountry,_that.address,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.token,_that.twoFASecret,_that.otpCode,_that.otpError,_that.isOtpLoading,_that.showAccountCreated);case _:
|
||||
return $default(_that.currentIndex,_that.documentNumber,_that.documentType,_that.acceptTerms,_that.relationship,_that.firstName,_that.lastName,_that.email,_that.phone,_that.dialCode,_that.language,_that.bornAt,_that.password,_that.repeatPassword,_that.isShowPassword,_that.userId,_that.placeOfBirth,_that.birthCountry,_that.address,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.token,_that.twoFASecret,_that.otpCode,_that.otpError,_that.isOtpLoading,_that.showAccountCreated,_that.showSecretCode);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -241,10 +243,10 @@ return $default(_that.currentIndex,_that.documentNumber,_that.documentType,_that
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int currentIndex, String documentNumber, String documentType, bool acceptTerms, String relationship, String firstName, String lastName, String email, String phone, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, String userId, String placeOfBirth, String birthCountry, AddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, String token, TwoFASecretEntity? twoFASecret, String otpCode, String otpError, bool isOtpLoading, bool showAccountCreated)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int currentIndex, String documentNumber, String documentType, bool acceptTerms, String relationship, String firstName, String lastName, String email, String phone, String dialCode, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, String userId, String placeOfBirth, String birthCountry, AddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, String token, TwoFASecretEntity? twoFASecret, String otpCode, String otpError, bool isOtpLoading, bool showAccountCreated, bool showSecretCode)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _SignUpViewState() when $default != null:
|
||||
return $default(_that.currentIndex,_that.documentNumber,_that.documentType,_that.acceptTerms,_that.relationship,_that.firstName,_that.lastName,_that.email,_that.phone,_that.language,_that.bornAt,_that.password,_that.repeatPassword,_that.isShowPassword,_that.userId,_that.placeOfBirth,_that.birthCountry,_that.address,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.token,_that.twoFASecret,_that.otpCode,_that.otpError,_that.isOtpLoading,_that.showAccountCreated);case _:
|
||||
return $default(_that.currentIndex,_that.documentNumber,_that.documentType,_that.acceptTerms,_that.relationship,_that.firstName,_that.lastName,_that.email,_that.phone,_that.dialCode,_that.language,_that.bornAt,_that.password,_that.repeatPassword,_that.isShowPassword,_that.userId,_that.placeOfBirth,_that.birthCountry,_that.address,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.token,_that.twoFASecret,_that.otpCode,_that.otpError,_that.isOtpLoading,_that.showAccountCreated,_that.showSecretCode);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -256,7 +258,7 @@ return $default(_that.currentIndex,_that.documentNumber,_that.documentType,_that
|
||||
|
||||
|
||||
class _SignUpViewState implements SignUpViewState {
|
||||
const _SignUpViewState({this.currentIndex = 0, this.documentNumber = '', this.documentType = '', this.acceptTerms = false, this.relationship = '', this.firstName = '', this.lastName = '', this.email = '', this.phone = '', this.language = '', this.bornAt, this.password = '', this.repeatPassword = '', this.isShowPassword = false, this.userId = '', this.placeOfBirth = '', this.birthCountry = '', this.address = const AddressViewState(), this.emailError = '', this.passwordError = '', this.phoneError = '', this.errorMessage = '', this.isLoading = false, this.showErrors = false, this.token = '', this.twoFASecret, this.otpCode = '', this.otpError = '', this.isOtpLoading = false, this.showAccountCreated = false});
|
||||
const _SignUpViewState({this.currentIndex = 0, this.documentNumber = '', this.documentType = '', this.acceptTerms = false, this.relationship = '', this.firstName = '', this.lastName = '', this.email = '', this.phone = '', this.dialCode = '+34', this.language = '', this.bornAt, this.password = '', this.repeatPassword = '', this.isShowPassword = false, this.userId = '', this.placeOfBirth = '', this.birthCountry = 'España', this.address = const AddressViewState(), this.emailError = '', this.passwordError = '', this.phoneError = '', this.errorMessage = '', this.isLoading = false, this.showErrors = false, this.token = '', this.twoFASecret, this.otpCode = '', this.otpError = '', this.isOtpLoading = false, this.showAccountCreated = false, this.showSecretCode = false});
|
||||
|
||||
|
||||
@override@JsonKey() final int currentIndex;
|
||||
@@ -268,6 +270,7 @@ class _SignUpViewState implements SignUpViewState {
|
||||
@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 password;
|
||||
@@ -289,6 +292,7 @@ class _SignUpViewState implements SignUpViewState {
|
||||
@override@JsonKey() final String otpError;
|
||||
@override@JsonKey() final bool isOtpLoading;
|
||||
@override@JsonKey() final bool showAccountCreated;
|
||||
@override@JsonKey() final bool showSecretCode;
|
||||
|
||||
/// Create a copy of SignUpViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -300,16 +304,16 @@ _$SignUpViewStateCopyWith<_SignUpViewState> get copyWith => __$SignUpViewStateCo
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SignUpViewState&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex)&&(identical(other.documentNumber, documentNumber) || other.documentNumber == documentNumber)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.acceptTerms, acceptTerms) || other.acceptTerms == acceptTerms)&&(identical(other.relationship, relationship) || other.relationship == relationship)&&(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.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.userId, userId) || other.userId == userId)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(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.token, token) || other.token == token)&&(identical(other.twoFASecret, twoFASecret) || other.twoFASecret == twoFASecret)&&(identical(other.otpCode, otpCode) || other.otpCode == otpCode)&&(identical(other.otpError, otpError) || other.otpError == otpError)&&(identical(other.isOtpLoading, isOtpLoading) || other.isOtpLoading == isOtpLoading)&&(identical(other.showAccountCreated, showAccountCreated) || other.showAccountCreated == showAccountCreated));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SignUpViewState&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex)&&(identical(other.documentNumber, documentNumber) || other.documentNumber == documentNumber)&&(identical(other.documentType, documentType) || other.documentType == documentType)&&(identical(other.acceptTerms, acceptTerms) || other.acceptTerms == acceptTerms)&&(identical(other.relationship, relationship) || other.relationship == relationship)&&(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.userId, userId) || other.userId == userId)&&(identical(other.placeOfBirth, placeOfBirth) || other.placeOfBirth == placeOfBirth)&&(identical(other.birthCountry, birthCountry) || other.birthCountry == birthCountry)&&(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.token, token) || other.token == token)&&(identical(other.twoFASecret, twoFASecret) || other.twoFASecret == twoFASecret)&&(identical(other.otpCode, otpCode) || other.otpCode == otpCode)&&(identical(other.otpError, otpError) || other.otpError == otpError)&&(identical(other.isOtpLoading, isOtpLoading) || other.isOtpLoading == isOtpLoading)&&(identical(other.showAccountCreated, showAccountCreated) || other.showAccountCreated == showAccountCreated)&&(identical(other.showSecretCode, showSecretCode) || other.showSecretCode == showSecretCode));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hashAll([runtimeType,currentIndex,documentNumber,documentType,acceptTerms,relationship,firstName,lastName,email,phone,language,bornAt,password,repeatPassword,isShowPassword,userId,placeOfBirth,birthCountry,address,emailError,passwordError,phoneError,errorMessage,isLoading,showErrors,token,twoFASecret,otpCode,otpError,isOtpLoading,showAccountCreated]);
|
||||
int get hashCode => Object.hashAll([runtimeType,currentIndex,documentNumber,documentType,acceptTerms,relationship,firstName,lastName,email,phone,dialCode,language,bornAt,password,repeatPassword,isShowPassword,userId,placeOfBirth,birthCountry,address,emailError,passwordError,phoneError,errorMessage,isLoading,showErrors,token,twoFASecret,otpCode,otpError,isOtpLoading,showAccountCreated,showSecretCode]);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SignUpViewState(currentIndex: $currentIndex, documentNumber: $documentNumber, documentType: $documentType, acceptTerms: $acceptTerms, relationship: $relationship, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, language: $language, bornAt: $bornAt, password: $password, repeatPassword: $repeatPassword, isShowPassword: $isShowPassword, userId: $userId, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, address: $address, emailError: $emailError, passwordError: $passwordError, phoneError: $phoneError, errorMessage: $errorMessage, isLoading: $isLoading, showErrors: $showErrors, token: $token, twoFASecret: $twoFASecret, otpCode: $otpCode, otpError: $otpError, isOtpLoading: $isOtpLoading, showAccountCreated: $showAccountCreated)';
|
||||
return 'SignUpViewState(currentIndex: $currentIndex, documentNumber: $documentNumber, documentType: $documentType, acceptTerms: $acceptTerms, relationship: $relationship, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, dialCode: $dialCode, language: $language, bornAt: $bornAt, password: $password, repeatPassword: $repeatPassword, isShowPassword: $isShowPassword, userId: $userId, placeOfBirth: $placeOfBirth, birthCountry: $birthCountry, address: $address, emailError: $emailError, passwordError: $passwordError, phoneError: $phoneError, errorMessage: $errorMessage, isLoading: $isLoading, showErrors: $showErrors, token: $token, twoFASecret: $twoFASecret, otpCode: $otpCode, otpError: $otpError, isOtpLoading: $isOtpLoading, showAccountCreated: $showAccountCreated, showSecretCode: $showSecretCode)';
|
||||
}
|
||||
|
||||
|
||||
@@ -320,7 +324,7 @@ abstract mixin class _$SignUpViewStateCopyWith<$Res> implements $SignUpViewState
|
||||
factory _$SignUpViewStateCopyWith(_SignUpViewState value, $Res Function(_SignUpViewState) _then) = __$SignUpViewStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
int currentIndex, String documentNumber, String documentType, bool acceptTerms, String relationship, String firstName, String lastName, String email, String phone, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, String userId, String placeOfBirth, String birthCountry, AddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, String token, TwoFASecretEntity? twoFASecret, String otpCode, String otpError, bool isOtpLoading, bool showAccountCreated
|
||||
int currentIndex, String documentNumber, String documentType, bool acceptTerms, String relationship, String firstName, String lastName, String email, String phone, String dialCode, String language, DateTime? bornAt, String password, String repeatPassword, bool isShowPassword, String userId, String placeOfBirth, String birthCountry, AddressViewState address, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, String token, TwoFASecretEntity? twoFASecret, String otpCode, String otpError, bool isOtpLoading, bool showAccountCreated, bool showSecretCode
|
||||
});
|
||||
|
||||
|
||||
@@ -337,7 +341,7 @@ class __$SignUpViewStateCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of SignUpViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? currentIndex = null,Object? documentNumber = null,Object? documentType = null,Object? acceptTerms = null,Object? relationship = null,Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? language = null,Object? bornAt = freezed,Object? password = null,Object? repeatPassword = null,Object? isShowPassword = null,Object? userId = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? address = null,Object? emailError = null,Object? passwordError = null,Object? phoneError = null,Object? errorMessage = null,Object? isLoading = null,Object? showErrors = null,Object? token = null,Object? twoFASecret = freezed,Object? otpCode = null,Object? otpError = null,Object? isOtpLoading = null,Object? showAccountCreated = null,}) {
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? currentIndex = null,Object? documentNumber = null,Object? documentType = null,Object? acceptTerms = null,Object? relationship = 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? userId = null,Object? placeOfBirth = null,Object? birthCountry = null,Object? address = null,Object? emailError = null,Object? passwordError = null,Object? phoneError = null,Object? errorMessage = null,Object? isLoading = null,Object? showErrors = null,Object? token = null,Object? twoFASecret = freezed,Object? otpCode = null,Object? otpError = null,Object? isOtpLoading = null,Object? showAccountCreated = null,Object? showSecretCode = null,}) {
|
||||
return _then(_SignUpViewState(
|
||||
currentIndex: null == currentIndex ? _self.currentIndex : currentIndex // ignore: cast_nullable_to_non_nullable
|
||||
as int,documentNumber: null == documentNumber ? _self.documentNumber : documentNumber // ignore: cast_nullable_to_non_nullable
|
||||
@@ -348,6 +352,7 @@ as String,firstName: null == firstName ? _self.firstName : firstName // ignore:
|
||||
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
|
||||
@@ -369,6 +374,7 @@ as TwoFASecretEntity?,otpCode: null == otpCode ? _self.otpCode : otpCode // igno
|
||||
as String,otpError: null == otpError ? _self.otpError : otpError // ignore: cast_nullable_to_non_nullable
|
||||
as String,isOtpLoading: null == isOtpLoading ? _self.isOtpLoading : isOtpLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,showAccountCreated: null == showAccountCreated ? _self.showAccountCreated : showAccountCreated // ignore: cast_nullable_to_non_nullable
|
||||
as bool,showSecretCode: null == showSecretCode ? _self.showSecretCode : showSecretCode // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user