forked from eatvio/eatvio_app
refactor(registration): remove username
This commit is contained in:
@@ -87,6 +87,21 @@ class _BlogPostWidgetState extends State<BlogPostWidget> {
|
||||
_iconButton(Icons.mode_comment_outlined),
|
||||
SizedBox(width: 8),
|
||||
_iconButton(Icons.reply_rounded),
|
||||
Spacer(),
|
||||
Icon(
|
||||
Icons.visibility_rounded,
|
||||
size: 16,
|
||||
color: appTheme.gray500,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
Text(
|
||||
'0',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: appTheme.gray500,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -13,7 +13,6 @@ class RegistrationCubit extends Cubit<RegistrationState> {
|
||||
: super(
|
||||
RegistrationState(
|
||||
sheet: UserRegistrationSheet(
|
||||
name: '',
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
email: '',
|
||||
|
||||
@@ -16,8 +16,6 @@ class CredentialsScreen extends StatefulWidget {
|
||||
class _CredentialsScreenState extends State<CredentialsScreen> {
|
||||
final emailController = TextEditingController();
|
||||
|
||||
final nameController = TextEditingController();
|
||||
|
||||
final passwordController = TextEditingController();
|
||||
|
||||
final passwordConfirmationController = TextEditingController();
|
||||
@@ -26,7 +24,6 @@ class _CredentialsScreenState extends State<CredentialsScreen> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
emailController.text = widget.sheet.email;
|
||||
nameController.text = widget.sheet.name;
|
||||
passwordController.text = widget.sheet.password;
|
||||
passwordConfirmationController.text = widget.sheet.passwordConfirmation;
|
||||
}
|
||||
@@ -52,18 +49,6 @@ class _CredentialsScreenState extends State<CredentialsScreen> {
|
||||
},
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text("username".tr),
|
||||
SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
controller: nameController,
|
||||
hintText: 'Введите имя пользователя',
|
||||
textInputAction: TextInputAction.next,
|
||||
onChanged: (newValue) {
|
||||
final registrationCubit = context.read<RegistrationCubit>();
|
||||
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(name: newValue));
|
||||
},
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text("password".tr),
|
||||
SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
|
||||
@@ -177,7 +177,7 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
Future<bool> canGoNext(RegistrationState state) async {
|
||||
switch (step) {
|
||||
case 2:
|
||||
List<String> errors = validateCredentialsFields(state.sheet.email, state.sheet.name, state.sheet.password, state.sheet.passwordConfirmation);
|
||||
List<String> errors = validateCredentialsFields(state.sheet.email, state.sheet.password, state.sheet.passwordConfirmation);
|
||||
if (errors.isEmpty) {
|
||||
return true;
|
||||
} else {
|
||||
@@ -347,7 +347,7 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
return errors;
|
||||
}
|
||||
|
||||
List<String> validateCredentialsFields(String email, String name, String password, String passwordConfirmation) {
|
||||
List<String> validateCredentialsFields(String email, String password, String passwordConfirmation) {
|
||||
List<String> errors = [];
|
||||
|
||||
if (!isEmail(email)) {
|
||||
@@ -358,18 +358,6 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
errors.add('email_empty'.tr);
|
||||
}
|
||||
|
||||
if (name.length < 6) {
|
||||
errors.add('name_short'.tr);
|
||||
}
|
||||
|
||||
if (name.isEmpty) {
|
||||
errors.add('name_empty'.tr);
|
||||
}
|
||||
|
||||
if (password.isEmpty) {
|
||||
errors.add('name_empty'.tr);
|
||||
}
|
||||
|
||||
if (password.length < 6) {
|
||||
errors.add('password_short'.tr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user