diff --git a/lib/screens/authentication/sign_up/create_username/mappers/create_username_mapper.dart b/lib/screens/authentication/sign_up/create_username/mappers/create_username_mapper.dart index 52f6a529b..979e3fc57 100644 --- a/lib/screens/authentication/sign_up/create_username/mappers/create_username_mapper.dart +++ b/lib/screens/authentication/sign_up/create_username/mappers/create_username_mapper.dart @@ -5,12 +5,15 @@ import 'package:seeds/screens/authentication/sign_up/viewmodels/bloc.dart'; import 'package:seeds/screens/authentication/sign_up/viewmodels/states/create_username_state.dart'; class CreateUsernameMapper extends StateMapper { - SignupState mapValidateUsernameToState(SignupState currentState, Result result) { + SignupState mapValidateUsernameToState(SignupState currentState, String username, Result result) { final createUsernameCurrentState = currentState.createUsernameState; if (result.isError) { // Error means username is not taken and is available for the user to take it - final newState = createUsernameCurrentState.copyWith(pageState: PageState.success); + final newState = createUsernameCurrentState.copyWith( + username: username, + pageState: PageState.success, + ); return currentState.copyWith(createUsernameState: newState); } diff --git a/lib/screens/authentication/sign_up/create_username/usecases/create_username_usecase.dart b/lib/screens/authentication/sign_up/create_username/usecases/create_username_usecase.dart index e7e03c4d2..21fe34282 100644 --- a/lib/screens/authentication/sign_up/create_username/usecases/create_username_usecase.dart +++ b/lib/screens/authentication/sign_up/create_username/usecases/create_username_usecase.dart @@ -18,7 +18,7 @@ class CreateUsernameUseCase { final Result result = await _signupRepository.isUsernameTaken(username); - yield CreateUsernameMapper().mapValidateUsernameToState(currentState, result); + yield CreateUsernameMapper().mapValidateUsernameToState(currentState, username, result); } else { yield currentState.copyWith( createUsernameState: CreateUsernameState.error(currentState.createUsernameState, validationError));