1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-01 08:31:59 +00: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 TextEditingController controller;
final FocusNode? focusNode; final FocusNode? focusNode;
final Function()? onSubmit; final Function()? onSubmit;
@ -528,9 +528,11 @@ class PasswordInput extends StatelessWidget {
}); });
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context, WidgetRef ref) {
final isPasswordVisible = useState<bool>(false);
return TextFormField( return TextFormField(
obscureText: true, obscureText: !isPasswordVisible.value,
controller: controller, controller: controller,
decoration: InputDecoration( decoration: InputDecoration(
labelText: 'login_form_label_password'.tr(), labelText: 'login_form_label_password'.tr(),
@ -540,6 +542,14 @@ class PasswordInput extends StatelessWidget {
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
fontSize: 14, fontSize: 14,
), ),
suffixIcon: IconButton(
onPressed: () => isPasswordVisible.value = !isPasswordVisible.value,
icon: Icon(
isPasswordVisible.value
? Icons.visibility_off_sharp
: Icons.visibility_sharp,
),
),
), ),
autofillHints: const [AutofillHints.password], autofillHints: const [AutofillHints.password],
keyboardType: TextInputType.text, keyboardType: TextInputType.text,