1
0
mirror of https://github.com/immich-app/immich.git synced 2024-11-30 09:47:31 +02:00

feat(mobile): Adds show password field to login (#6918)

Adds show password field to login
This commit is contained in:
martyfuhry 2024-02-05 10:11:30 -05:00 committed by GitHub
parent 8e4bf30424
commit f6b4024a21
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -515,7 +515,7 @@ class EmailInput extends StatelessWidget {
}
}
class PasswordInput extends StatelessWidget {
class PasswordInput extends HookConsumerWidget {
final TextEditingController controller;
final FocusNode? focusNode;
final Function()? onSubmit;
@ -528,9 +528,11 @@ class PasswordInput extends StatelessWidget {
});
@override
Widget build(BuildContext context) {
Widget build(BuildContext context, WidgetRef ref) {
final isPasswordVisible = useState<bool>(false);
return TextFormField(
obscureText: true,
obscureText: !isPasswordVisible.value,
controller: controller,
decoration: InputDecoration(
labelText: 'login_form_label_password'.tr(),
@ -540,6 +542,14 @@ class PasswordInput extends StatelessWidget {
fontWeight: FontWeight.normal,
fontSize: 14,
),
suffixIcon: IconButton(
onPressed: () => isPasswordVisible.value = !isPasswordVisible.value,
icon: Icon(
isPasswordVisible.value
? Icons.visibility_off_sharp
: Icons.visibility_sharp,
),
),
),
autofillHints: const [AutofillHints.password],
keyboardType: TextInputType.text,