Skip to content

Commit

Permalink
fix: small password regiter flow ui fixes (#606)
Browse files Browse the repository at this point in the history
## Description
Fixed small UI issues related to register/login

## Type of Change
- [x] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Refactoring
- [ ] Documentation
- [ ] Chore
  • Loading branch information
ice-hades authored Jan 24, 2025
1 parent 6e141b4 commit 95c207c
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/app/components/inputs/text_input/text_input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ class TextInput extends HookWidget {
void onChangedHandler(String text) {
hasValue.value = text.isNotEmpty;
onChanged?.call(text);
if (isLive) {
if (isLive && hasBeenChanged.value) {
validate(text);
}
hasBeenChanged.value;
hasBeenChanged.value = true;
}

useTextChanged(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class IdentityKeyNameInput extends StatelessWidget {
Widget build(BuildContext context) {
return TextInput(
isLive: true,
keyboardType: TextInputType.emailAddress,
keyboardType: TextInputType.name,
prefixIcon: TextInputIcons(
hasRightDivider: true,
icons: [Assets.svg.iconIdentitykey.icon()],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class SignUpPasswordPage extends HookConsumerWidget {
SizedBox(height: 16.0.s),
PasswordInput(
controller: passwordController,
passwordInputMode: PasswordInputMode.create,
errorText: passwordsError.value,
onFocused: (value) => passwordInputFocused.value = value,
onValueChanged: onFocusedPasswordValue,
Expand All @@ -95,6 +96,7 @@ class SignUpPasswordPage extends HookConsumerWidget {
PasswordInput(
isConfirmation: true,
controller: passwordConfirmationController,
passwordInputMode: PasswordInputMode.create,
errorText: passwordsError.value,
onFocused: (value) => passwordConfirmationInputFocused.value = value,
onValueChanged: onFocusedPasswordValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:ion/app/components/progress_bar/ion_loading_indicator.dart';
import 'package:ion/app/extensions/extensions.dart';
import 'package:ion/app/features/auth/providers/auth_provider.c.dart';
import 'package:ion/app/features/auth/providers/register_action_notifier.c.dart';
import 'package:ion/generated/assets.gen.dart';

class SignUpPasswordButton extends ConsumerWidget {
const SignUpPasswordButton({
Expand All @@ -26,7 +27,7 @@ class SignUpPasswordButton extends ConsumerWidget {
trailingIcon:
registerActionState.isLoading || (authState.valueOrNull?.isAuthenticated).falseOrValue
? const IONLoadingIndicator()
: const SizedBox.shrink(),
: Assets.svg.iconButtonNext.icon(color: context.theme.appColors.onPrimaryAccent),
onPressed: onPressed,
label: Text(context.i18n.button_continue),
mainAxisSize: MainAxisSize.max,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,20 @@ import 'package:ion/app/extensions/extensions.dart';
import 'package:ion/app/features/auth/data/models/password_validation_error_type.dart';
import 'package:ion/generated/assets.gen.dart';

enum PasswordInputMode { create, verify }

class PasswordInput extends HookWidget {
const PasswordInput({
required this.controller,
required this.passwordInputMode,
this.onFocused,
this.onValueChanged,
this.isConfirmation = false,
this.errorText,
super.key,
});

final PasswordInputMode passwordInputMode;
final TextEditingController controller;
final ValueChanged<bool>? onFocused;
final ValueChanged<String>? onValueChanged;
Expand Down Expand Up @@ -52,9 +56,15 @@ class PasswordInput extends HookWidget {
labelText:
isConfirmation ? context.i18n.common_confirm_password : context.i18n.common_password,
controller: controller,
validator: (String? value) => PasswordValidationErrorType.values
.firstWhereOrNull((v) => v.isInvalid(value))
?.getDisplayName(context),
validator: (String? value) => switch (passwordInputMode) {
PasswordInputMode.create => PasswordValidationErrorType.values
.firstWhereOrNull((v) => v.isInvalid(value))
?.getDisplayName(context),
PasswordInputMode.verify =>
PasswordValidationErrorType.values.any((v) => v.isInvalid(value))
? context.i18n.error_invalid_password
: null,
},
obscureText: isPasswordVisible.value == false,
textInputAction: TextInputAction.done,
scrollPadding: EdgeInsets.only(bottom: 200.0.s),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class VerifyIdentityConfirmPasswordDialog<T> extends HookConsumerWidget {
SizedBox(height: 20.0.s),
PasswordInput(
controller: passwordController,
passwordInputMode: PasswordInputMode.verify,
errorText: validationErrorMessage.value,
),
SizedBox(height: 25.0.s),
Expand Down

0 comments on commit 95c207c

Please sign in to comment.